]> gerrit.simantics Code Review - simantics/interop.git/blobdiff - org.simantics.interop.update/src/org/simantics/interop/update/model/ModelUpdate.java
Adapt GraphChanges to copied model.
[simantics/interop.git] / org.simantics.interop.update / src / org / simantics / interop / update / model / ModelUpdate.java
index 51cd1eb4c0c338655e0f8dbc4777e58786dedd43..6e5175707080e7f5587c7b9ea7d52b5ab4b43261 100644 (file)
@@ -169,6 +169,30 @@ public abstract class ModelUpdate {
                init = true;
        }
        
+       public void setInput(Resource oldModel, Resource newModel, GraphChanges changes, IProgressMonitor monitor) throws DatabaseException{
+               if (!oldModel.equals(changes.getResource1()) ||
+                       !newModel.equals(changes.getResource2())) {
+                       throw new DatabaseException("GraphChanges does not match input models");
+               }
+               this.changes = getSession().syncRequest(createFilterRead(changes, filters));
+               Pair<UpdateTree, UpdateList> chg = createChangeObjects(changes, monitor);
+               if (chg == null) {
+                       dispose();
+                       return;
+               }
+        updateTree = chg.first;
+        updateList = chg.second;
+               if (userFilters.size() != 0) {
+                       refreshUserFilters();
+               }
+               
+               
+               if (originalModel != null) {
+                       defaultSelections();
+               }
+               init = true;
+       }
+       
        public void addFilter(ChangeFilter filter) {
                if (init)
                        throw new IllegalStateException("ModelUpdate has been initialized, adjusting filters is no longer possible.");