-package org.simantics.charts.editor;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.simantics.charts.ontology.ChartResource;\r
-import org.simantics.charts.ui.ChartDoubleClickHandler;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.request.Read;\r
-import org.simantics.ui.SimanticsUI;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class PropertiesAction extends Action {\r
-\r
- private Control control;\r
- private Resource component;\r
-\r
- public PropertiesAction(String name, Control control, Resource component) {\r
- super(name);\r
- this.control = control;\r
- this.component = component;\r
- }\r
-\r
- @Override\r
- public void run() {\r
- final Shell shell = control.getShell();\r
- SimanticsUI.getSession().asyncRequest(new Read<Object>() {\r
- @Override\r
- public Object perform(ReadGraph graph) throws DatabaseException {\r
- ChartResource CHART = ChartResource.getInstance(graph);\r
- if ( graph.isInstanceOf(component, CHART.Chart_Item) ) {\r
- ChartDoubleClickHandler.openChartItemPropertiesDialog(graph, component, shell.getDisplay());\r
- } else\r
- if ( graph.isInstanceOf(component, CHART.Chart) ) {\r
- ChartDoubleClickHandler.openChartPropertiesDialog(graph, component, shell.getDisplay());\r
- } \r
- return null;\r
- }});\r
- }\r
-\r
+package org.simantics.charts.editor;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.simantics.Simantics;
+import org.simantics.charts.ontology.ChartResource;
+import org.simantics.charts.ui.ChartDoubleClickHandler;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.request.Read;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class PropertiesAction extends Action {
+
+ private Control control;
+ private Resource component;
+
+ public PropertiesAction(String name, Control control, Resource component) {
+ super(name);
+ this.control = control;
+ this.component = component;
+ }
+
+ @Override
+ public void run() {
+ final Shell shell = control.getShell();
+ Simantics.getSession().asyncRequest(new Read<Object>() {
+ @Override
+ public Object perform(ReadGraph graph) throws DatabaseException {
+ ChartResource CHART = ChartResource.getInstance(graph);
+ if ( graph.isInstanceOf(component, CHART.Chart_Item) ) {
+ ChartDoubleClickHandler.openChartItemPropertiesDialog(graph, component, shell.getDisplay());
+ } else
+ if ( graph.isInstanceOf(component, CHART.Chart) ) {
+ ChartDoubleClickHandler.openChartPropertiesDialog(graph, component, shell.getDisplay());
+ }
+ return null;
+ }});
+ }
+
}
\ No newline at end of file