Exemplo n.º 1
0
  private boolean canPasteBefore(EditorCell selectedCell, List<SNode> pasteNodes) {
    if (!selectedCell.isFirstPositionInBigCell()) return false;
    SNode anchor = selectedCell.getSNode();
    if (anchor.getParent() == null) return false;

    NodeAndRole nodeAndRole =
        new NodePaster(pasteNodes).getActualAnchorNode(anchor, anchor.getRoleInParent());
    if (nodeAndRole == null) return false;

    EditorCell targetCell = selectedCell.getEditor().findNodeCell(nodeAndRole.myNode);
    return targetCell != null
        && targetCell.getFirstLeaf(CellConditions.SELECTABLE) == selectedCell
        && new NodePaster(pasteNodes).canPasteRelative(nodeAndRole.myNode);
  }
Exemplo n.º 2
0
 public void highlight(EditorCell cell, EditorCell cell2, Color c) {
   assert SwingUtilities.isEventDispatchThread()
       : "LeftEditorHighlighter.unHighlight() should be called in eventDispatchThread";
   assert cell.getEditor() == myEditorComponent : "cell must be from my editor";
   myBracketsPainter.addBracket(cell, cell2, c);
 }