/** * The <code>TextOperationAction</code> implementation of this * <code>IUpdate</code> method discovers the operation through the current * editor's <code>ITextOperationTarget</code> adapter, and sets the * enabled state accordingly. */ @Override public void update() { if (!fAllowUpdate) return; super.update(); if (!fRunsOnReadOnly && !canModifyEditor()) { setEnabled(false); return; } ITextEditor editor= getTextEditor(); if (fOperationTarget == null && editor!= null && fOperationCode != -1) fOperationTarget= editor.getAdapter(ITextOperationTarget.class); boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode)); setEnabled(isEnabled); }
/** * The <code>TextOperationAction</code> implementation of this * <code>IUpdate</code> method discovers the operation through the current * editor's <code>ITextOperationTarget</code> adapter, and sets the * enabled state accordingly. */ public void update() { if (!fAllowUpdate) return; super.update(); if (!fRunsOnReadOnly && !canModifyEditor()) { setEnabled(false); return; } ITextEditor editor= getTextEditor(); if (fOperationTarget == null && editor!= null && fOperationCode != -1) fOperationTarget= (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class); boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode)); setEnabled(isEnabled); }
/** * The <code>TextOperationAction</code> implementation of this * <code>IUpdate</code> method discovers the operation through the current * editor's <code>ITextOperationTarget</code> adapter, and sets the * enabled state accordingly. */ @Override public void update() { if (!fAllowUpdate) return; super.update(); if (!fRunsOnReadOnly && !canModifyEditor()) { setEnabled(false); return; } ITextEditor editor= getTextEditor(); if (fOperationTarget == null && editor!= null && fOperationCode != -1) fOperationTarget= editor.getAdapter(ITextOperationTarget.class); boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode)); setEnabled(isEnabled); }