]> gerrit.simantics Code Review - simantics/platform.git/blob - 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
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.ui.workbench;\r
13 \r
14 import org.eclipse.core.runtime.IAdaptable;\r
15 import org.eclipse.ui.IEditorInput;\r
16 import org.simantics.db.ReadGraph;\r
17 import org.simantics.db.Resource;\r
18 import org.simantics.db.common.ResourceArray;\r
19 import org.simantics.db.exception.DatabaseException;\r
20 \r
21 /**\r
22  * @author Tuukka Lehtonen\r
23  * \r
24  * @see IResourceEditorInput2\r
25  * @see ResourceEditorInput\r
26  * @see ResourceEditorInput2\r
27  */\r
28 public interface IResourceEditorInput extends IEditorInput {\r
29 \r
30     /**\r
31      * @param adapter not needed anymore since 1.6, may be <code>null</code>\r
32      */\r
33     void init(IAdaptable adapter) throws DatabaseException;\r
34 \r
35     /**\r
36      * Release any strong references to resources held by this editor input.\r
37      * Does nothing when called multiple times.\r
38      */\r
39     void dispose();\r
40 \r
41     /**\r
42      * @return the same as getResourceArray().get(0) or <code>null</code> if\r
43      *         resource does not exist, i.e. getResourceArray returns an empty\r
44      *         resource array\r
45      */\r
46     Resource getResource();\r
47 \r
48     /**\r
49      * @return <code>null</code> if resource does not exist\r
50      */\r
51     ResourceArray getResourceArray();\r
52 \r
53     /**\r
54      * For checking the existence of the resource input from the given graph.\r
55      * \r
56      * @param g\r
57      * @return\r
58      */\r
59     boolean exists(ReadGraph g) throws DatabaseException;\r
60 \r
61     /**\r
62      * Needs to be called on every update by the related editor part to keep the\r
63      * cached data coherent with the graph model.\r
64      * \r
65      * @param g\r
66      */\r
67     void update(ReadGraph g) throws DatabaseException;\r
68 \r
69 }\r