]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.ui/src/org/simantics/ui/workbench/e4/E4ResourceEditorInput.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.ui / src / org / simantics / ui / workbench / e4 / E4ResourceEditorInput.java
1 package org.simantics.ui.workbench.e4;
2
3 import org.eclipse.core.runtime.IAdaptable;
4 import org.eclipse.jface.resource.ImageDescriptor;
5 import org.eclipse.ui.IPersistableElement;
6 import org.simantics.db.ReadGraph;
7 import org.simantics.db.Resource;
8 import org.simantics.db.common.ResourceArray;
9 import org.simantics.db.exception.DatabaseException;
10 import org.simantics.ui.workbench.IResourceEditorInput;
11
12 /**
13  * @author Tuukka Lehtonen
14  * @since 1.22
15  */
16 public class E4ResourceEditorInput implements IResourceEditorInput {
17
18     protected final Resource resource;
19     protected final ResourceArray resourceArray;
20
21     public E4ResourceEditorInput(ResourceArray ra) {
22         this.resourceArray = ra;
23         this.resource = null;
24     }
25     
26     public E4ResourceEditorInput(Resource resource) {
27         this.resource = resource;
28         this.resourceArray = new ResourceArray(resource);
29     }
30
31     @Override
32     public boolean exists() {
33         return true;
34     }
35
36     @Override
37     public ImageDescriptor getImageDescriptor() {
38         return null;
39     }
40
41     @Override
42     public String getName() {
43         return "";
44     }
45
46     @Override
47     public IPersistableElement getPersistable() {
48         return null;
49     }
50
51     @Override
52     public String getToolTipText() {
53         return null;
54     }
55
56     @Override
57     public <T> T getAdapter(Class<T> adapter) {
58         return null;
59     }
60
61     @Override
62     public void init(IAdaptable adapter) throws DatabaseException {
63     }
64
65     @Override
66     public void dispose() {
67     }
68
69     @Override
70     public Resource getResource() {
71         return resource;
72     }
73
74     @Override
75     public ResourceArray getResourceArray() {
76         return resourceArray;
77     }
78
79     @Override
80     public boolean exists(ReadGraph graph) throws DatabaseException {
81         return graph.hasStatement(resource);
82     }
83
84     @Override
85     public void update(ReadGraph g) throws DatabaseException {
86     }
87
88 }