X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=org.simantics.interop.update%2Fsrc%2Forg%2Fsimantics%2Finterop%2Fupdate%2Fmodel%2FModelUpdate.java;fp=org.simantics.interop.update%2Fsrc%2Forg%2Fsimantics%2Finterop%2Fupdate%2Fmodel%2FModelUpdate.java;h=bf391d49e52e8a1fd367f1fbbfac29758b696314;hb=6fd88055dcf1a4982cc607222e77907a786173a8;hp=553396b48750f5d72f26e077c1dfc5d87779b827;hpb=51ca3975e1d4137e189e5e0beedc4efd137af142;p=simantics%2Finterop.git diff --git a/org.simantics.interop.update/src/org/simantics/interop/update/model/ModelUpdate.java b/org.simantics.interop.update/src/org/simantics/interop/update/model/ModelUpdate.java index 553396b..bf391d4 100644 --- a/org.simantics.interop.update/src/org/simantics/interop/update/model/ModelUpdate.java +++ b/org.simantics.interop.update/src/org/simantics/interop/update/model/ModelUpdate.java @@ -20,15 +20,19 @@ import org.simantics.utils.datastructures.Pair; public abstract class ModelUpdate { - private GraphChanges changes; + private Resource oldModel; // old model that is going to be updated (User modified model) + private Resource newModel; // new model that contains the updates (New design model) + private Resource originalModel; // original model (optional) that is used for detecting and retaining user made changes (Old design model) + + private GraphChanges changes; // changes between old /new private UpdateTree updateTree; private UpdateList updateList; - private GraphChanges changes2; + private GraphChanges changes2; // changes between original / old private UpdateTree updateTree2; private UpdateList updateList2; - private GraphChanges changes3; + private GraphChanges changes3; // changes between original / new private UpdateTree updateTree3; private UpdateList updateList3; @@ -40,7 +44,18 @@ public abstract class ModelUpdate { setInput(oldModel, newModel, null, false); } + /** + * Initialises the ModelUpdate with given input + * @param oldModel the model that is going to be updated (User modified model) + * @param newModel the model containing updates (New design model) + * @param originalModel the model that is used for detecting and retaining user made changes (Old design model). Parameter can be null. + * @param newDistinct when originalModel is given, additions to the old and the new model (when compared to the original model) are forced to be distinct. + * @throws DatabaseException + */ public void setInput(Resource oldModel, Resource newModel, Resource originalModel, boolean newDistinct) throws DatabaseException{ + this.oldModel = oldModel; + this.newModel = newModel; + this.originalModel = originalModel; addFilters(filters); if (originalModel != null) { // tree way comparison @@ -110,7 +125,7 @@ public abstract class ModelUpdate { if (originalModel != null) { - createDefaultSelections(); + defaultSelections(); } init = true; @@ -128,6 +143,18 @@ public abstract class ModelUpdate { } + public Resource getOldModel() { + return oldModel; + } + + public Resource getNewModel() { + return newModel; + } + + public Resource getOriginalModel() { + return originalModel; + } + public boolean isInit() { return init; } @@ -304,7 +331,10 @@ public abstract class ModelUpdate { } } - protected void createDefaultSelections() { + public void defaultSelections() { + if (changes3 == null) { + return; + } // select all changes for (Entry op : updateTree.getUpdateOps().getResourceMap().entrySet()) { op.getValue().select(true);