Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MPS-15167 Can't copy-paste in merge dialog to add both sides

  • Loading branch information...
commit 35cf56b4ce3c154a2f7c1b7a5542d5a68602d8d8 1 parent 1e98443
mvlassiev mvlassiev authored
12 core/editor-runtime/source/jetbrains/mps/nodeEditor/cellActions/CellAction_PasteNode.java
@@ -68,11 +68,13 @@ public void execute(final EditorContext context) {
68 68 final EditorComponent editorComponent = context.getNodeEditorComponent();
69 69 EditorCell pasteTargetCell = getCellToPasteTo(editorComponent.getSelectedCell());
70 70 final CellInfo pasteTargetCellInfo = pasteTargetCell.getCellInfo();
71   - SNode selectedNode = pasteTargetCell.getSNode();
72   - final SNodePointer selectedNodePointer = new SNodePointer(selectedNode);
73   - final SModel model = selectedNode.getModel();
  71 + final SNode nodeSelected = pasteTargetCell.getSNode();
  72 + final SNodePointer selectedNodePointer = new SNodePointer(nodeSelected);
  73 + final SModel model = nodeSelected.getModel();
  74 + // sometimes model is not in repository (paste in merge dialog)
  75 + final boolean inRepository = model.getModelDescriptor() == selectedNodePointer.getModel();
74 76
75   - PasteNodeData data = CopyPasteUtil.getPasteNodeDataFromClipboard(model);
  77 + PasteNodeData data = CopyPasteUtil.getPasteNodeDataFromClipboard(model);
76 78 if (data == null || data.getNodes().isEmpty()) {
77 79 data = CopyPasteUtil.getConvertedFromClipboard(model);
78 80 if (data == null) return;
@@ -89,7 +91,7 @@ public void run() {
89 91
90 92 ModelAccess.instance().runWriteActionInCommand(new Runnable() {
91 93 public void run() {
92   - SNode selectedNode = selectedNodePointer.getNode();
  94 + SNode selectedNode = inRepository ? selectedNodePointer.getNode() : nodeSelected;
93 95 assert !selectedNode.isDisposed();
94 96 EditorCell selectedCell = pasteTargetCellInfo.findCell(editorComponent);
95 97 assert selectedCell != null;

0 comments on commit 35cf56b

Please sign in to comment.
Something went wrong with that request. Please try again.