@Override public void update() { ITextEditor editor= getTextEditor(); if (!(editor instanceof AbstractTextEditor)) { setEnabled(false); return; } IAnnotationModel model= editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput()); setEnabled(model != null); } }
/** * Creates a new action for the given text editor. The action configures its * visual representation from the given resource bundle. * * @param bundle the resource bundle * @param prefix a prefix to be prepended to the various resource keys * (described in <code>ResourceAction</code> constructor), or * <code>null</code> if none * @param editor the text editor * @param forward <code>true</code> to go to next and <code>false</code> to go to previous annotation * @see TextEditorAction#TextEditorAction(ResourceBundle, String, ITextEditor) */ public GotoAnnotationAction(ResourceBundle bundle, String prefix, ITextEditor editor, boolean forward) { super(bundle, prefix, editor); fForward= forward; setHelpContextId(fForward ? IAbstractTextEditorHelpContextIds.GOTO_NEXT_ANNOTATION_ACTION : IAbstractTextEditorHelpContextIds.GOTO_PREVIOUS_ANNOTATION_ACTION); }
@Override public void setEditor(ITextEditor editor) { super.setEditor(editor); update(); }
@Override public void run() { ITextEditor editor= getTextEditor(); if (editor instanceof ITextEditorExtension4) ((ITextEditorExtension4)editor).gotoAnnotation(fForward); }
markAsStateDependentAction(ITextEditorActionConstants.QUICK_ASSIST, true); action= new GotoAnnotationAction(this, true); setAction(ITextEditorActionConstants.NEXT, action); action= new GotoAnnotationAction(this, false); setAction(ITextEditorActionConstants.PREVIOUS, action);
@Override public void run() { ITextEditor editor= getTextEditor(); if (editor instanceof ITextEditorExtension4) ((ITextEditorExtension4)editor).gotoAnnotation(fForward); }
markAsStateDependentAction(ITextEditorActionConstants.QUICK_ASSIST, true); action= new GotoAnnotationAction(this, true); setAction(ITextEditorActionConstants.NEXT, action); action= new GotoAnnotationAction(this, false); setAction(ITextEditorActionConstants.PREVIOUS, action);
public void update() { ITextEditor editor= getTextEditor(); if (!(editor instanceof AbstractTextEditor)) { setEnabled(false); return; } IAnnotationModel model= editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput()); setEnabled(model != null); } }
@Override public void setEditor(ITextEditor editor) { super.setEditor(editor); update(); }
public void run() { ITextEditor editor= getTextEditor(); if (editor instanceof ITextEditorExtension4) ((ITextEditorExtension4)editor).gotoAnnotation(fForward); }
/** * Creates a new action for the given text editor. The action configures its * visual representation from the given resource bundle. * * @param bundle the resource bundle * @param prefix a prefix to be prepended to the various resource keys * (described in <code>ResourceAction</code> constructor), or * <code>null</code> if none * @param editor the text editor * @param forward <code>true</code> to go to next and <code>false</code> to go to previous annotation * @see TextEditorAction#TextEditorAction(ResourceBundle, String, ITextEditor) */ public GotoAnnotationAction(ResourceBundle bundle, String prefix, ITextEditor editor, boolean forward) { super(bundle, prefix, editor); fForward= forward; setHelpContextId(fForward ? IAbstractTextEditorHelpContextIds.GOTO_NEXT_ANNOTATION_ACTION : IAbstractTextEditorHelpContextIds.GOTO_PREVIOUS_ANNOTATION_ACTION); }
markAsStateDependentAction(ITextEditorActionConstants.QUICK_ASSIST, true); action= new GotoAnnotationAction(this, true); setAction(ITextEditorActionConstants.NEXT, action); action= new GotoAnnotationAction(this, false); setAction(ITextEditorActionConstants.PREVIOUS, action);
@Override public void update() { ITextEditor editor= getTextEditor(); if (!(editor instanceof AbstractTextEditor)) { setEnabled(false); return; } IAnnotationModel model= editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput()); setEnabled(model != null); } }
public void setEditor(ITextEditor editor) { super.setEditor(editor); update(); }
/** * Creates a new action for the given text editor. The action configures its * visual representation from the given resource bundle. * * @param bundle the resource bundle * @param prefix a prefix to be prepended to the various resource keys * (described in <code>ResourceAction</code> constructor), or * <code>null</code> if none * @param editor the text editor * @param forward <code>true</code> to go to next and <code>false</code> to go to previous annotation * @see TextEditorAction#TextEditorAction(ResourceBundle, String, ITextEditor) */ public GotoAnnotationAction(ResourceBundle bundle, String prefix, ITextEditor editor, boolean forward) { super(bundle, prefix, editor); fForward= forward; setHelpContextId(fForward ? IAbstractTextEditorHelpContextIds.GOTO_NEXT_ANNOTATION_ACTION : IAbstractTextEditorHelpContextIds.GOTO_PREVIOUS_ANNOTATION_ACTION); }