/** * Adds this instance as a {@link ISelectionChangedListener} on the given editor. * * @param editor the {@link DialectEditor}. */ private void addSelectionListener(DialectEditor editor) { ISelectionProvider selectionProvider = editor.getEditorSite().getSelectionProvider(); selectionProvider.addSelectionChangedListener(this); }
/** * Removes this instance from the given editor selection listeners. * * @param dialectEditor the {@link DialectEditor}. */ private void removeSelectionListener(DialectEditor dialectEditor) { ISelectionProvider selectionProvider = dialectEditor.getEditorSite().getSelectionProvider(); selectionProvider.removeSelectionChangedListener(this); }
private void selectRepresentationElements(ISelection selection, DialectEditor dialectEditor) { List<DRepresentationElement> representationElements = getRepresentationElements( dialectEditor.getRepresentation(), ((IStructuredSelection) selection).toList()); DialectUIManager.INSTANCE.selectAndReveal(dialectEditor, representationElements); }