Esempio n. 1
0
  public LeftEditorHighlighter(@NotNull EditorComponent editorComponent, boolean rightToLeft) {
    setBackground(EditorSettings.getInstance().getLeftHighlighterBackgroundColor());
    myEditorComponent = editorComponent;
    myRightToLeft = rightToLeft;
    addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseExited(MouseEvent e) {
            mouseExitedFoldingArea(e);
            mouseExitedIconsArea(e);
          }

          @Override
          public void mouseEntered(MouseEvent e) {
            if (isInFoldingArea(e)) {
              mouseMovedInFoldingArea(e);
            } else if (isInTextArea(e)) {
              mouseMovedInTextArea(e);
            } else {
              mouseMovedInIconsArea(e);
            }
          }
        });
    addMouseMotionListener(
        new MouseMotionAdapter() {
          @Override
          public void mouseMoved(MouseEvent e) {
            if (isInFoldingArea(e)) {
              mouseExitedIconsArea(e);
              mouseMovedInFoldingArea(e);
            } else if (isInTextArea(e)) {
              mouseExitedFoldingArea(e);
              mouseExitedIconsArea(e);
              mouseMovedInTextArea(e);
            } else {
              mouseExitedFoldingArea(e);
              mouseMovedInIconsArea(e);
            }
          }
        });
    if (MPSToolTipManager.getInstance() != null) {
      MPSToolTipManager.getInstance().registerComponent(this);
    }
    editorComponent.addRebuildListener(
        new RebuildListener() {
          @Override
          public void editorRebuilt(EditorComponent editor) {
            assert SwingUtilities.isEventDispatchThread()
                : "LeftEditorHighlighter$RebuildListener should be called in eventDispatchThread";
            for (AbstractFoldingAreaPainter painter : myFoldingAreaPainters) {
              painter.editorRebuilt();
            }
          }
        });
    myBracketsPainter = new BracketsPainter(this, myRightToLeft);
    myFoldingButtonsPainter = new FoldingButtonsPainter(this);

    myFoldingAreaPainters.add(myBracketsPainter);
    myFoldingAreaPainters.add(myFoldingButtonsPainter);
  }
Esempio n. 2
0
 public void dispose() {
   for (AbstractFoldingAreaPainter painter : myFoldingAreaPainters) {
     painter.dispose();
   }
   for (AbstractLeftColumn column : myLeftColumns) {
     column.dispose();
   }
   if (MPSToolTipManager.getInstance() != null) {
     MPSToolTipManager.getInstance().unregisterComponent(this);
   }
 }