Java Code Examples for org.eclipse.swt.widgets.Widget#removeListener()

The following examples show how to use org.eclipse.swt.widgets.Widget#removeListener() . 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: AbstractExampleTab.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private void updateListeners() {
	for (int eventId : eventIds) {
		boolean selected = selectedEvents.contains(new Integer(eventId));

		controlExample.removeListener(eventId, listenerThatPrints);
		if (selected && listen.getSelection()) {
			controlExample.addListener(eventId, listenerThatPrints);
		}

		for (Iterator iterator = additionalEventParticipants.iterator(); iterator.hasNext();) {
			Widget participant = (Widget) iterator.next();

			participant.removeListener(eventId, listenerThatPrints);
			if (selected && listen.getSelection()) {
				participant.addListener(eventId, listenerThatPrints);
			}
		}
	}
}
 
Example 2
Source File: ContentAssistant.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
 */
public void handleEvent(Event event)
{
	Widget source = event.widget;
	source.removeListener(SWT.Dispose, this);

	int type = getShellType(source);
	checkType(type);
	fShells[type] = null;

	switch (type)
	{
		case LAYOUT_PROPOSAL_SELECTOR:
			if (fContextType == LAYOUT_CONTEXT_SELECTOR && Helper.okToUse(fShells[LAYOUT_CONTEXT_SELECTOR]))
			{
				// Restore event notification to the tip popup.
				addContentAssistListener((IContentAssistListener) fPopups[LAYOUT_CONTEXT_SELECTOR],
						CONTEXT_SELECTOR);
			}
			break;

		case LAYOUT_CONTEXT_SELECTOR:
			if (Helper.okToUse(fShells[LAYOUT_PROPOSAL_SELECTOR]))
			{
				if (fProposalPopupOrientation == PROPOSAL_STACKED)
				{
					layout(LAYOUT_PROPOSAL_SELECTOR, getSelectionOffset());
				}
				// Restore event notification to the proposal popup.
				addContentAssistListener((IContentAssistListener) fPopups[LAYOUT_PROPOSAL_SELECTOR],
						PROPOSAL_SELECTOR);
			}
			fContextType = LAYOUT_CONTEXT_INFO_POPUP;
			break;

		case LAYOUT_CONTEXT_INFO_POPUP:
			if (Helper.okToUse(fShells[LAYOUT_PROPOSAL_SELECTOR]))
			{
				if (fContextInfoPopupOrientation == CONTEXT_INFO_BELOW)
				{
					layout(LAYOUT_PROPOSAL_SELECTOR, getSelectionOffset());
				}
			}
			fContextType = LAYOUT_CONTEXT_SELECTOR;
			break;

		default:
			break;
	}
}