]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/NewPropertyViewAdapter.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.browsing.ui.swt / src / org / simantics / browsing / ui / swt / NewPropertyViewAdapter.java
diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/NewPropertyViewAdapter.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/NewPropertyViewAdapter.java
new file mode 100644 (file)
index 0000000..ed2d86a
--- /dev/null
@@ -0,0 +1,44 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 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.browsing.ui.swt;\r
+\r
+import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.ui.workbench.editor.AbstractResourceEditorAdapter;\r
+\r
+/**\r
+ * WARNING: this adapter does not currently handle structural selections, i.e.\r
+ * resource paths but only single resources which will result failure to show\r
+ * correct data or even worse.\r
+ * \r
+ * TODO: override {@link #canHandle(ReadGraph, Object)} and\r
+ * {@link #openEditor(Object)} to do what's described above.\r
+ */\r
+public class NewPropertyViewAdapter extends AbstractResourceEditorAdapter {\r
+\r
+    public NewPropertyViewAdapter() {\r
+        super("New Property View", ImageDescriptor.createFromURL(\r
+                NewPropertyViewAdapter.class.getResource("../../../../../icons/table_multiple.png")));\r
+    }\r
+\r
+    @Override\r
+    public boolean canHandle(ReadGraph g, Object r) {\r
+        return true;\r
+    }\r
+\r
+    @Override\r
+    public void openEditor(Resource r) throws Exception {\r
+        openViewWithId("org.simantics.browsing.ui.graph.propertyView", r);\r
+    }\r
+\r
+}\r