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