Commit c4f501d1 authored by Simon Barner's avatar Simon Barner
Browse files

Avoid broken model resources during cross-project copy-and-paste



- Use original (non-copied) references only when copying within 
  the same model resource.
- Otherwise, the copy in the destination resource will have 
  a reference to the original resource.
- NOTE
  - The resulting copy can have null-references which might
    not be handled correctly.
  - Hence, this is only an initial workaround, and a proper
    handling of copying references is needed.

Issue-Ref: 2845
Signed-off-by: Simon Barner's avatarSimon Barner <barner@fortiss.org>
parent bd502046
ActionUtils.java 4553e487264e3d1f86f4767da4a7400cce4b9a5d GREEN
ConstraintsUIUtils.java 69d5e08bbf768baf2790380e36f1020ef826a33e GREEN
CopyPasteUtils.java 7da2d871bebecc7010e699b4625e1614bf2392ab GREEN
CopyPasteUtils.java 445f585fe70e79f63c47f278d27cac48253571a8 YELLOW
DataBindingUtils.java 0818014c193a22d5968435e78590368b95138d5e GREEN
DragAndDropUtils.java 7aab91518aa12d76533a345bf6ed0be9ac7ff0e5 GREEN
EObjectSelectionUtils.java 928280b5dd3bb634debc1ac3be9f15b4e45f2683 GREEN
......
......@@ -121,7 +121,13 @@ public class CopyPasteUtils {
return;
}
EcoreUtil.Copier copier = new EcoreUtil.Copier();
// canPasteInto() ensures that clip-board is non-empty
boolean sameResource = getClipBoardContent()[0].eResource() == target.eResource();
// Use original (non-copied) references only when copying within the same model resource.
// Otherwise, the copy in the destination resource will have a reference to the original
// resource.
EcoreUtil.Copier copier = new EcoreUtil.Copier(true, sameResource);
BasicEList<EObject> copiedObjects = new BasicEList<EObject>();
for(EObject obj : getClipBoardContent()) {
EObject copy = copier.copy(obj);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment