X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.interop.update%2Fsrc%2Forg%2Fsimantics%2Finterop%2Fupdate%2Fmodel%2FUpdateOp.java;h=46bfcd298624c5384d679e4aeaae11520f3f3ed5;hb=e2f57d7e61d6c52b6341f793f6988c123daa1647;hp=907741c23300b71a60b2504f26676363c05b61df;hpb=9076887bb7f54a038ef1a32c2f1121f7ebb5ed7d;p=simantics%2Finterop.git diff --git a/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateOp.java b/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateOp.java index 907741c..46bfcd2 100644 --- a/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateOp.java +++ b/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateOp.java @@ -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; /**