Java Code Examples for org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener()

The following examples show how to use org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener() . 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: GenerateActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void dispose() {
	if (fRegisteredSelectionListeners != null) {
		ISelectionProvider provider= fSelectionProvider;
		for (Iterator<ISelectionChangedListener> iter= fRegisteredSelectionListeners.iterator(); iter.hasNext();) {
			ISelectionChangedListener listener= iter.next();
			provider.removeSelectionChangedListener(listener);
		}
	}
	if (fQuickAccessHandlerActivation != null && fHandlerService != null) {
		fHandlerService.deactivateHandler(fQuickAccessHandlerActivation);
	}
	fEditor= null;
	fCleanUp.dispose();
	super.dispose();
}
 
Example 2
Source File: AbstractInfoView.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public final void dispose() {
	// cancel possible running computation
	fComputeCount++;
	if (fComputeProgressMonitor != null)
		fComputeProgressMonitor.setCanceled(true);

	getSite().getWorkbenchWindow().getPartService().removePartListener(fPartListener);

	ISelectionProvider provider= getSelectionProvider();
	if (provider != null)
		provider.removeSelectionChangedListener(fCopyToClipboardAction);

	JFaceResources.getColorRegistry().removeListener(this);
	fBackgroundColorRGB= null;
	if (fBackgroundColor != null) {
		fBackgroundColor.dispose();
		fBackgroundColor= null;
	}

	internalDispose();

}
 
Example 3
Source File: OfflineActionTarget.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Uninstalls itself. I.e. removes all listeners installed in <code>install</code>.
 */
private void uninstall() {
    synchronized (lock) {
        if (!fInstalled) {
            return;
        }
        fTextViewer.removeTextListener(this);

        ISelectionProvider selectionProvider = fTextViewer.getSelectionProvider();
        if (selectionProvider != null)
            selectionProvider.removeSelectionChangedListener(this);

        StyledText text = fTextViewer.getTextWidget();
        if (text != null) {
            text.removeMouseListener(this);
            text.removeFocusListener(this);
        }

        if (fTextViewer instanceof ITextViewerExtension) {
            ((ITextViewerExtension) fTextViewer).removeVerifyKeyListener(this);

        } else {
            if (text != null)
                text.removeVerifyKeyListener(this);
        }

        if (keyAssistDialog != null) {
            keyAssistDialog.close();
        }
        keyAssistDialog = null;
        fInstalled = false;
    }
}
 
Example 4
Source File: WithMinibuffer.java    From e4macs with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Uninstalls itself. I.e. removes all listeners installed in
 * <code>install</code>.
 */
private void uninstall() {
	try {
		if (isInstalled()) {
			setKeyFilter(true);
			if (viewer != null) {
				removeStatusContribution(editor);
				viewer.removeTextListener(this);

				ISelectionProvider selectionProvider = viewer.getSelectionProvider();
				if (selectionProvider != null)
					selectionProvider.removeSelectionChangedListener(this);

				if (widget != null && !widget.isDisposed()) {
					widget.removeMouseListener(this);
					widget.removeFocusListener(this);
				}

				if (viewer instanceof ITextViewerExtension) {
					((ITextViewerExtension) viewer).removeVerifyKeyListener(this);
					KbdMacroSupport.setKbdMinibuffer(null);
				} else {
					if (widget != null && !widget.isDisposed())
						widget.removeVerifyKeyListener(this);
				}
				removeOtherListeners(page, viewer, widget);
			}
		}
	} finally {
		widget = null;
		page = null;	// TODO: elsewhere?
		installed = false;
	}
}
 
Example 5
Source File: XtextEditor.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
private void uninstallSelectionChangedListener() {
	ISelectionProvider selectionProvider = getSelectionProvider();
	if (selectionProvider != null) {
		if (selectionProvider instanceof IPostSelectionProvider) {
			final IPostSelectionProvider postSelectionProvider = (IPostSelectionProvider) selectionProvider;
			postSelectionProvider.removePostSelectionChangedListener(selectionChangedListener);
		} else {
			selectionProvider.removeSelectionChangedListener(selectionChangedListener);
		}
	}
}
 
Example 6
Source File: JavaEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Removes this selection changed listener from the given selection provider.
 *
 * @param selectionProvider the selection provider
 */
public void uninstall(ISelectionProvider selectionProvider) {
	if (selectionProvider == null)
		return;

	if (selectionProvider instanceof IPostSelectionProvider)  {
		IPostSelectionProvider provider= (IPostSelectionProvider) selectionProvider;
		provider.removePostSelectionChangedListener(this);
	} else  {
		selectionProvider.removeSelectionChangedListener(this);
	}
}
 
Example 7
Source File: JavaScriptLightWeightEditor.java    From typescript.java with MIT License 5 votes vote down vote up
/**
 * Removes this selection changed listener from the given selection
 * provider.
 *
 * @param selectionProvider
 *            the selection provider
 */
public void uninstall(ISelectionProvider selectionProvider) {
	if (selectionProvider == null)
		return;

	if (selectionProvider instanceof IPostSelectionProvider) {
		IPostSelectionProvider provider = (IPostSelectionProvider) selectionProvider;
		provider.removePostSelectionChangedListener(this);
	} else {
		selectionProvider.removeSelectionChangedListener(this);
	}
}
 
Example 8
Source File: ViewActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void dispose() {
	fFilterActionGroup.dispose();
	fShowActionGroup.dispose();
	fChangeListener= null;
	ISelectionProvider selectionProvider= fSite.getSelectionProvider();
	selectionProvider.removeSelectionChangedListener(fWorkingSetAssignementAction);
	super.dispose();
}
 
Example 9
Source File: AbstractThemeableEditor.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public void uninstall(ISelectionProvider selectionProvider)
{
	if (selectionProvider == null)
	{
		return;
	}
	if (selectionProvider instanceof IPostSelectionProvider)
	{
		((IPostSelectionProvider) selectionProvider).removePostSelectionChangedListener(this);
	}
	else
	{
		selectionProvider.removeSelectionChangedListener(this);
	}
}
 
Example 10
Source File: ExecuteCommandHandler.java    From e4macs with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Remove the selection changed listener
 * 
 * @param selectionProvider
 */
private void removeListener(ISelectionProvider selectionProvider, ISelectionChangedListener listener) {
	if (selectionProvider instanceof IPostSelectionProvider)  {
		IPostSelectionProvider provider= (IPostSelectionProvider) selectionProvider;
		provider.removePostSelectionChangedListener(listener);
	} else  {
		selectionProvider.removeSelectionChangedListener(listener);
	}
}
 
Example 11
Source File: RefactorActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void disposeAction(ISelectionChangedListener action, ISelectionProvider provider) {
	if (action != null)
		provider.removeSelectionChangedListener(action);
}
 
Example 12
Source File: ChartActionBarContributor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void deactivate ()
{
    this.activeEditor.removePropertyListener ( this );

    this.deleteAction.setActiveWorkbenchPart ( null );
    this.cutAction.setActiveWorkbenchPart ( null );
    this.copyAction.setActiveWorkbenchPart ( null );
    this.pasteAction.setActiveWorkbenchPart ( null );
    this.undoAction.setActiveWorkbenchPart ( null );
    this.redoAction.setActiveWorkbenchPart ( null );

    if ( this.loadResourceAction != null )
    {
        this.loadResourceAction.setActiveWorkbenchPart ( null );
    }

    if ( this.controlAction != null )
    {
        this.controlAction.setActiveWorkbenchPart ( null );
    }

    if ( this.validateAction != null )
    {
        this.validateAction.setActiveWorkbenchPart ( null );
    }

    final ISelectionProvider selectionProvider = this.activeEditorPart instanceof ISelectionProvider ? (ISelectionProvider)this.activeEditorPart : this.activeEditorPart.getSite ().getSelectionProvider ();

    if ( selectionProvider != null )
    {
        selectionProvider.removeSelectionChangedListener ( this.deleteAction );
        selectionProvider.removeSelectionChangedListener ( this.cutAction );
        selectionProvider.removeSelectionChangedListener ( this.copyAction );
        selectionProvider.removeSelectionChangedListener ( this.pasteAction );

        if ( this.validateAction != null )
        {
            selectionProvider.removeSelectionChangedListener ( this.validateAction );
        }

        if ( this.controlAction != null )
        {
            selectionProvider.removeSelectionChangedListener ( this.controlAction );
        }

        if ( this.saveAsAction != null )
        {
            selectionProvider.removeSelectionChangedListener ( this.saveAsAction );
        }
    }
}
 
Example 13
Source File: ReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void disposeAction(ISelectionChangedListener action, ISelectionProvider provider) {
	if (action != null)
		provider.removeSelectionChangedListener(action);
}
 
Example 14
Source File: ReadReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void disposeAction(ISelectionChangedListener action, ISelectionProvider provider) {
	if (action != null)
		provider.removeSelectionChangedListener(action);
}
 
Example 15
Source File: CCPActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void deregisterActionsAsSelectionChangeListeners() {
	ISelectionProvider provider= fSelectionProvider;
	for (int i= 0; i < fActions.length; i++) {
		provider.removeSelectionChangedListener(fActions[i]);
	}
}
 
Example 16
Source File: DeclarationsSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void disposeAction(ISelectionChangedListener action, ISelectionProvider provider) {
	if (action != null)
		provider.removeSelectionChangedListener(action);
}
 
Example 17
Source File: OccurrencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void disposeAction(ISelectionChangedListener action, ISelectionProvider provider) {
	if (action != null)
		provider.removeSelectionChangedListener(action);
}
 
Example 18
Source File: ImplementorsSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void disposeAction(ISelectionChangedListener action, ISelectionProvider provider) {
	if (action != null)
		provider.removeSelectionChangedListener(action);
}
 
Example 19
Source File: RefactorActionGroup.java    From typescript.java with MIT License 4 votes vote down vote up
private void disposeAction(ISelectionChangedListener action, ISelectionProvider provider) {
	if (action != null)
		provider.removeSelectionChangedListener(action);
}
 
Example 20
Source File: ReferencesSearchGroup.java    From typescript.java with MIT License 4 votes vote down vote up
private void disposeAction(ISelectionChangedListener action, ISelectionProvider provider) {
	if (action != null)
		provider.removeSelectionChangedListener(action);
}