]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/TemplateModifier.java
(refs #7571) Fixed incorrect handling of effects in edo
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / diagram / monitor / TemplateModifier.java
1 package org.simantics.modeling.ui.diagram.monitor;
2
3 import org.simantics.browsing.ui.swt.widgets.impl.ModifyComboListenerImpl;
4 import org.simantics.db.Resource;
5 import org.simantics.db.WriteGraph;
6 import org.simantics.db.exception.DatabaseException;
7 import org.simantics.operation.Layer0X;
8
9 public class TemplateModifier extends ModifyComboListenerImpl<Resource, Resource> {
10
11         @Override
12         public void applySelection(WriteGraph graph, Resource monitor, Resource template) throws DatabaseException {
13                 Layer0X L0X = Layer0X.getInstance(graph);
14                 Resource exist = graph.getPossibleObject(monitor, L0X.ObtainsProperty);
15                 if (template.equals(exist))
16                         return;
17                 graph.markUndoPoint();
18                 graph.deny(monitor, L0X.ObtainsProperty);
19                 graph.claim(monitor, L0X.ObtainsProperty1, null, template);
20         }
21
22 }