]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.ui/src/org/simantics/ui/workbench/e4/E4ResourceEditorInput.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.ui / src / org / simantics / ui / workbench / e4 / E4ResourceEditorInput.java
diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/e4/E4ResourceEditorInput.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/e4/E4ResourceEditorInput.java
new file mode 100644 (file)
index 0000000..fb27091
--- /dev/null
@@ -0,0 +1,88 @@
+package org.simantics.ui.workbench.e4;\r
+\r
+import org.eclipse.core.runtime.IAdaptable;\r
+import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.eclipse.ui.IPersistableElement;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.common.ResourceArray;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.ui.workbench.IResourceEditorInput;\r
+\r
+/**\r
+ * @author Tuukka Lehtonen\r
+ * @since 1.22\r
+ */\r
+public class E4ResourceEditorInput implements IResourceEditorInput {\r
+\r
+    protected final Resource resource;\r
+    protected final ResourceArray resourceArray;\r
+\r
+    public E4ResourceEditorInput(ResourceArray ra) {\r
+        this.resourceArray = ra;\r
+        this.resource = null;\r
+    }\r
+    \r
+    public E4ResourceEditorInput(Resource resource) {\r
+        this.resource = resource;\r
+        this.resourceArray = new ResourceArray(resource);\r
+    }\r
+\r
+    @Override\r
+    public boolean exists() {\r
+        return true;\r
+    }\r
+\r
+    @Override\r
+    public ImageDescriptor getImageDescriptor() {\r
+        return null;\r
+    }\r
+\r
+    @Override\r
+    public String getName() {\r
+        return "";\r
+    }\r
+\r
+    @Override\r
+    public IPersistableElement getPersistable() {\r
+        return null;\r
+    }\r
+\r
+    @Override\r
+    public String getToolTipText() {\r
+        return null;\r
+    }\r
+\r
+    @Override\r
+    public <T> T getAdapter(Class<T> adapter) {\r
+        return null;\r
+    }\r
+\r
+    @Override\r
+    public void init(IAdaptable adapter) throws DatabaseException {\r
+    }\r
+\r
+    @Override\r
+    public void dispose() {\r
+    }\r
+\r
+    @Override\r
+    public Resource getResource() {\r
+        return resource;\r
+    }\r
+\r
+    @Override\r
+    public ResourceArray getResourceArray() {\r
+        return resourceArray;\r
+    }\r
+\r
+    @Override\r
+    public boolean exists(ReadGraph graph) throws DatabaseException {\r
+        return graph.hasStatement(resource);\r
+    }\r
+\r
+    @Override\r
+    public void update(ReadGraph g) throws DatabaseException {\r
+    }\r
+\r
+}\r