]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.charts/src/org/simantics/charts/editor/ChartEditorAdapter.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.charts / src / org / simantics / charts / editor / ChartEditorAdapter.java
index 2310a58f7c86d875d313c7bdddad1b56f06f7575..45c96b66446ba6943300af071a98f50bc8ba336d 100644 (file)
@@ -1,58 +1,58 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2011 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.charts.editor;\r
-\r
-import org.eclipse.jface.resource.ImageDescriptor;\r
-import org.simantics.charts.Activator;\r
-import org.simantics.charts.ontology.ChartResource;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.request.Queries;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.ui.SimanticsUI;\r
-import org.simantics.ui.utils.ResourceAdaptionUtils;\r
-import org.simantics.ui.workbench.ResourceEditorInput;\r
-import org.simantics.ui.workbench.editor.AbstractResourceEditorAdapter;\r
-\r
-/**\r
- * @author Toni Kalajainen\r
- */\r
-public class ChartEditorAdapter extends AbstractResourceEditorAdapter {\r
-\r
-    public static ImageDescriptor CHART_ICON = ImageDescriptor.createFromURL(Activator.getDefault().getBundle()\r
-                                                     .getResource("icons/silk/chart_line.png")); ;\r
-\r
-    public ChartEditorAdapter() {\r
-        super("Chart Viewer", CHART_ICON);\r
-    }\r
-\r
-    @Override\r
-    public boolean canHandle(ReadGraph graph, Object input) throws DatabaseException {\r
-        Resource r = ResourceAdaptionUtils.toSingleResource(input);\r
-        if (r == null)\r
-            return false;\r
-\r
-        ChartResource wr = ChartResource.getInstance(graph);\r
-        if (wr.TimeSeriesChart == null)\r
-            return false;\r
-        return graph.isInstanceOf(r, wr.TimeSeriesChart);\r
-    }\r
-\r
-    @Override\r
-    public void openEditor(Resource input) throws Exception {\r
-        if (!SimanticsUI.getSession().syncRequest(Queries.isInstanceOf(input, ChartResource.URIs.TimeSeriesChart)))\r
-            return;\r
-        //E4WorkbenchUtils.openEditor(TimeSeriesEditor.ID, TimeSeriesEditor.CONTRIBUTION_URI, null, input);\r
-        openEditorWithId(TimeSeriesEditor.ID, new ResourceEditorInput(TimeSeriesEditor.ID, input));\r
-    }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 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.charts.editor;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.simantics.charts.Activator;
+import org.simantics.charts.ontology.ChartResource;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.common.request.Queries;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.ui.SimanticsUI;
+import org.simantics.ui.utils.ResourceAdaptionUtils;
+import org.simantics.ui.workbench.ResourceEditorInput;
+import org.simantics.ui.workbench.editor.AbstractResourceEditorAdapter;
+
+/**
+ * @author Toni Kalajainen
+ */
+public class ChartEditorAdapter extends AbstractResourceEditorAdapter {
+
+    public static ImageDescriptor CHART_ICON = ImageDescriptor.createFromURL(Activator.getDefault().getBundle()
+                                                     .getResource("icons/silk/chart_line.png")); ;
+
+    public ChartEditorAdapter() {
+        super("Chart Viewer", CHART_ICON);
+    }
+
+    @Override
+    public boolean canHandle(ReadGraph graph, Object input) throws DatabaseException {
+        Resource r = ResourceAdaptionUtils.toSingleResource(input);
+        if (r == null)
+            return false;
+
+        ChartResource wr = ChartResource.getInstance(graph);
+        if (wr.TimeSeriesChart == null)
+            return false;
+        return graph.isInstanceOf(r, wr.TimeSeriesChart);
+    }
+
+    @Override
+    public void openEditor(Resource input) throws Exception {
+        if (!SimanticsUI.getSession().syncRequest(Queries.isInstanceOf(input, ChartResource.URIs.TimeSeriesChart)))
+            return;
+        //E4WorkbenchUtils.openEditor(TimeSeriesEditor.ID, TimeSeriesEditor.CONTRIBUTION_URI, null, input);
+        openEditorWithId(TimeSeriesEditor.ID, new ResourceEditorInput(TimeSeriesEditor.ID, input));
+    }
+
+}