]> gerrit.simantics Code Review - simantics/interop.git/blobdiff - org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateOp.java
Allow binding statement changes to update operations
[simantics/interop.git] / org.simantics.interop.update / src / org / simantics / interop / update / model / UpdateOp.java
index 907741c23300b71a60b2504f26676363c05b61df..46bfcd298624c5384d679e4aeaae11520f3f3ed5 100644 (file)
@@ -63,9 +63,33 @@ public abstract class UpdateOp {
        public abstract boolean isAdd();
        public abstract boolean isDelete();
        
+       /**
+        * Is parent operation applied before this.
+        * @return
+        */
        public abstract boolean requiresParentOps();
+       /**
+        * Is child operation applied before this.
+        * @return
+        */
        public abstract boolean requiresSubOps(); 
        
+       /**
+        * Is parent operation selected when this is selected
+        * @return
+        */
+       public boolean selectParentOps() {
+               return requiresParentOps();
+       }
+       
+       /**
+        * Is child operation selected when this is selected
+        * @return
+        */
+       public boolean selectSubOps() {
+               return requiresSubOps();
+       }
+       
        public boolean select(boolean select) {
                boolean b = _select(select);
                if (b)
@@ -77,14 +101,14 @@ public abstract class UpdateOp {
                if (select == selected)
                        return true;
                if (select) {
-                       if (requiresParentOps()) {
+                       if (selectParentOps()) {
                                for (UpdateOp op : parentOps)
                                        op._select(true);
                        }
                        
                        selected = true;
                        manualSelection = false;
-                       if (requiresSubOps()) {
+                       if (selectSubOps()) {
                                for (UpdateOp op : subOps)
                                        op._select(true);
                        }
@@ -93,13 +117,13 @@ public abstract class UpdateOp {
                        selected = false;
                        manualSelection = false;
                        for (UpdateOp op : subOps) {
-                               if (op.requiresParentOps())
+                               if (op.selectParentOps())
                                        op._select(false);
                                else if (!op.manualSelection)
                                        op._select(false);
                        }
                        for (UpdateOp op : parentOps)
-                               if (op.requiresSubOps())
+                               if (op.selectSubOps())
                                        op._select(false);
                        return true;
                }
@@ -120,6 +144,12 @@ public abstract class UpdateOp {
                
        }
        
+       /**
+        * Applies the changes into the database.
+        * 
+        * @param g
+        * @throws DatabaseException
+        */
        protected abstract void _apply(WriteGraph g) throws DatabaseException;
        
        /**