/**
  * Implementation of the <code>IUpdate</code> prototype method discovers the operation through the
  * current editor's <code>ITextOperationTarget</code> adapter, and sets the enabled state
  * accordingly.
  */
 public void update() {
   super.update();
   if (!canModifyEditor()) {
     setEnabled(false);
     return;
   }
   ITextEditor editor = getTextEditor();
   if (fOperationTarget == null && editor != null)
     fOperationTarget = (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class);
   boolean isEnabled =
       (fOperationTarget != null
           && fOperationTarget.canDoOperation(ITextOperationTarget.PREFIX)
           && fOperationTarget.canDoOperation(ITextOperationTarget.STRIP_PREFIX));
   setEnabled(isEnabled);
 }
  /* (non-Javadoc)
   * @see org.eclipse.ui.texteditor.IUpdate#update()
   */
  @Override
  public void update() {
    super.update();

    if (!isReadOnlyOperation() && !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);
  }