示例#1
0
 private void mouseExitedFoldingArea(MouseEvent e) {
   if (myMouseIsInFoldingArea) {
     for (AbstractFoldingAreaPainter painter : myFoldingAreaPainters) {
       painter.mouseExited(e);
     }
   }
 }
示例#2
0
 @Override
 public int compare(AbstractFoldingAreaPainter afap1, AbstractFoldingAreaPainter afap2) {
   if (afap1.getWeight() == afap2.getWeight() && !afap1.equals(afap2)) {
     return System.identityHashCode(afap1) - System.identityHashCode(afap2);
   }
   return afap1.getWeight() - afap2.getWeight();
 }
示例#3
0
 public void relayout(boolean updateFolding) {
   assert SwingUtilities.isEventDispatchThread()
       : "LeftEditorHighlighter.relayout() should be executed in eventDispatchThread";
   SNode editedNode = myEditorComponent.getEditedNode();
   // additional check - during editor dispose process some Folding area painters can be removed
   // calling relayout()..
   if (myEditorComponent.isDisposed()
       || (editedNode != null && jetbrains.mps.util.SNodeOperations.isDisposed(editedNode))) {
     return;
   }
   if (myRightToLeft) {
     recalculateFoldingAreaWidth();
     updateSeparatorLinePosition();
     if (updateFolding) {
       for (AbstractFoldingAreaPainter painter : myFoldingAreaPainters) {
         painter.relayout();
       }
       // wee need to recalculateIconRenderersWidth only if one of collections was folded/unfolded
       recalculateIconRenderersWidth();
     }
     recalculateTextColumnWidth();
   } else {
     recalculateTextColumnWidth();
     if (updateFolding) {
       for (AbstractFoldingAreaPainter painter : myFoldingAreaPainters) {
         painter.relayout();
       }
       // wee need to recalculateIconRenderersWidth only if one of collections was folded/unfolded
       recalculateIconRenderersWidth();
     }
     recalculateFoldingAreaWidth();
     updateSeparatorLinePosition();
   }
   updatePreferredSize();
 }
示例#4
0
 private void paintFoldingArea(Graphics g, Rectangle clipBounds) {
   if (!hasIntersection(getFoldingAreaOffset(), getFoldingAreaWidth(), clipBounds)) {
     return;
   }
   for (AbstractFoldingAreaPainter painter : myFoldingAreaPainters) {
     painter.paint(g);
   }
 }
示例#5
0
 private void mousePressedInFoldingArea(MouseEvent e) {
   for (Iterator<AbstractFoldingAreaPainter> it = myFoldingAreaPainters.descendingIterator();
       it.hasNext(); ) {
     AbstractFoldingAreaPainter painter = it.next();
     painter.mousePressed(e);
     if (e.isConsumed()) {
       break;
     }
   }
 }
示例#6
0
 private void recalculateFoldingAreaWidth() {
   myLeftFoldingAreaWidth =
       myRightToLeft ? MIN_RIGHT_FOLDING_AREA_WIDTH : MIN_LEFT_FOLDING_AREA_WIDTH;
   myRightFoldingAreaWidth =
       myRightToLeft ? MIN_LEFT_FOLDING_AREA_WIDTH : MIN_RIGHT_FOLDING_AREA_WIDTH;
   // Layouting painters
   for (AbstractFoldingAreaPainter painter : myFoldingAreaPainters) {
     myLeftFoldingAreaWidth = Math.max(myLeftFoldingAreaWidth, painter.getLeftAreaWidth());
     myRightFoldingAreaWidth = Math.max(myRightFoldingAreaWidth, painter.getRightAreaWidth());
   }
 }
示例#7
0
 public void dispose() {
   for (AbstractFoldingAreaPainter painter : myFoldingAreaPainters) {
     painter.dispose();
   }
   for (AbstractLeftColumn column : myLeftColumns) {
     column.dispose();
   }
   if (MPSToolTipManager.getInstance() != null) {
     MPSToolTipManager.getInstance().unregisterComponent(this);
   }
 }
示例#8
0
 @Override
 public String getMPSTooltipText(MouseEvent e) {
   if (isInFoldingArea(e)) {
     for (AbstractFoldingAreaPainter painter : myFoldingAreaPainters) {
       if (painter.getToolTipText() != null) {
         return painter.getToolTipText();
       }
     }
   } else if (isInTextArea(e)) {
     AbstractLeftColumn column = getTextColumnByX(e.getX());
     if (column != null) {
       return column.getTooltipText(e);
     }
   } else {
     EditorMessageIconRenderer iconRenderer = getIconRendererUnderMouse(e);
     if (iconRenderer != null) {
       return iconRenderer.getTooltipText();
     }
   }
   return null;
 }