]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.ui/src/org/simantics/ui/selection/WorkbenchSelectionUtils.java
Added resourceId and GUID to diagram DnD content
[simantics/platform.git] / bundles / org.simantics.ui / src / org / simantics / ui / selection / WorkbenchSelectionUtils.java
index 47e866d0f61a651d7df83d53c93e6041740cdd09..111ac8a3a2722b89b7945343830d059e2c3d82f5 100644 (file)
@@ -18,6 +18,8 @@ import org.simantics.db.common.primitiverequest.IsInstanceOf;
 import org.simantics.db.common.primitiverequest.Supertypes;
 import org.simantics.db.common.primitiverequest.Types;
 import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.request.PossibleGUID;
+import org.simantics.db.layer0.request.PossibleVariableGUID;
 import org.simantics.db.layer0.request.PossibleURI;
 import org.simantics.db.layer0.request.PossibleVariableRepresents;
 import org.simantics.db.layer0.request.VariableRead;
@@ -105,16 +107,22 @@ public class WorkbenchSelectionUtils {
                String typesStr = getTypeResourceString(processor, res, var);
                if(var != null) {
                        String uri = processor.syncRequest(new VariableURI(var));
+                       String guid = processor.syncRequest(new PossibleVariableGUID(var));
                        return toJSONObjectString(
                                        "type", "\"Variable\"",
                                        "uri", safeQuotedString(uri),
+                                       "guid", safeQuotedString(guid),
+                                       "resourceId", res == null ? "" : Long.toString(res.getResourceId()),
                                        "typeResources", typesStr);
                }
                if(res != null) {
-                       String uri = processor.syncRequest(new PossibleURI(res));
+                   String uri = processor.syncRequest(new PossibleURI(res));
+                   String guid = processor.syncRequest(new PossibleGUID(res));
                        return toJSONObjectString(
                                        "type", "\"Resource\"",
                                        "uri", safeQuotedString(uri),
+                                       "guid", safeQuotedString(guid),
+                                       "resourceId", Long.toString(res.getResourceId()),
                                        "typeResources", typesStr);
                }
                return "{ \"type\": \"Unknown\" }";