]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/SingleActiveModel.java
Added resourceId and GUID to diagram DnD content
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / request / SingleActiveModel.java
index 84083c237dcc49f3daea206cb30b9fcdd4228951..bff9a22137a80489369f09f144504421f2e7bf5f 100644 (file)
@@ -1,34 +1,34 @@
-package org.simantics.db.layer0.request;\r
-\r
-import java.util.Collection;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.request.ResourceRead;\r
-import org.simantics.db.common.utils.NameUtils;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.exception.NoSingleResultException;\r
-\r
-/**\r
- * Returns the active model or null if no single active model is available.\r
- */\r
-public class SingleActiveModel extends ResourceRead<Resource> {\r
-\r
-    public SingleActiveModel(Resource project) {\r
-        super(project);\r
-    }\r
-\r
-    @Override\r
-    public Resource perform(ReadGraph graph) throws DatabaseException {\r
-        Collection<Resource> actives = graph.syncRequest(new ActiveModels(resource));\r
-        if (actives.size() == 1)\r
-            return actives.iterator().next();\r
-\r
-        if (actives.size() == 0) \r
-               throw new NoSingleResultException("There are no active models."); \r
-\r
-       throw new NoSingleResultException("There are many active models: " + NameUtils.getSafeName(graph, actives)); \r
-        \r
-    }\r
-\r
-}\r
+package org.simantics.db.layer0.request;
+
+import java.util.Collection;
+
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.common.request.ResourceRead;
+import org.simantics.db.common.utils.NameUtils;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.exception.NoSingleResultException;
+
+/**
+ * Returns the active model or null if no single active model is available.
+ */
+public class SingleActiveModel extends ResourceRead<Resource> {
+
+    public SingleActiveModel(Resource project) {
+        super(project);
+    }
+
+    @Override
+    public Resource perform(ReadGraph graph) throws DatabaseException {
+        Collection<Resource> actives = graph.syncRequest(new ActiveModels(resource));
+        if (actives.size() == 1)
+            return actives.iterator().next();
+
+        if (actives.size() == 0) 
+               throw new NoSingleResultException("There are no active models.", actives.size()); 
+
+       throw new NoSingleResultException("There are many active models: " + NameUtils.getSafeName(graph, actives), actives.size()); 
+        
+    }
+
+}