org.eclipse.swt.events.FocusListener Java Examples

The following examples show how to use org.eclipse.swt.events.FocusListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReadOnlyExpressionViewer.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void createTextControl(final int style,
        final TabbedPropertySheetWidgetFactory widgetFactory) {
    super.createTextControl(style | SWT.READ_ONLY, widgetFactory);
    getTextControl().setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    getTextControl().setMessage(Messages.selectTarget);
    final IConfigurationElement[] configurationElements = BonitaStudioExtensionRegistryManager.getInstance().getConfigurationElements(
            "org.bonitasoft.studio.expression.editor.caretDestroyer");
    if (configurationElements.length == 1) {
        try {
            final FocusListener caretDestroyerFocusListener = (FocusListener) configurationElements[0].createExecutableExtension("class");
            getTextControl().addFocusListener(caretDestroyerFocusListener);
        } catch (final CoreException e1) {
            BonitaStudioLog.error(e1);
        }
    }
}
 
Example #2
Source File: MonthCalendar.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public void focusGained(FocusEvent e) {
	Day day = (Day) e.widget;
	if (lastSelectedDay != null && lastSelectedDay != day) {
		lastSelectedDay.setFocusState(Day.NO_FOCUS);
		lastSelectedDay.redraw();
	}

	Point coordinates = day.getMonthPosition();
	selectedDay = new MonthCalendarSelectedDay(day.getDate(), coordinates);
	e.data = selectedDay;

	lastSelectedDay = day;

	for (Iterator<FocusListener> focusListenersIter = focusListeners.iterator(); focusListenersIter.hasNext();) {
		FocusListener listener = (FocusListener) focusListenersIter.next();
		listener.focusGained(e);
	}
}
 
Example #3
Source File: FormatLayoutPeer.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void addFocusListener( FocusListener listener )
{
	if ( cba != null )
	{
		cba.addFocusListener( listener );
	}
	else
	{
		cbb.addFocusListener( listener );
	}
}
 
Example #4
Source File: CustomAbstractInformationControl.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * {@inheritDoc} This method is not intended to be overridden by subclasses.
 */
public void removeFocusListener(FocusListener listener)
{
	fFocusListeners.remove(listener);
	if (fFocusListeners.isEmpty())
	{
		fShell.removeListener(SWT.Activate, fShellListener);
		fShell.removeListener(SWT.Deactivate, fShellListener);
		fShellListener = null;
	}
}
 
Example #5
Source File: CustomAbstractInformationControl.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * {@inheritDoc} This method is not intended to be overridden by subclasses.
 */
public void addFocusListener(final FocusListener listener)
{
	if (fFocusListeners.isEmpty())
	{
		fShellListener = new Listener()
		{

			public void handleEvent(Event event)
			{
				Object[] listeners = fFocusListeners.getListeners();
				for (int i = 0; i < listeners.length; i++)
				{
					FocusListener focusListener = (FocusListener) listeners[i];
					if (event.type == SWT.Activate)
					{
						focusListener.focusGained(new FocusEvent(event));
					}
					else
					{
						focusListener.focusLost(new FocusEvent(event));
					}
				}
			}
		};
		fShell.addListener(SWT.Deactivate, fShellListener);
		fShell.addListener(SWT.Activate, fShellListener);
	}
	fFocusListeners.add(listener);
}
 
Example #6
Source File: TimeSlice.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @see org.eclipse.swt.widgets.Control#addFocusListener
 * 
 * @param listener
 */
public void addCellFocusListener(FocusListener listener) {
	for (Iterator daysIter = columns.iterator(); daysIter.hasNext();) {
		Object dayCandidate = daysIter.next();
		if (dayCandidate instanceof TimeSlot) {
			TimeSlot day = (TimeSlot) dayCandidate;
			day.addFocusListener(listener);
		}
	}
}
 
Example #7
Source File: TimeSlice.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @see org.eclipse.swt.widgets.Control#removeFocusListener
 * @param listener
 */
public void removeCellFocusListener(FocusListener listener) {
	for (Iterator daysIter = columns.iterator(); daysIter.hasNext();) {
		Object dayCandidate = daysIter.next();
		if (dayCandidate instanceof TimeSlot) {
			TimeSlot day = (TimeSlot) dayCandidate;
			day.removeFocusListener(listener);
		}
	}
}
 
Example #8
Source File: MonthCalendar.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void focusLost(FocusEvent e) {
	Day day = (Day) e.widget;
	Point coordinates = day.getMonthPosition();
	e.data = new MonthCalendarSelectedDay(day.getDate(), coordinates);

	for (Iterator<FocusListener> focusListenersIter = focusListeners.iterator(); focusListenersIter.hasNext();) {
		FocusListener listener = (FocusListener) focusListenersIter.next();
		listener.focusLost(e);
	}
}
 
Example #9
Source File: RichTextEditor.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void addFocusListener(FocusListener listener) {
	checkWidget();
	if (listener == null)
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	this.focusListener.add(listener);
}
 
Example #10
Source File: RichTextEditor.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void removeFocusListener(FocusListener listener) {
	checkWidget();
	if (listener == null)
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	this.focusListener.remove(listener);
}
 
Example #11
Source File: EnterXMPPAccountComposite.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void removeFocusListener(FocusListener focusListener) {
  focusListeners.remove(focusListener);
}
 
Example #12
Source File: WarningText.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void addFocusListener( FocusListener lsFocus ) {
  wText.addFocusListener( lsFocus );
}
 
Example #13
Source File: TextVarWarning.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void addFocusListener( FocusListener lsFocus ) {
  wText.addFocusListener( lsFocus );
}
 
Example #14
Source File: CustomInformationControl.java    From uima-uimaj with Apache License 2.0 4 votes vote down vote up
@Override
public void removeFocusListener(FocusListener listener) {
  mShell.removeFocusListener(listener);
}
 
Example #15
Source File: CheckBoxVar.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void addFocusListener( FocusListener lsFocus ) {
  wBox.addFocusListener( lsFocus );
}
 
Example #16
Source File: TextVar.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void addFocusListener( FocusListener lsFocus ) {
  wText.addFocusListener( lsFocus );
}
 
Example #17
Source File: ComboVar.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void addFocusListener( FocusListener lsFocus ) {
  wCombo.addFocusListener( lsFocus );
}
 
Example #18
Source File: ChartComposite.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
     * Hook an SWT listener on the canvas where the chart is drawn.
     * The purpose of this method is to allow some degree of customization.
     *
     * @param listener The SWT listener to attach to the canvas.
     */
    public void addSWTListener(EventListener listener) {
        if (listener instanceof ControlListener) {
            this.canvas.addControlListener((ControlListener) listener);
        }
        else if (listener instanceof DisposeListener) {
            this.canvas.addDisposeListener((DisposeListener) listener);
//      }
//      else if (listener instanceof DragDetectListener) {
//          this.canvas.addDragDetectListener((DragDetectListener) listener);
        }
        else if (listener instanceof FocusListener) {
            this.canvas.addFocusListener((FocusListener) listener);
        }
        else if (listener instanceof HelpListener) {
            this.canvas.addHelpListener((HelpListener) listener);
        }
        else if (listener instanceof KeyListener) {
            this.canvas.addKeyListener((KeyListener) listener);
//      }
//      else if (listener instanceof MenuDetectListener) {
//          this.canvas.addMenuDetectListener((MenuDetectListener) listener);
        }
        else if (listener instanceof MouseListener) {
            this.canvas.addMouseListener((MouseListener) listener);
        }
        else if (listener instanceof MouseMoveListener) {
            this.canvas.addMouseMoveListener((MouseMoveListener) listener);
        }
        else if (listener instanceof MouseTrackListener) {
            this.canvas.addMouseTrackListener((MouseTrackListener) listener);
//      } else if (listener instanceof MouseWheelListener) {
//          this.canvas.addMouseWheelListener((MouseWheelListener) listener);
        }
        else if (listener instanceof PaintListener) {
            this.canvas.addPaintListener((PaintListener) listener);
        }
        else if (listener instanceof TraverseListener) {
            this.canvas.addTraverseListener((TraverseListener) listener);
        }
    }
 
Example #19
Source File: CustomInformationControl.java    From uima-uimaj with Apache License 2.0 4 votes vote down vote up
@Override
public void addFocusListener(FocusListener listener) {
  mShell.addFocusListener(listener);
}
 
Example #20
Source File: SourceViewerInformationControl.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void removeFocusListener(FocusListener listener) {
	fText.removeFocusListener(listener);
}
 
Example #21
Source File: EnterXMPPAccountComposite.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void addFocusListener(FocusListener focusListener) {
  focusListeners.add(focusListener);
}
 
Example #22
Source File: ReportMultiBookPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void removeFocusListener( FocusListener listener )
{
}
 
Example #23
Source File: ReportMultiBookPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void addFocusListener( FocusListener listener )
{
}
 
Example #24
Source File: ChartComposite.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Hook an SWT listener on the canvas where the chart is drawn.
 * The purpose of this method is to allow some degree of customization.
 * @param listener The SWT listener to attach to the canvas.
 */
public void addSWTListener(SWTEventListener listener) {
    if (listener instanceof ControlListener) {
        this.canvas.addControlListener((ControlListener) listener);
    } 
    else if (listener instanceof DisposeListener) {
        this.canvas.addDisposeListener((DisposeListener) listener);
    } 
    else if (listener instanceof DragDetectListener) {
        this.canvas.addDragDetectListener((DragDetectListener) listener);
    } 
    else if (listener instanceof FocusListener) {
        this.canvas.addFocusListener((FocusListener) listener);
    } 
    else if (listener instanceof HelpListener) {
        this.canvas.addHelpListener((HelpListener) listener);
    } 
    else if (listener instanceof KeyListener) {
        this.canvas.addKeyListener((KeyListener) listener);
    } 
    else if (listener instanceof MenuDetectListener) {
        this.canvas.addMenuDetectListener((MenuDetectListener) listener);
    } 
    else if (listener instanceof MouseListener) {
        this.canvas.addMouseListener((MouseListener) listener);
    } 
    else if (listener instanceof MouseMoveListener) {
        this.canvas.addMouseMoveListener((MouseMoveListener) listener);
    } 
    else if (listener instanceof MouseTrackListener) {
        this.canvas.addMouseTrackListener((MouseTrackListener) listener);
    } 
    else if (listener instanceof MouseWheelListener) {
        this.canvas.addMouseWheelListener((MouseWheelListener) listener);
    } 
    else if (listener instanceof PaintListener) {
        this.canvas.addPaintListener((PaintListener) listener);
    } 
    else if (listener instanceof TraverseListener) {
        this.canvas.addTraverseListener((TraverseListener) listener);
    } 
}
 
Example #25
Source File: ChartComposite.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Hook an SWT listener on the canvas where the chart is drawn.
 * The purpose of this method is to allow some degree of customization.
 *
 * @param listener The SWT listener to attach to the canvas.
 */
public void addSWTListener(EventListener listener) {
    if (listener instanceof ControlListener) {
        this.canvas.addControlListener((ControlListener) listener);
    }
    else if (listener instanceof DisposeListener) {
        this.canvas.addDisposeListener((DisposeListener) listener);
    }
    else if (listener instanceof DragDetectListener) {
        this.canvas.addDragDetectListener((DragDetectListener) listener);
    }
    else if (listener instanceof FocusListener) {
        this.canvas.addFocusListener((FocusListener) listener);
    }
    else if (listener instanceof HelpListener) {
        this.canvas.addHelpListener((HelpListener) listener);
    }
    else if (listener instanceof KeyListener) {
        this.canvas.addKeyListener((KeyListener) listener);
    }
    else if (listener instanceof MenuDetectListener) {
        this.canvas.addMenuDetectListener((MenuDetectListener) listener);
    }
    else if (listener instanceof MouseListener) {
        this.canvas.addMouseListener((MouseListener) listener);
    }
    else if (listener instanceof MouseMoveListener) {
        this.canvas.addMouseMoveListener((MouseMoveListener) listener);
    }
    else if (listener instanceof MouseTrackListener) {
        this.canvas.addMouseTrackListener((MouseTrackListener) listener);
    }
    else if (listener instanceof MouseWheelListener) {
        this.canvas.addMouseWheelListener((MouseWheelListener) listener);
    }
    else if (listener instanceof PaintListener) {
        this.canvas.addPaintListener((PaintListener) listener);
    }
    else if (listener instanceof TraverseListener) {
        this.canvas.addTraverseListener((TraverseListener) listener);
    }
}
 
Example #26
Source File: ChartComposite.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
     * Hook an SWT listener on the canvas where the chart is drawn.
     * The purpose of this method is to allow some degree of customization.
     *
     * @param listener The SWT listener to attach to the canvas.
     */
    public void addSWTListener(EventListener listener) {
        if (listener instanceof ControlListener) {
            this.canvas.addControlListener((ControlListener) listener);
        }
        else if (listener instanceof DisposeListener) {
            this.canvas.addDisposeListener((DisposeListener) listener);
//      }
//      else if (listener instanceof DragDetectListener) {
//          this.canvas.addDragDetectListener((DragDetectListener) listener);
        }
        else if (listener instanceof FocusListener) {
            this.canvas.addFocusListener((FocusListener) listener);
        }
        else if (listener instanceof HelpListener) {
            this.canvas.addHelpListener((HelpListener) listener);
        }
        else if (listener instanceof KeyListener) {
            this.canvas.addKeyListener((KeyListener) listener);
//      }
//      else if (listener instanceof MenuDetectListener) {
//          this.canvas.addMenuDetectListener((MenuDetectListener) listener);
        }
        else if (listener instanceof MouseListener) {
            this.canvas.addMouseListener((MouseListener) listener);
        }
        else if (listener instanceof MouseMoveListener) {
            this.canvas.addMouseMoveListener((MouseMoveListener) listener);
        }
        else if (listener instanceof MouseTrackListener) {
            this.canvas.addMouseTrackListener((MouseTrackListener) listener);
//      } else if (listener instanceof MouseWheelListener) {
//          this.canvas.addMouseWheelListener((MouseWheelListener) listener);
        }
        else if (listener instanceof PaintListener) {
            this.canvas.addPaintListener((PaintListener) listener);
        }
        else if (listener instanceof TraverseListener) {
            this.canvas.addTraverseListener((TraverseListener) listener);
        }
    }
 
Example #27
Source File: AbstractInformationControl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void removeFocusListener(FocusListener listener) {
	getShell().removeFocusListener(listener);
}
 
Example #28
Source File: AbstractInformationControl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void addFocusListener(FocusListener listener) {
	getShell().addFocusListener(listener);
}
 
Example #29
Source File: SourceViewerInformationControl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void removeFocusListener(FocusListener listener) {
	fText.removeFocusListener(listener);
}
 
Example #30
Source File: SourceViewerInformationControl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void addFocusListener(FocusListener listener) {
	fText.addFocusListener(listener);
}