1 package org.simantics.modeling.ui.diagram.monitor;
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.diagram.stubs.DiagramResource;
9 public class FormatModifier extends ModifyComboListenerImpl<Resource, Resource> {
12 public void applySelection(WriteGraph graph, Resource monitor, Resource newFormatter) throws DatabaseException {
13 graph.markUndoPoint();
14 DiagramResource DIA = DiagramResource.getInstance(graph);
15 Resource exist = graph.getPossibleObject(monitor, DIA.HasFormatter);
16 if (newFormatter.equals(exist))
18 graph.deny(monitor, DIA.HasFormatter);
19 graph.claim(monitor, DIA.HasFormatter, newFormatter);