@Override public void update() { super.update(); if (isEnabled()) { if (!canModifyEditor() || !isValidSelection(getCurrentSelection())) setEnabled(false); } }
public void run() { if (!isEnabled()) return; ITextEditor editor= getTextEditor(); if (editor == null || !ensureEditable(editor)) return; ITextSelection selection= getCurrentSelection(); if (!isValidSelection(selection)) return; if (!validateEditorInputState()) return; runInternal(selection, docExtension, factory);
/** * Returns the editor's selection, or <code>null</code> if no selection can be obtained or the * editor is <code>null</code>. * * @return the selection of the action's editor, or <code>null</code> */ protected ITextSelection getCurrentSelection() { ITextEditor editor= getTextEditor(); if (editor != null) { ISelectionProvider provider= editor.getSelectionProvider(); if (provider != null) { ISelection selection= provider.getSelection(); if (selection instanceof ITextSelection) return (ITextSelection) selection; } } return null; }
@Override public void run() { if (!isEnabled()) return; ITextEditor editor= getTextEditor(); if (editor == null || !ensureEditable(editor)) return; ITextSelection selection= getCurrentSelection(); if (!isValidSelection(selection)) return; if (!validateEditorInputState()) return; runInternal(selection, docExtension, factory);
/** * Returns the editor's selection, or <code>null</code> if no selection can be obtained or the * editor is <code>null</code>. * * @return the selection of the action's editor, or <code>null</code> */ protected ITextSelection getCurrentSelection() { ITextEditor editor= getTextEditor(); if (editor != null) { ISelectionProvider provider= editor.getSelectionProvider(); if (provider != null) { ISelection selection= provider.getSelection(); if (selection instanceof ITextSelection) return (ITextSelection) selection; } } return null; }
@Override public void run() { if (!isEnabled()) return; ITextEditor editor= getTextEditor(); if (editor == null || !ensureEditable(editor)) return; ITextSelection selection= getCurrentSelection(); if (!isValidSelection(selection)) return; if (!validateEditorInputState()) return; runInternal(selection, docExtension, factory);
@Override public void update() { super.update(); if (isEnabled()) { if (!canModifyEditor() || !isValidSelection(getCurrentSelection())) setEnabled(false); } }
/** * Returns the editor's selection, or <code>null</code> if no selection can be obtained or the * editor is <code>null</code>. * * @return the selection of the action's editor, or <code>null</code> */ protected ITextSelection getCurrentSelection() { ITextEditor editor= getTextEditor(); if (editor != null) { ISelectionProvider provider= editor.getSelectionProvider(); if (provider != null) { ISelection selection= provider.getSelection(); if (selection instanceof ITextSelection) return (ITextSelection) selection; } } return null; }
public void update() { super.update(); if (isEnabled()) { if (!canModifyEditor() || !isValidSelection(getCurrentSelection())) setEnabled(false); } }