Java Code Examples for org.eclipse.jface.viewers.IPostSelectionProvider#addPostSelectionChangedListener()
The following examples show how to use
org.eclipse.jface.viewers.IPostSelectionProvider#addPostSelectionChangedListener() .
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 |
@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 |
private void installSelectionChangedListener() { selectionChangedListener = new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent event) { updateStatusLine(); } }; final ISelectionProvider selectionProvider = getSelectionProvider(); if (selectionProvider instanceof IPostSelectionProvider) { final IPostSelectionProvider postSelectionProvider = (IPostSelectionProvider) selectionProvider; postSelectionProvider.addPostSelectionChangedListener(selectionChangedListener); } else { getSelectionProvider().addSelectionChangedListener(selectionChangedListener); } }
Example 3
Source File: JavaScriptLightWeightEditor.java From typescript.java with MIT License | 5 votes |
/** * Installs this selection changed listener with the given selection * provider. If the selection provider is a post selection provider, * post selection changed events are the preferred choice, otherwise * normal selection changed events are requested. * * @param selectionProvider */ public void install(ISelectionProvider selectionProvider) { if (selectionProvider == null) return; if (selectionProvider instanceof IPostSelectionProvider) { IPostSelectionProvider provider = (IPostSelectionProvider) selectionProvider; provider.addPostSelectionChangedListener(this); } else { selectionProvider.addSelectionChangedListener(this); } }
Example 4
Source File: JavaEditor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Installs this selection changed listener with the given selection provider. If * the selection provider is a post selection provider, post selection changed * events are the preferred choice, otherwise normal selection changed events * are requested. * * @param selectionProvider the selection provider */ public void install(ISelectionProvider selectionProvider) { if (selectionProvider == null) return; if (selectionProvider instanceof IPostSelectionProvider) { IPostSelectionProvider provider= (IPostSelectionProvider) selectionProvider; provider.addPostSelectionChangedListener(this); } else { selectionProvider.addSelectionChangedListener(this); } }
Example 5
Source File: ExecuteCommandHandler.java From e4macs with Eclipse Public License 1.0 | 5 votes |
/** * Add the selection changed listener * * @param selectionProvider */ private void addListener(ISelectionProvider selectionProvider, ISelectionChangedListener listener) { if (selectionProvider instanceof IPostSelectionProvider) { IPostSelectionProvider provider= (IPostSelectionProvider) selectionProvider; provider.addPostSelectionChangedListener(listener); } else { selectionProvider.addSelectionChangedListener(listener); } }