-package org.simantics.modeling.ui.actions;\r
-\r
-import org.simantics.Simantics;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.common.request.WriteRequest;\r
-import org.simantics.db.common.utils.Logger;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.adapter.ActionFactory;\r
-import org.simantics.structural.stubs.StructuralResource2;\r
-\r
-public class LockAction implements ActionFactory {\r
-\r
- @Override\r
- public Runnable create(Object target) {\r
-\r
- if (!(target instanceof Resource))\r
- return null;\r
-\r
- final Resource resource = (Resource)target;\r
-\r
- return new Runnable() {\r
- @Override\r
- public void run() {\r
- try {\r
- Simantics.getSession().markUndoPoint();\r
- Simantics.getSession().syncRequest(new WriteRequest() {\r
- @Override\r
- public void perform(WriteGraph graph) throws DatabaseException {\r
- StructuralResource2 STR = StructuralResource2.getInstance(graph);\r
- graph.claim(resource, STR.ComponentType_Locked, resource);\r
- }\r
- });\r
- } catch (DatabaseException e) {\r
- Logger.defaultLogError(e);\r
- }\r
- }\r
- };\r
- }\r
-\r
-}\r
+package org.simantics.modeling.ui.actions;
+
+import org.simantics.Simantics;
+import org.simantics.db.Resource;
+import org.simantics.db.WriteGraph;
+import org.simantics.db.common.request.WriteRequest;
+import org.simantics.db.common.utils.Logger;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.adapter.ActionFactory;
+import org.simantics.structural.stubs.StructuralResource2;
+
+public class LockAction implements ActionFactory {
+
+ @Override
+ public Runnable create(Object target) {
+
+ if (!(target instanceof Resource))
+ return null;
+
+ final Resource resource = (Resource)target;
+
+ return new Runnable() {
+ @Override
+ public void run() {
+ try {
+ Simantics.getSession().markUndoPoint();
+ Simantics.getSession().syncRequest(new WriteRequest() {
+ @Override
+ public void perform(WriteGraph graph) throws DatabaseException {
+ StructuralResource2 STR = StructuralResource2.getInstance(graph);
+ graph.claim(resource, STR.ComponentType_Locked, resource);
+ }
+ });
+ } catch (DatabaseException e) {
+ Logger.defaultLogError(e);
+ }
+ }
+ };
+ }
+
+}