Java Code Examples for org.eclipse.swt.events.FocusListener#focusGained()

The following examples show how to use org.eclipse.swt.events.FocusListener#focusGained() . 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: 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 2
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 3
Source File: EnterXMPPAccountComposite.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
private void notifyFocusGained(FocusEvent e) {
  for (FocusListener focusListener : focusListeners) {
    focusListener.focusGained(e);
  }
}