1 package org.simantics.ui.workbench.e4;
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;
13 * @author Tuukka Lehtonen
16 public class E4ResourceEditorInput implements IResourceEditorInput {
18 protected final Resource resource;
19 protected final ResourceArray resourceArray;
21 public E4ResourceEditorInput(ResourceArray ra) {
22 this.resourceArray = ra;
26 public E4ResourceEditorInput(Resource resource) {
27 this.resource = resource;
28 this.resourceArray = new ResourceArray(resource);
32 public boolean exists() {
37 public ImageDescriptor getImageDescriptor() {
42 public String getName() {
47 public IPersistableElement getPersistable() {
52 public String getToolTipText() {
57 public <T> T getAdapter(Class<T> adapter) {
62 public void init(IAdaptable adapter) throws DatabaseException {
66 public void dispose() {
70 public Resource getResource() {
75 public ResourceArray getResourceArray() {
80 public boolean exists(ReadGraph graph) throws DatabaseException {
81 return graph.hasStatement(resource);
85 public void update(ReadGraph g) throws DatabaseException {