Java Code Examples for org.eclipse.jface.viewers.IPostSelectionProvider#removePostSelectionChangedListener()

The following examples show how to use org.eclipse.jface.viewers.IPostSelectionProvider#removePostSelectionChangedListener() . 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: LinkWithEditorTest.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testTreeToText() throws Exception {
	IPostSelectionProvider editorSelectionProvider = (IPostSelectionProvider) editor.getSelectionProvider();
	editorSelectionProvider.addPostSelectionChangedListener(selectionSyncer);
	assertSelected(treeViewer);

	activate(editor);
	try {
		selectionSyncer.start();
		treeViewer.setSelection(new StructuredSelection(modelNode));
		selectionSyncer.awaitSignal(EXPECTED_TIMEOUT);
		fail("Selection from inactive part should not be linked");
	} catch (TimeoutException e) {
	}

	activate(outlineView);
	try {
		checkTreeSelectionToText(modelNode, modelAsText, selectionSyncer);
		checkTreeSelectionToText(oneNode, "one", selectionSyncer);
		checkTreeSelectionToText(twoNode, "two", selectionSyncer);
		checkTreeSelectionToText(threeNode, "three", selectionSyncer);
		checkTreeSelectionToText(fourNode, "four", selectionSyncer);
	} finally {
		editorSelectionProvider.removePostSelectionChangedListener(selectionSyncer);
	}
}
 
Example 2
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 3
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 4
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 5
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);
	}
}