-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.modeling.ui.modelBrowser2.model;\r
-\r
-import java.util.List;\r
-\r
-import org.eclipse.jface.viewers.ISelection;\r
-import org.simantics.browsing.ui.common.node.IDeletable;\r
-import org.simantics.browsing.ui.common.node.IDropTargetNode;\r
-import org.simantics.browsing.ui.common.node.IModifiableNode;\r
-import org.simantics.browsing.ui.content.Labeler.Modifier;\r
-import org.simantics.browsing.ui.graph.impl.LabelModifier;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Session;\r
-import org.simantics.modeling.PropertyVariables;\r
-import org.simantics.structural.ui.modelBrowser.nodes.AbstractNode;\r
-import org.simantics.ui.SimanticsUI;\r
-import org.simantics.utils.ui.ISelectionUtils;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class ChartNode extends AbstractNode implements IDeletable, IDropTargetNode, IModifiableNode {\r
-\r
- public ChartNode(Resource resource) {\r
- super(resource);\r
- }\r
-\r
- @Override\r
- public void drop(Object data) {\r
- if (!(data instanceof ISelection))\r
- return;\r
-\r
- final List<PropertyVariables> vars = ISelectionUtils.filterSelection((ISelection) data, PropertyVariables.class);\r
- if (!vars.isEmpty()) {\r
-// try {\r
-// List<VariableReference> references = SimanticsUI.getSession().syncRequest(VariableReferences.toReferences(vars));\r
-// addPlots(references);\r
-// } catch (DatabaseException e) {\r
-// ErrorLogger.defaultLogError(e);\r
-// }\r
- } else {\r
- /*\r
- final List<NodeReference> references = ISelectionUtils.filterSelection((ISelection) data, NodeReference.class);\r
- if (!references.isEmpty()) {\r
- addPlots(references);\r
- }\r
- */\r
- }\r
- }\r
-\r
-// private void addPlots(List<VariableReference> references) {\r
-// SimanticsUI.getSession().asyncRequest(new AddChartItem(resource, references), new Callback<DatabaseException>() {\r
-// @Override\r
-// public void run(DatabaseException e) {\r
-// if (e != null)\r
-// ErrorLogger.defaultLogError(e);\r
-// }\r
-// });\r
-// }\r
-\r
- @Override\r
- public Modifier getModifier(String columnId) {\r
- Session s = SimanticsUI.getSession();\r
- return new LabelModifier(s, resource);\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.modeling.ui.modelBrowser2.model;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.simantics.Simantics;
+import org.simantics.browsing.ui.common.node.IDeletable;
+import org.simantics.browsing.ui.common.node.IDropTargetNode;
+import org.simantics.browsing.ui.common.node.IModifiableNode;
+import org.simantics.browsing.ui.content.Labeler.Modifier;
+import org.simantics.browsing.ui.graph.impl.LabelModifier;
+import org.simantics.db.Resource;
+import org.simantics.db.Session;
+import org.simantics.modeling.PropertyVariables;
+import org.simantics.structural.ui.modelBrowser.nodes.AbstractNode;
+import org.simantics.utils.ui.ISelectionUtils;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class ChartNode extends AbstractNode implements IDeletable, IDropTargetNode, IModifiableNode {
+
+ public ChartNode(Resource resource) {
+ super(resource);
+ }
+
+ @Override
+ public void drop(Object data) {
+ if (!(data instanceof ISelection))
+ return;
+
+ final List<PropertyVariables> vars = ISelectionUtils.filterSelection((ISelection) data, PropertyVariables.class);
+ if (!vars.isEmpty()) {
+// try {
+// List<VariableReference> references = Simantics.getSession().syncRequest(VariableReferences.toReferences(vars));
+// addPlots(references);
+// } catch (DatabaseException e) {
+// ErrorLogger.defaultLogError(e);
+// }
+ } else {
+ /*
+ final List<NodeReference> references = ISelectionUtils.filterSelection((ISelection) data, NodeReference.class);
+ if (!references.isEmpty()) {
+ addPlots(references);
+ }
+ */
+ }
+ }
+
+// private void addPlots(List<VariableReference> references) {
+// Simantics.getSession().asyncRequest(new AddChartItem(resource, references), new Callback<DatabaseException>() {
+// @Override
+// public void run(DatabaseException e) {
+// if (e != null)
+// ErrorLogger.defaultLogError(e);
+// }
+// });
+// }
+
+ @Override
+ public Modifier getModifier(String columnId) {
+ Session s = Simantics.getSession();
+ return new LabelModifier(s, resource);
+ }
+
+}