@Override public void doRevertToSaved() { super.doRevertToSaved(); callback.afterSave(this); }
@Override protected void doSetInput(IEditorInput input) throws CoreException { if (log.isDebugEnabled()) { log.debug("doSetInput:" + input); log.debug("Editor instance is [" + this.toString() + "]"); } removePropertyListener(dirtyListener); callback.beforeSetInput(this); super.doSetInput(input); callback.afterSetInput(this); addPropertyListener(dirtyListener); }
public boolean onValidateEditorInputState(XtextEditor xtextEditor) { for (IXtextEditorCallback xtextEditorCallback : editorCallbacks) { try { if (!xtextEditorCallback.onValidateEditorInputState(xtextEditor)) { return false; } } catch (Exception e) { handle(e); } } return true; }
@Override public boolean validateEditorInputState() { return callback.onValidateEditorInputState(this) && super.validateEditorInputState(); }
@Override protected SourceViewer createSourceViewer(Composite parent, int textOrientation) { if (getSite() != null) { if (sourceViewerEditorMap == null) { sourceViewerEditorMap = Maps.newHashMapWithExpectedSize(3); } DefaultMergeEditor mergeEditor = createMergeEditor(); mergeEditor.setXtextEditorCallback(new CompoundXtextEditorCallback(null)); mergeEditor.setTextOrientation(textOrientation); mergeEditor.setInternalSite(getSite()); mergeEditor.createPartControl(parent); SourceViewer internalSourceViewer = (SourceViewer) mergeEditor.getInternalSourceViewer(); sourceViewerEditorMap.put(internalSourceViewer, mergeEditor); return internalSourceViewer; } return super.createSourceViewer(parent, textOrientation); }
@Override public void createPartControl(Composite parent) { super.createPartControl(parent); ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer(); projectionSupport = installProjectionSupport(projectionViewer); installFoldingSupport(projectionViewer); installHighlightingHelper(); installSelectionChangedListener(); callback.afterCreatePartControl(this); }
@Override public void dispose() { callback.beforeDispose(this); actioncontributor.editorDisposed(this); super.dispose(); if (projectionSupport != null) { projectionSupport.dispose(); } if (outlinePage != null) { outlinePage = null; } uninstallFoldingSupport(); uninstallHighlightingHelper(); uninstallSelectionChangedListener(); }
public void beforeDispose(XtextEditor xtextEditor) { for (IXtextEditorCallback xtextEditorCallback : editorCallbacks) { try { xtextEditorCallback.beforeDispose(xtextEditor); } catch (Exception e) { handle(e); } } }
public void propertyChanged(Object source, int propId) { if (propId == PROP_DIRTY && !isDirty()) { callback.afterSave(XtextEditor.this); } } };
public void afterSave(XtextEditor xtextEditor) { for (IXtextEditorCallback xtextEditorCallback : editorCallbacks) { try { xtextEditorCallback.afterSave(xtextEditor); } catch (Exception e) { handle(e); } } }
@Override public void doSaveAs() { super.doSaveAs(); callback.afterSave(this); }
public void afterCreatePartControl(XtextEditor xtextEditor) { for (IXtextEditorCallback xtextEditorCallback : editorCallbacks) { try { xtextEditorCallback.afterCreatePartControl(xtextEditor); } catch (Exception e) { handle(e); } } }
@Override public void doSave(IProgressMonitor progressMonitor) { super.doSave(progressMonitor); callback.afterSave(this); }
public void beforeSetInput(XtextEditor xtextEditor) { for (int i = editorCallbacks.size() - 1; i >= 0; i--) { try { editorCallbacks.get(i).beforeSetInput(xtextEditor); } catch (Exception e) { handle(e); } } }
public void afterSetInput(XtextEditor xtextEditor) { for (IXtextEditorCallback xtextEditorCallback : editorCallbacks) { try { xtextEditorCallback.afterSetInput(xtextEditor); } catch (Exception e) { handle(e); } } }
@Inject public CompoundXtextEditorCallback(Injector injector) { List<Binding<IXtextEditorCallback>> bindingsByType = injector == null ? Lists .<Binding<IXtextEditorCallback>> newArrayList() : injector.findBindingsByType(TypeLiteral .get(IXtextEditorCallback.class)); for (Binding<IXtextEditorCallback> binding : bindingsByType) { try { editorCallbacks.add(binding.getProvider().get()); } catch (Exception e) { handle(e); } } }