private void mouseExitedFoldingArea(MouseEvent e) { if (myMouseIsInFoldingArea) { for (AbstractFoldingAreaPainter painter : myFoldingAreaPainters) { painter.mouseExited(e); } } }
@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(); }
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(); }
private void paintFoldingArea(Graphics g, Rectangle clipBounds) { if (!hasIntersection(getFoldingAreaOffset(), getFoldingAreaWidth(), clipBounds)) { return; } for (AbstractFoldingAreaPainter painter : myFoldingAreaPainters) { painter.paint(g); } }
private void mousePressedInFoldingArea(MouseEvent e) { for (Iterator<AbstractFoldingAreaPainter> it = myFoldingAreaPainters.descendingIterator(); it.hasNext(); ) { AbstractFoldingAreaPainter painter = it.next(); painter.mousePressed(e); if (e.isConsumed()) { break; } } }
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()); } }
public void dispose() { for (AbstractFoldingAreaPainter painter : myFoldingAreaPainters) { painter.dispose(); } for (AbstractLeftColumn column : myLeftColumns) { column.dispose(); } if (MPSToolTipManager.getInstance() != null) { MPSToolTipManager.getInstance().unregisterComponent(this); } }
@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; }