]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.ui/src/org/simantics/ui/workbench/IResourceEditorInput.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.ui / src / org / simantics / ui / workbench / IResourceEditorInput.java
diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/IResourceEditorInput.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/IResourceEditorInput.java
new file mode 100644 (file)
index 0000000..0df4898
--- /dev/null
@@ -0,0 +1,69 @@
+/*******************************************************************************\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.ui.workbench;\r
+\r
+import org.eclipse.core.runtime.IAdaptable;\r
+import org.eclipse.ui.IEditorInput;\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
+\r
+/**\r
+ * @author Tuukka Lehtonen\r
+ * \r
+ * @see IResourceEditorInput2\r
+ * @see ResourceEditorInput\r
+ * @see ResourceEditorInput2\r
+ */\r
+public interface IResourceEditorInput extends IEditorInput {\r
+\r
+    /**\r
+     * @param adapter not needed anymore since 1.6, may be <code>null</code>\r
+     */\r
+    void init(IAdaptable adapter) throws DatabaseException;\r
+\r
+    /**\r
+     * Release any strong references to resources held by this editor input.\r
+     * Does nothing when called multiple times.\r
+     */\r
+    void dispose();\r
+\r
+    /**\r
+     * @return the same as getResourceArray().get(0) or <code>null</code> if\r
+     *         resource does not exist, i.e. getResourceArray returns an empty\r
+     *         resource array\r
+     */\r
+    Resource getResource();\r
+\r
+    /**\r
+     * @return <code>null</code> if resource does not exist\r
+     */\r
+    ResourceArray getResourceArray();\r
+\r
+    /**\r
+     * For checking the existence of the resource input from the given graph.\r
+     * \r
+     * @param g\r
+     * @return\r
+     */\r
+    boolean exists(ReadGraph g) throws DatabaseException;\r
+\r
+    /**\r
+     * Needs to be called on every update by the related editor part to keep the\r
+     * cached data coherent with the graph model.\r
+     * \r
+     * @param g\r
+     */\r
+    void update(ReadGraph g) throws DatabaseException;\r
+\r
+}\r