/** * @since 2.0 */ protected void configureTextInputListener() { textInputListener = new ITextInputListener() { public void inputDocumentChanged(IDocument oldInput, IDocument newInput) { try { if (xtextDocument != null && modelListener != null) xtextDocument.removeModelListener(modelListener); xtextDocument = XtextDocumentUtil.get(newInput); if (xtextDocument != null && modelListener != null) { xtextDocument.addModelListener(modelListener); scheduleRefresh(); } } catch (Throwable t) { LOG.error("Error refreshing outline", t); } } public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) { } }; sourceViewer.addTextInputListener(textInputListener); }
/** * Adds the given annotation type to the list of annotation types whose annotations should be * painted by this painter using the given strategy. If the annotation type is already in this * list, the old strategy gets replaced. * * @param annotationType the annotation type * @param strategyID the id of the drawing or text style strategy that should be used for this * annotation type * @since 3.0 */ public void addAnnotationType(Object annotationType, Object strategyID) { fAnnotationType2PaintingStrategyId.put(annotationType, strategyID); fCachedAnnotationType2PaintingStrategy.clear(); if (fTextInputListener == null) { fTextInputListener= new ITextInputListener() { @Override public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) { fInputDocumentAboutToBeChanged= true; } @Override public void inputDocumentChanged(IDocument oldInput, IDocument newInput) { fInputDocumentAboutToBeChanged= false; } }; fSourceViewer.addTextInputListener(fTextInputListener); } }
/** * Adds the given annotation type to the list of annotation types whose annotations should be * painted by this painter using the given strategy. If the annotation type is already in this * list, the old strategy gets replaced. * * @param annotationType the annotation type * @param strategyID the id of the drawing or text style strategy that should be used for this * annotation type * @since 3.0 */ public void addAnnotationType(Object annotationType, Object strategyID) { fAnnotationType2PaintingStrategyId.put(annotationType, strategyID); fCachedAnnotationType2PaintingStrategy.clear(); if (fTextInputListener == null) { fTextInputListener= new ITextInputListener() { @Override public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) { fInputDocumentAboutToBeChanged= true; } @Override public void inputDocumentChanged(IDocument oldInput, IDocument newInput) { fInputDocumentAboutToBeChanged= false; } }; fSourceViewer.addTextInputListener(fTextInputListener); } }
/** * Install this reconciler on the given editor, presenter and highlightings. * @param editor the editor * @param sourceViewer the source viewer * @param presenter the semantic highlighting presenter * @param semanticHighlightings the semantic highlightings * @param highlightings the highlightings */ public void install(JavaEditor editor, ISourceViewer sourceViewer, SemanticHighlightingPresenter presenter, SemanticHighlighting[] semanticHighlightings, Highlighting[] highlightings) { fPresenter= presenter; fSemanticHighlightings= semanticHighlightings; fHighlightings= highlightings; fEditor= editor; fSourceViewer= sourceViewer; if (fEditor instanceof CompilationUnitEditor) { ((CompilationUnitEditor)fEditor).addReconcileListener(this); } else if (fEditor == null) { fSourceViewer.addTextInputListener(this); scheduleJob(); } }
/** * Install this reconciler on the given editor, presenter and highlightings. * @param editor the editor * @param sourceViewer the source viewer * @param presenter the semantic highlighting presenter * @param semanticHighlightings the semantic highlightings * @param highlightings the highlightings */ public void install(JavaEditor editor, ISourceViewer sourceViewer, SemanticHighlightingPresenter presenter, SemanticHighlighting[] semanticHighlightings, Highlighting[] highlightings) { fPresenter= presenter; fSemanticHighlightings= semanticHighlightings; fHighlightings= highlightings; fEditor= editor; fSourceViewer= sourceViewer; if (fEditor instanceof CompilationUnitEditor) { ((CompilationUnitEditor)fEditor).addReconcileListener(this); } else if (fEditor == null) { fSourceViewer.addTextInputListener(this); scheduleJob(); } }
/** * Install this reconciler on the given editor, presenter and highlightings. * @param editor the editor * @param sourceViewer the source viewer * @param presenter the semantic highlighting presenter * @param semanticHighlightings the semantic highlightings * @param highlightings the highlightings */ public void install(JavaEditor editor, ISourceViewer sourceViewer, SemanticHighlightingPresenter presenter, SemanticHighlighting[] semanticHighlightings, Highlighting[] highlightings) { fPresenter= presenter; fSemanticHighlightings= semanticHighlightings; fHighlightings= highlightings; fEditor= editor; fSourceViewer= sourceViewer; if (fEditor instanceof CompilationUnitEditor) { ((CompilationUnitEditor)fEditor).addReconcileListener(this); } else if (fEditor == null) { fSourceViewer.addTextInputListener(this); scheduleJob(); } }
public void install() { ISourceViewer sourceViewer= getSourceViewer(); if (sourceViewer == null) return; StyledText text= sourceViewer.getTextWidget(); if (text == null || text.isDisposed()) return; sourceViewer.addTextInputListener(this); IDocument document= sourceViewer.getDocument(); if (document != null) document.addDocumentListener(this); }
public void install() { ISourceViewer sourceViewer= getSourceViewer(); if (sourceViewer == null) return; StyledText text= sourceViewer.getTextWidget(); if (text == null || text.isDisposed()) return; sourceViewer.addTextInputListener(this); IDocument document= sourceViewer.getDocument(); if (document != null) document.addDocumentListener(this); }
public void install() { ISourceViewer sourceViewer = getSourceViewer(); if (sourceViewer == null) return; StyledText text = sourceViewer.getTextWidget(); if (text == null || text.isDisposed()) return; sourceViewer.addTextInputListener(this); IDocument document = sourceViewer.getDocument(); if (document != null) document.addDocumentListener(this); }
public void install() { ISourceViewer sourceViewer= getSourceViewer(); if (sourceViewer == null) return; StyledText text= sourceViewer.getTextWidget(); if (text == null || text.isDisposed()) return; sourceViewer.addTextInputListener(this); IDocument document= sourceViewer.getDocument(); if (document != null) document.addDocumentListener(this); }
@Override public boolean validateEditorInputState() { boolean enabled= false; synchronized (this) { enabled= fIsStateValidationEnabled; } if (enabled) { ISourceViewer viewer= fSourceViewer; if (viewer == null) return false; fTextInputListener.inputChanged= false; viewer.addTextInputListener(fTextInputListener); try { final IEditorInput input= getEditorInput(); BusyIndicator.showWhile(getSite().getShell().getDisplay(), new Runnable() { @Override public void run() { validateState(input); } }); sanityCheckState(input); return !isEditorInputReadOnly() && !fTextInputListener.inputChanged; } finally { viewer.removeTextInputListener(fTextInputListener); } } return !isEditorInputReadOnly(); }
public boolean validateEditorInputState() { boolean enabled= false; synchronized (this) { enabled= fIsStateValidationEnabled; } if (enabled) { ISourceViewer viewer= fSourceViewer; if (viewer == null) return false; fTextInputListener.inputChanged= false; viewer.addTextInputListener(fTextInputListener); try { final IEditorInput input= getEditorInput(); BusyIndicator.showWhile(getSite().getShell().getDisplay(), new Runnable() { /* * @see java.lang.Runnable#run() */ public void run() { validateState(input); } }); sanityCheckState(input); return !isEditorInputReadOnly() && !fTextInputListener.inputChanged; } finally { viewer.removeTextInputListener(fTextInputListener); } } return !isEditorInputReadOnly(); }
@Override public boolean validateEditorInputState() { boolean enabled= false; synchronized (this) { enabled= fIsStateValidationEnabled; } if (enabled) { ISourceViewer viewer= fSourceViewer; if (viewer == null) return false; fTextInputListener.inputChanged= false; viewer.addTextInputListener(fTextInputListener); try { final IEditorInput input= getEditorInput(); BusyIndicator.showWhile(getSite().getShell().getDisplay(), () -> validateState(input)); sanityCheckState(input); return !isEditorInputReadOnly() && !fTextInputListener.inputChanged; } finally { viewer.removeTextInputListener(fTextInputListener); } } return !isEditorInputReadOnly(); }
fSourceViewer.addTextInputListener(fTextListener); getSelectionProvider().addSelectionChangedListener(getSelectionChangedListener());
fSourceViewer.addTextInputListener(fTextListener); getSelectionProvider().addSelectionChangedListener(getSelectionChangedListener());
fSourceViewer.addTextInputListener(fTextListener); getSelectionProvider().addSelectionChangedListener(getSelectionChangedListener());