private void refresh() { ITextEditor iteEditor = null; if (this.editor instanceof EcoreEditor) { final EcoreEditor ecEditor = (EcoreEditor) this.editor; ecEditor.getViewer().refresh(); } else { if (this.editor instanceof ITextEditor) { iteEditor = (ITextEditor) this.editor; } else { final MultiPageEditorPart mpepEditor = (MultiPageEditorPart) this.editor; final IEditorPart[] editors = mpepEditor.findEditors(mpepEditor.getEditorInput()); iteEditor = (ITextEditor) editors[0]; } final IDocumentProvider idp = iteEditor.getDocumentProvider(); try { idp.resetDocument(iteEditor.getEditorInput()); } catch (final CoreException e) { e.printStackTrace(); } } MarkerFactory.refreshProjectExp(); if (Activator.getDefault().getWorkbench().getWorkbenchWindows()[0].getActivePage() .findView(Visualization.ID) != null) { Visualization.showViz(); } }
private void refresh() { ITextEditor iteEditor = null; if (editor instanceof EcoreEditor) { final EcoreEditor ecEditor = (EcoreEditor) editor; ecEditor.getViewer().refresh(); } else { if (editor instanceof ITextEditor) { iteEditor = (ITextEditor) editor; } else { final MultiPageEditorPart mpepEditor = (MultiPageEditorPart) editor; final IEditorPart[] editors = mpepEditor.findEditors(mpepEditor.getEditorInput()); iteEditor = (ITextEditor) editors[0]; } final IDocumentProvider idp = iteEditor.getDocumentProvider(); try { idp.resetDocument(iteEditor.getEditorInput()); } catch (final CoreException e) { e.printStackTrace(); } } MarkerFactory.refreshProjectExp(); if (Activator.getDefault().getWorkbench().getWorkbenchWindows()[0].getActivePage() .findView(Visualization.ID) != null) { Visualization.showViz(); } }
private void refresh() { ITextEditor iteEditor = null; if (editor instanceof EcoreEditor) { final EcoreEditor ecEditor = (EcoreEditor) editor; ecEditor.getViewer().refresh(); } else { if (editor instanceof ITextEditor) { iteEditor = (ITextEditor) editor; } else { final MultiPageEditorPart mpepEditor = (MultiPageEditorPart) editor; final IEditorPart[] editors = mpepEditor.findEditors(mpepEditor.getEditorInput()); iteEditor = (ITextEditor) editors[0]; } final IDocumentProvider idp = iteEditor.getDocumentProvider(); try { idp.resetDocument(iteEditor.getEditorInput()); } catch (final CoreException e) { e.printStackTrace(); } } MarkerFactory.refreshProjectExp(); }
private void createMarker() { editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); file = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getActiveEditor().getEditorInput().getAdapter(IFile.class); selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection(); final IMarker beAdded = getMarker(); @SuppressWarnings("unused") String text = ""; if (selection instanceof ITextSelection) { if (beAdded != null && beAdded.exists()) { text = ((ITextSelection) selection).getText(); AnnotationFactory.addAnnotation(beAdded, AnnotationFactory.ANNOTATION_MARKING); } } else if (selection instanceof ITreeSelection) { if (editor instanceof EcoreEditor) { final ITreeSelection treeSelection = (ITreeSelection) selection; if (beAdded != null && beAdded.exists()) { if (treeSelection.getFirstElement() instanceof EModelElement) { text = ((ENamedElement) treeSelection.getFirstElement()).getName(); } else { text = MarkUtilities.getText(beAdded); } } } } addToAlloyXML(beAdded); // MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Mark Information", // null, // "\"" + text + "\" has been selected to be marked", MessageDialog.INFORMATION, // new String[] {"OK"}, 0); // dialog.open(); }
/** * Initializes decorator for given EcoreEditor. */ private void initDecoratingLabelProvider(EcoreEditor eEditor) { TreeViewer treeViewer = (TreeViewer) eEditor.getViewer(); ILabelProvider labelProvider = (ILabelProvider) treeViewer.getLabelProvider(); if (labelProvider instanceof DecoratingLabelProvider) { return; } else { ILabelDecorator decorator = window.getWorkbench().getDecoratorManager().getLabelDecorator(); treeViewer.setLabelProvider(new DecoratingLabelProvider(labelProvider, decorator)); } }
private boolean initSelectionChangeListener(EcoreEditor eEditor) { IFileEditorInput eInput = (IFileEditorInput) eEditor.getEditorInput(); IFile eFile = eInput.getFile(); // Adding SelectionChangeListener to editor. eEditor.getViewer().addSelectionChangedListener(SelectionChangeListener.getInstance(eFile)); return false; }
private void removeSelectionChangeListener(IWorkbenchPartReference partRef) { if (partRef.getPart(false) instanceof IEditorPart) { IEditorPart editor = (IEditorPart) partRef.getPart(false); initContextualView(editor); if (editor instanceof EcoreEditor) { EcoreEditor eEditor = (EcoreEditor) editor; IFileEditorInput eInput = (IFileEditorInput) eEditor.getEditorInput(); IFile eFile = eInput.getFile(); // Removing SelectionChangeListener from editor. ((EcoreEditor) editor).getViewer() .removeSelectionChangedListener(SelectionChangeListener.getInstance(eFile)); } } }
private void refreshActiveEditor() { IEditorPart editor = Activator.getActiveWorkbenchWindow().getActivePage().getActiveEditor(); if (editor == null) { return; } ITextEditor iteEditor = null; if (editor instanceof EcoreEditor) { final EcoreEditor ecEditor = (EcoreEditor) editor; ecEditor.getViewer().refresh(); } else { if (editor instanceof ITextEditor) { iteEditor = (ITextEditor) editor; } else if (editor instanceof MultiPageEditorPart) { final MultiPageEditorPart mpepEditor = (MultiPageEditorPart) editor; final IEditorPart[] editors = mpepEditor.findEditors(mpepEditor.getEditorInput()); iteEditor = (ITextEditor) editors[0]; } if (iteEditor != null) { final IDocumentProvider idp = iteEditor.getDocumentProvider(); try { idp.resetDocument(iteEditor.getEditorInput()); } catch (final CoreException e) { e.printStackTrace(); } } } MarkerFactory.refreshProjectExp(); if (Activator.getDefault().getWorkbench().getWorkbenchWindows()[0].getActivePage() .findView(Visualization.ID) != null) { Visualization.showViz(); } }
UnloadResourceSetOnCloseListener(IWorkbenchPage page, EcoreEditor editor) { this.page = page; this.editor = editor; }