From 01ec4156c27af2df56a0e8836de9afe570a2315c Mon Sep 17 00:00:00 2001 From: jsimomaa Date: Wed, 16 Jul 2014 05:01:23 +0000 Subject: [PATCH] refs #5106 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 --- .../sysdyn/utils/SelectionUtils.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 org.simantics.sysdyn/src/org/simantics/sysdyn/utils/SelectionUtils.java diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/SelectionUtils.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/SelectionUtils.java new file mode 100644 index 00000000..bb9272c0 --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/SelectionUtils.java @@ -0,0 +1,24 @@ +package org.simantics.sysdyn.utils; + +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.exception.DatabaseException; + +/** + * @author Jani Simomaa + * + */ +public class SelectionUtils { + + /** + * Checks whether resource can be edited + * + * @param graph + * @param resource + * @return + * @throws DatabaseException + */ + public static boolean canEdit(ReadGraph graph, Resource resource) throws DatabaseException { + return !graph.isImmutable(resource); + } +} -- 2.47.1