1 package org.simantics.modeling.ui.actions;
3 import org.simantics.Simantics;
4 import org.simantics.db.Resource;
5 import org.simantics.db.WriteGraph;
6 import org.simantics.db.common.request.WriteRequest;
7 import org.simantics.db.common.utils.Logger;
8 import org.simantics.db.exception.DatabaseException;
9 import org.simantics.db.layer0.adapter.ActionFactory;
10 import org.simantics.structural.stubs.StructuralResource2;
12 public class UnlockAction implements ActionFactory {
15 public Runnable create(Object target) {
17 if (!(target instanceof Resource))
20 final Resource resource = (Resource)target;
22 return new Runnable() {
26 Simantics.getSession().markUndoPoint();
27 Simantics.getSession().syncRequest(new WriteRequest() {
29 public void perform(WriteGraph graph) throws DatabaseException {
30 StructuralResource2 STR = StructuralResource2.getInstance(graph);
31 graph.deny(resource, STR.ComponentType_Locked);
34 } catch (DatabaseException e) {
35 Logger.defaultLogError(e);