01: /*
02: * uDig - User Friendly Desktop Internet GIS client
03: * http://udig.refractions.net
04: * (C) 2004, Refractions Research Inc.
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: */
17: package net.refractions.udig.project.ui;
18:
19: import net.refractions.udig.project.IProjectElement;
20:
21: import org.eclipse.ui.IEditorInput;
22:
23: /**
24: * So the project explorer could generically open any editor.
25: *
26: * @author jones
27: * @since 0.3
28: */
29: public abstract class UDIGEditorInput implements IEditorInput {
30: protected IProjectElement projectElement;
31: private String editorID;
32:
33: /**
34: * @return Returns the projectElement.
35: */
36: public IProjectElement getProjectElement() {
37: return projectElement;
38: }
39:
40: /**
41: * @param projectElement The projectElement to set.
42: */
43: public void setProjectElement(IProjectElement projectElement) {
44: this .projectElement = projectElement;
45: }
46:
47: @Override
48: public boolean equals(Object arg0) {
49: if (arg0 instanceof UDIGEditorInput) {
50: UDIGEditorInput input = (UDIGEditorInput) arg0;
51: return this .getProjectElement().equals(
52: input.getProjectElement());
53: }
54: return false;
55: }
56:
57: @Override
58: public int hashCode() {
59: return getProjectElement().hashCode();
60: }
61:
62: /**
63: * The id of the default editor for this type of input.
64: * @return The id of the default editor for this type of input.
65: */
66: public String getEditorId() {
67: return editorID;
68: }
69:
70: /**
71: * @param editorID The editorID to set.
72: */
73: public void setEditorId(String editorID) {
74: this.editorID = editorID;
75: }
76:
77: }
|