merge-update from trunk
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / molecular / AlignmentEditorInput.java
1 // $Id$
2 /**
3 * Copyright (C) 2014 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10 package eu.etaxonomy.taxeditor.editor.molecular;
11
12
13 import org.eclipse.jface.resource.ImageDescriptor;
14 import org.eclipse.ui.IEditorInput;
15 import org.eclipse.ui.IPersistableElement;
16
17 import eu.etaxonomy.cdm.model.molecular.Sequence;
18
19
20
21 /**
22 * @author pplitzner
23 * @author Ben Stöver
24 * @date 04.08.2014
25 */
26 public class AlignmentEditorInput implements IEditorInput {
27 private static final String name = "AlignmentEditor";
28
29
30 private final Sequence sequenceNode;
31
32
33 public AlignmentEditorInput(Sequence sequenceNode) {
34 super();
35 this.sequenceNode = sequenceNode;
36 }
37
38
39 /* (non-Javadoc)
40 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
41 */
42 @Override
43 public Object getAdapter(Class adapter) {
44 // TODO Auto-generated method stub
45 return null;
46 }
47
48
49 /* (non-Javadoc)
50 * @see org.eclipse.ui.IEditorInput#exists()
51 */
52 @Override
53 public boolean exists() {
54 // TODO Auto-generated method stub
55 return false;
56 }
57
58
59 /* (non-Javadoc)
60 * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
61 */
62 @Override
63 public ImageDescriptor getImageDescriptor() {
64 // TODO Auto-generated method stub
65 return null;
66 }
67
68
69 /* (non-Javadoc)
70 * @see org.eclipse.ui.IEditorInput#getName()
71 */
72 @Override
73 public String getName() {
74 return name;
75 }
76
77
78 /* (non-Javadoc)
79 * @see org.eclipse.ui.IEditorInput#getPersistable()
80 */
81 @Override
82 public IPersistableElement getPersistable() {
83 return null;
84 }
85
86
87 /* (non-Javadoc)
88 * @see org.eclipse.ui.IEditorInput#getToolTipText()
89 */
90 @Override
91 public String getToolTipText() {
92 return name;
93 }
94
95
96 /**
97 * Returns the sequence CDM node that should be edited by the {@link AlignmentEditor} this object
98 * is used with.
99 *
100 * @return the CDM node to work on
101 */
102 public Sequence getSequenceNode() {
103 return sequenceNode;
104 }
105
106
107 @Override
108 public int hashCode() {
109 final int prime = 31;
110 int result = 1;
111 result = prime * result
112 + ((sequenceNode == null) ? 0 : sequenceNode.hashCode());
113 return result;
114 }
115
116
117 @Override
118 public boolean equals(Object obj) {
119 if (this == obj)
120 return true;
121 if (obj == null)
122 return false;
123 if (getClass() != obj.getClass())
124 return false;
125 AlignmentEditorInput other = (AlignmentEditorInput) obj;
126 if (sequenceNode == null) {
127 if (other.sequenceNode != null)
128 return false;
129 } else if (!sequenceNode.equals(other.sequenceNode))
130 return false;
131 return true;
132 }
133 }