--- /dev/null
+import "Simantics/All"
+import "JavaBuiltin"
+
+
+importJava "org.simantics.interop.update.model.ModelUpdate" where
+ data ModelUpdate
+
+ @JavaName getUpdateTree
+ getUpdateTree :: ModelUpdate -> <Proc> UpdateTree
+
+ @JavaName getUpdateList
+ getUpdateList :: ModelUpdate -> <Proc> UpdateList
+
+ @JavaName getChanges
+ getGraphChanges :: ModelUpdate -> <Proc> GraphChanges
+
+ @JavaName applyAll
+ applyAllUpdates :: ModelUpdate -> <WriteGraph> ()
+
+ @JavaName applySelected
+ applySelectedUpdates :: ModelUpdate -> <WriteGraph> ()
+
+importJava "org.simantics.interop.update.model.UpdateTree" where
+ data UpdateTree
+
+ @JavaName getRootNode
+ getRootNode :: UpdateTree -> <Proc> UpdateNode
+
+importJava "org.simantics.interop.update.model.UpdateList" where
+ data UpdateList
+
+ @JavaName getChanges
+ getListChanges :: UpdateList -> <Proc> [Pair]
+
+ @JavaName getSelected
+ getListSelected :: UpdateList -> <Proc> MSet.T Pair
+
+ @JavaName addSelected
+ addListSelected :: UpdateList -> Pair -> <Proc>()
+
+ @JavaName removeSelected
+ removeListSelected :: UpdateList -> Pair -> <Proc>()
+
+ @JavaName isSelected
+ isListSelected :: UpdateList -> Pair -> <Proc> Boolean
+
+importJava "org.simantics.interop.test.GraphChanges" where
+ data GraphChanges
+
+ @JavaName getComparable
+ getComparable :: GraphChanges -> <Proc> BijectionMap
+
+ @JavaName getAdditions
+ getAdditions :: GraphChanges -> <Proc> [Statement]
+
+ @JavaName getDeletions
+ getDeletions :: GraphChanges -> <Proc> [Statement]
+
+ @JavaName getModifications
+ getModifications :: GraphChanges -> <Proc> [Pair]
+
+importJava "org.simantics.interop.update.model.UpdateNode" where
+ data UpdateNode
+
+ @JavaName getResource
+ getNodeResource :: UpdateNode -> <Proc> Resource
+
+ @JavaName getStatus
+ getNodeStatus :: UpdateNode -> <Proc> UpdateStatus
+
+ @JavaName getLabel
+ getNodeLabel :: UpdateNode -> <Proc> String
+
+ @JavaName getOp
+ getNodeOp :: UpdateNode -> <Proc> Maybe UpdateOp
+
+ @JavaName getChildren
+ getNodeChildren :: UpdateNode -> <Proc> [UpdateNode]
+
+
+
+importJava "org.simantics.interop.update.model.UpdateStatus" where
+ data UpdateStatus
+ @JavaName EXIST
+ S_EXIST::UpdateStatus
+ @JavaName DELETED
+ S_DELETED::UpdateStatus
+ @JavaName NEW
+ S_NEW::UpdateStatus
+ @JavaName CONTAINS
+ S_CONTAINS::UpdateStatus
+
+importJava "org.simantics.interop.update.model.UpdateOp" where
+ data UpdateOp
+
+ @JavaName applied
+ opApplied :: UpdateOp -> <Proc> Boolean
+
+ @JavaName selected
+ opSelected :: UpdateOp -> <Proc> Boolean
+
+ @JavaName "select"
+ opSelect :: UpdateOp -> Boolean -> <Proc> Boolean
+
+ @JavaName isAdd
+ opIsAdd :: UpdateOp -> <Proc> Boolean
+
+ @JavaName isDelete
+ opIsDelete :: UpdateOp -> <Proc> Boolean
+
+ @JavaName isChange
+ opIsChange :: UpdateOp -> <Proc> Boolean
+
+importJava "org.simantics.utils.datastructures.Pair" where
+ data Pair
+
+ @JavaName first
+ getFirst :: Pair -> <Proc> Maybe a
+
+ @JavaName second
+ getSecond :: Pair -> <Proc> Maybe b
+
+importJava "org.simantics.utils.datastructures.BijectionMap" where
+ data BijectionMap
+
+ @JavaName containsLeft
+ containsLeft :: BijectionMap -> l -> <Proc> Boolean
+
+ @JavaName containsRight
+ containsRight :: BijectionMap -> r -> <Proc> Boolean
+
+ @JavaName contains
+ contains :: BijectionMap -> l -> r -> <Proc> Boolean
+
+ @JavaName getLeft
+ getLeft :: BijectionMap -> r -> <Proc> Maybe l
+
+ @JavaName getRight
+ getRight :: BijectionMap -> l -> <Proc> Maybe r
+
+importJava "java.lang.Object" where
+ data Object
+
+ @JavaName getClass
+ getClass :: Object -> <Proc> Class
+
+importJava "java.lang.Class" where
+ data Class
+
+ @JavaName getName
+ getClassName :: Class -> <Proc> String
+
+ @JavaName getSimpleName
+ getSimpleClassName :: Class -> <Proc> String
\ No newline at end of file
import org.simantics.interop.test.GraphChanges;
import org.simantics.interop.update.Activator;
import org.simantics.interop.update.model.ModelUpdate;
+import org.simantics.interop.update.model.ModelUpdate.WarningListener;
import org.simantics.interop.update.model.UpdateList;
import org.simantics.interop.update.model.UpdateNode;
-import org.simantics.interop.update.model.UpdateNode.Status;
import org.simantics.interop.update.model.UpdateOp;
+import org.simantics.interop.update.model.UpdateStatus;
import org.simantics.interop.update.model.UpdateTree;
-import org.simantics.interop.update.model.ModelUpdate.WarningListener;
import org.simantics.interop.utils.TableUtils;
import org.simantics.ui.SimanticsUI;
import org.simantics.utils.datastructures.Callback;
UpdateNode n = nodeStack.pop();
if (n.getOp() != null) {
UpdateOp op = n.getOp();
- if (!op.isAdd() && !op.isDelete()) {
+ if (!op.isChange()) {
changeBrowser.setGrayed(n, true);
changeBrowser.setChecked(n, true);
} else {
@Override
public Color getBackground(Object element) {
final UpdateNode node = (UpdateNode)element;
- Status status = node.getStatus();
- if (status == Status.CONTAINS)
+ UpdateStatus status = node.getStatus();
+ if (status == UpdateStatus.CONTAINS)
return containsColor;
- if (status == Status.DELETED)
+ if (status == UpdateStatus.DELETED)
return deletedColor;
- if (status == Status.NEW)
+ if (status == UpdateStatus.NEW)
return addedColor;
return null;
}
public class UpdateNode {
- public enum Status {EXIST,DELETED,NEW,CONTAINS};
-
-
- private Status status;
+ private UpdateStatus status;
private UpdateOp op;
private Resource r;
private String label;
* @param status
* @param changes
*/
- public UpdateNode(ReadGraph g, Status status, UpdateOp op) throws DatabaseException{
+ public UpdateNode(ReadGraph g, UpdateStatus status, UpdateOp op) throws DatabaseException{
this.status = status;
this.op = op;
this.label = getLabel(g, r);
}
- public UpdateNode(ReadGraph g, Status status, Resource r) throws DatabaseException {
+ public UpdateNode(ReadGraph g, UpdateStatus status, Resource r) throws DatabaseException {
this.status = status;
this.op = null;
return g.getPossibleObject(r, l0.PartOf);
}
- public void setStatus(Status status) {
+ public void setStatus(UpdateStatus status) {
this.status = status;
}
- public Status getStatus() {
+ public UpdateStatus getStatus() {
return status;
}
public abstract boolean isAdd();
public abstract boolean isDelete();
+ public boolean isChange() {
+ return isAdd() || isDelete();
+ }
+
/**
* Is parent operation applied before this.
* @return
--- /dev/null
+package org.simantics.interop.update.model;
+
+public enum UpdateStatus {EXIST,DELETED,NEW,CONTAINS}
\ No newline at end of file
import org.simantics.db.Resource;
import org.simantics.db.exception.DatabaseException;
import org.simantics.interop.test.GraphChanges;
-import org.simantics.interop.update.model.UpdateNode.Status;
public class UpdateTree {
public UpdateTree(ReadGraph g, GraphChanges changes, UpdateOperations updateOps) throws DatabaseException {
this.changes = changes;
this.nodes = new HashMap<Resource, UpdateNode>();
- this.rootNode = createNode(g, Status.EXIST, changes.getResource1());
+ this.rootNode = createNode(g, UpdateStatus.EXIST, changes.getResource1());
nodes.put(changes.getResource1(), rootNode);
nodes.put(changes.getResource2(), rootNode);
this.updateOps = updateOps;
return changes;
}
- protected UpdateNode createNode(ReadGraph g, Status status, Resource r) throws DatabaseException {
+ protected UpdateNode createNode(ReadGraph g, UpdateStatus status, Resource r) throws DatabaseException {
return new UpdateNode(g,status, r);
}
- protected UpdateNode createNode(ReadGraph g, Status status, UpdateOp op) throws DatabaseException{
+ protected UpdateNode createNode(ReadGraph g, UpdateStatus status, UpdateOp op) throws DatabaseException{
return new UpdateNode(g,status, op);
}
private UpdateNode createNode(ReadGraph g, Resource r1, Resource r2) throws DatabaseException {
UpdateNode node = null;
if (r1 != null && r2 != null) {
- node = createNode(g, Status.EXIST, r1);
+ node = createNode(g, UpdateStatus.EXIST, r1);
nodes.put(r1, node);
nodes.put(r2, node);
} else if (r1 != null) {
- node = createNode(g,Status.DELETED ,updateOps.getUpdateOp(r1));
+ node = createNode(g,UpdateStatus.DELETED ,updateOps.getUpdateOp(r1));
nodes.put(r1, node);
} else if (r2 != null) {
- node = createNode(g,Status.NEW, updateOps.getUpdateOp(r2));
+ node = createNode(g,UpdateStatus.NEW, updateOps.getUpdateOp(r2));
nodes.put(r2, node);
}
return node;
org.simantics.structural.ontology;bundle-version="1.1.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
-Export-Package: org.simantics.interop.browsing,
+Export-Package:
org.simantics.interop.stubs,
org.simantics.interop.test,
org.simantics.interop.utils