use of org.eclipse.jface.viewers.IPostSelectionProvider in project webtools.sourceediting by eclipse.
the class GoToMatchingTagAction method setEditor.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.texteditor.TextEditorAction#setEditor(org.eclipse.ui.texteditor.ITextEditor)
*/
public void setEditor(ITextEditor editor) {
ITextEditor textEditor = getTextEditor();
if (textEditor != null) {
removeAnnotation(true);
ISelectionProvider selectionProvider = textEditor.getSelectionProvider();
if (selectionProvider instanceof IPostSelectionProvider) {
((IPostSelectionProvider) selectionProvider).removePostSelectionChangedListener(fUpdateListener);
}
}
super.setEditor(editor);
if (editor != null) {
ISelectionProvider selectionProvider = editor.getSelectionProvider();
if (selectionProvider instanceof IPostSelectionProvider) {
((IPostSelectionProvider) selectionProvider).addPostSelectionChangedListener(fUpdateListener);
}
updateFor(selectionProvider.getSelection());
}
}
use of org.eclipse.jface.viewers.IPostSelectionProvider in project xtext-eclipse by eclipse.
the class RailroadSelectionLinker method setXtextEditor.
public void setXtextEditor(XtextEditor xtextEditor) {
if (currentEditor != null) {
removeTextSelectionListener(currentEditor);
}
if (XTEXT_LANGUAGE_NAME.equals(xtextEditor.getLanguageName())) {
currentEditor = xtextEditor;
ISelectionProvider selectionProvider = xtextEditor.getSelectionProvider();
if (selectionProvider instanceof IPostSelectionProvider)
((IPostSelectionProvider) selectionProvider).addPostSelectionChangedListener(textSelectionChangeListener);
else
selectionProvider.addSelectionChangedListener(textSelectionChangeListener);
}
}
Aggregations