1 package org.simantics.document.linking.ge;
3 import org.simantics.db.Resource;
4 import org.simantics.db.WriteGraph;
5 import org.simantics.db.common.request.WriteRequest;
6 import org.simantics.db.exception.DatabaseException;
7 import org.simantics.db.layer0.adapter.ActionFactory;
8 import org.simantics.db.layer0.variable.Variable;
9 import org.simantics.document.linking.ontology.DocumentLink;
10 import org.simantics.ui.SimanticsUI;
12 public class RemoveSourceAction implements ActionFactory{
16 public Runnable create(Object target) {
17 if (!(target instanceof Variable))
19 final Variable v = (Variable)target;
22 return new Runnable() {
26 SimanticsUI.getSession().asyncRequest(new WriteRequest() {
29 public void perform(WriteGraph graph) throws DatabaseException {
30 graph.markUndoPoint();
32 DocumentLink sl = DocumentLink.getInstance(graph);
33 Resource t = v.getPossibleRepresents(graph);
34 if (!graph.isInstanceOf(t, sl.Source))