Пример #1
0
  public void removeCell(jetbrains.mps.nodeEditor.cells.EditorCell cellToRemove) {
    ((EditorCell_Basic) cellToRemove).setParent(null);
    getEditorCells().remove(cellToRemove);
    getStyle().remove(cellToRemove.getStyle());

    if (isInTree()) {
      ((EditorCell_Basic) cellToRemove).onRemove();
    }
  }
Пример #2
0
 public void setFoldedCell(EditorCell foldedCell) {
   if (myFoldedCell != null) {
     ((EditorCell_Basic) myFoldedCell).setParent(null);
     getStyle().remove(myFoldedCell.getStyle());
   }
   myFoldedCell = foldedCell;
   ((EditorCell_Basic) myFoldedCell).setParent(this);
   getStyle().add(myFoldedCell.getStyle());
 }
Пример #3
0
  @Override
  public void addEditorCellAt(int i, EditorCell cellToAdd, boolean ignoreBraces) {
    int j = i;
    if (usesBraces() && !ignoreBraces) {
      j = i - 1;
    }
    ((EditorCell_Basic) cellToAdd).setParent(this);
    getEditorCells().add(j, cellToAdd);
    getStyle().add(cellToAdd.getStyle());

    if (isInTree()) {
      ((EditorCell_Basic) cellToAdd).onAdd();
    }
  }
Пример #4
0
  @Override
  public void onAdd() {
    super.onAdd();
    for (EditorCell child : getEditorCells()) {
      ((EditorCell_Basic) child).onAdd();
    }
    if (hasFoldedCell()) {
      ((EditorCell_Basic) getFoldedCell()).onAdd();
    }
    if (myLastCellSelectionListener != null) {
      getEditor().getSelectionManager().addSelectionListener(myLastCellSelectionListener);
    }

    if (canBePossiblyFolded()) {
      getEditor().getCellTracker().addFoldableCell(this);
    }
  }
Пример #5
0
 @Override
 public void setAction(CellActionType type, CellAction action) {
   super.setAction(type, action);
   if (isTransparentCollection()) {
     for (EditorCell child : getEditorCells()) {
       if (child.getSNode() == getSNode()) {
         child.setAction(type, action);
       }
     }
   }
 }
Пример #6
0
 @Override
 public void setSubstituteInfo(SubstituteInfo substitueInfo) {
   super.setSubstituteInfo(substitueInfo);
   if (isTransparentCollection()) {
     for (EditorCell child : getEditorCells()) {
       if (child.getSNode() == getSNode()) {
         child.setSubstituteInfo(substitueInfo);
       }
     }
   }
 }
Пример #7
0
  @Override
  public void onRemove() {
    if (canBePossiblyFolded()) {
      getEditor().getCellTracker().removeFoldableCell(this);
    }
    removeUnfoldingListener();
    if (isFolded()) {
      getEditor().setFolded(this, false);
    }

    if (myLastCellSelectionListener != null) {
      setBracesEnabled(false);
      getEditor().getSelectionManager().removeSelectionListener(myLastCellSelectionListener);
    }
    for (EditorCell child : getEditorCells()) {
      ((EditorCell_Basic) child).onRemove();
    }
    if (hasFoldedCell()) {
      ((EditorCell_Basic) getFoldedCell()).onRemove();
    }
    super.onRemove();
  }
Пример #8
0
  @Override
  public void moveTo(int x, int y) {
    if (x == myX && y == myY) {
      return;
    }

    int xOld = myX;
    int yOld = myY;
    super.moveTo(x, y);
    for (jetbrains.mps.nodeEditor.cells.EditorCell myEditorCell : getCells()) {
      myEditorCell.moveTo(myEditorCell.getX() + x - xOld, myEditorCell.getY() + y - yOld);
      if (((EditorCell_Basic) myEditorCell).isNeedsRelayout()) {
        markNeedsRelayout();
      }
    }
    adjustNeedsRelayout(xOld, yOld, x, y);
  }
Пример #9
0
 @Override
 public void addEditorCell(EditorCell editorCell) {
   if (editorCell == null) return;
   addCell(editorCell);
   ((EditorCell_Basic) editorCell).setParent(this);
 }