Adding SelectionUtils class
Adding canEdit() method to determine if a selected resource is editable or not (based on immutability)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@29900
ac1ea38d-2e2b-0410-8846-
a27921b304fc
--- /dev/null
+package org.simantics.sysdyn.utils;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
+\r
+/**\r
+ * @author Jani Simomaa\r
+ *\r
+ */\r
+public class SelectionUtils {\r
+\r
+ /**\r
+ * Checks whether <strong>resource</strong> can be edited\r
+ * \r
+ * @param graph\r
+ * @param resource\r
+ * @return\r
+ * @throws DatabaseException\r
+ */\r
+ public static boolean canEdit(ReadGraph graph, Resource resource) throws DatabaseException {\r
+ return !graph.isImmutable(resource);\r
+ }\r
+}\r