/** @see IPainter#deactivate */
 public final void deactivate(final boolean redraw) {
   if (mIsActive) {
     mIsActive = false;
     mTextWidget.removePaintListener(this);
     if (mPositionManager != null) {
       mPositionManager.unmanagePosition(mBracketPosition);
     }
     if (redraw) {
       handleDrawRequest(null);
     }
   }
 }
  public void deactivate(boolean redraw) {
    if (fIsActive) {
      fIsActive = false;

      /*
       * on turning off the feature one has to paint the currently highlighted line with the standard background
       * color
       */
      if (redraw) drawHighlightLine(fCurrentLine);

      fViewer.getTextWidget().removeLineBackgroundListener(this);
      fViewer.getTextWidget().removePaintListener(this);

      if (fPositionManager != null) fPositionManager.unmanagePosition(fCurrentLine);

      fLastLineNumber = -1;
      fCurrentLine.offset = 0;
      fCurrentLine.length = 0;
    }
  }
Example #3
0
  /**
   * Removes the control from this manager. Unmanages this position,
   *
   * @param c the control to remove
   * @param doRemove whether or not this control should be completely removed, or just temporarily
   *     (eg- during a save)
   * @return the position of the removed control
   */
  private Position removeControl(ContainedEditorManager c, boolean doRemove) {
    Position p;
    if (doRemove) {
      p = editorPositionMap.remove(c);
    } else {
      p = editorPositionMap.get(c);
    }
    try {
      ppManager.unmanagePosition(p);

      if (doRemove && !p.isDeleted()) {
        //                Position projected = modelToProjected(p);
        //                styledText.replaceStyleRanges(projected.offset, projected.length, new
        // StyleRange[0]);
        styledText.replaceStyleRanges(p.offset, p.length, new StyleRange[0]);
      }
    } catch (NullPointerException e) {
      // do nothing...trying to unmanage posn after
      // document has already been uninstalled.
    }
    c.removeListener(this);
    c.dispose();
    return p;
  }