1 package org.simantics.charts.editor;
3 import org.eclipse.jface.action.Action;
4 import org.eclipse.swt.widgets.Control;
5 import org.eclipse.swt.widgets.Shell;
6 import org.simantics.Simantics;
7 import org.simantics.charts.ontology.ChartResource;
8 import org.simantics.charts.ui.ChartDoubleClickHandler;
9 import org.simantics.db.ReadGraph;
10 import org.simantics.db.Resource;
11 import org.simantics.db.exception.DatabaseException;
12 import org.simantics.db.request.Read;
15 * @author Tuukka Lehtonen
17 public class PropertiesAction extends Action {
19 private Control control;
20 private Resource component;
22 public PropertiesAction(String name, Control control, Resource component) {
24 this.control = control;
25 this.component = component;
30 final Shell shell = control.getShell();
31 Simantics.getSession().asyncRequest(new Read<Object>() {
33 public Object perform(ReadGraph graph) throws DatabaseException {
34 ChartResource CHART = ChartResource.getInstance(graph);
35 if ( graph.isInstanceOf(component, CHART.Chart_Item) ) {
36 ChartDoubleClickHandler.openChartItemPropertiesDialog(graph, component, shell.getDisplay());
38 if ( graph.isInstanceOf(component, CHART.Chart) ) {
39 ChartDoubleClickHandler.openChartPropertiesDialog(graph, component, shell.getDisplay());