]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/CurrentFormatFactory.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 / CurrentFormatFactory.java
1 package org.simantics.modeling.ui.diagram.monitor;
2
3 import org.simantics.browsing.ui.swt.widgets.impl.ReadFactoryImpl;
4 import org.simantics.common.format.Formatter;
5 import org.simantics.db.ReadGraph;
6 import org.simantics.db.Resource;
7 import org.simantics.db.exception.DatabaseException;
8 import org.simantics.diagram.stubs.DiagramResource;
9
10 public class CurrentFormatFactory extends ReadFactoryImpl<Resource, String> {
11
12         @Override
13         public String perform(ReadGraph graph, Resource monitor) throws DatabaseException {
14                 
15                 DiagramResource DIA = DiagramResource.getInstance(graph);
16                 Formatter formatter = graph.getPossibleRelatedAdapter(monitor, DIA.HasFormatter, Formatter.class);
17                 if(formatter != null) return formatter.toString();
18                 else return null;
19                 
20         }
21         
22 }