b82362551ddcb2e537f800eb2d0c32ed0695b12d
[taxeditor.git] / eu.etaxonomy.taxeditor.molecular / src / main / java / eu / etaxonomy / taxeditor / molecular / editor / 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.molecular.editor;
11
12
13 import java.util.UUID;
14
15 import org.eclipse.jface.resource.ImageDescriptor;
16 import org.eclipse.ui.IEditorInput;
17 import org.eclipse.ui.IPersistableElement;
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 UUID sequenceNodeUuid;
31
32
33 public AlignmentEditorInput(UUID sequenceNodeUuid) {
34 super();
35 this.sequenceNodeUuid = sequenceNodeUuid;
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 {@link UUID} of the sequence CDM node that should be edited by the {@link AlignmentEditor} this object
98 * is used with.
99 *
100 * @return the uuid of the CDM node to work on
101 */
102 public UUID getSequenceNodeUuid() {
103 return sequenceNodeUuid;
104 }
105
106
107 @Override
108 public int hashCode() {
109 final int prime = 31;
110 int result = 1;
111 result = prime * result
112 + ((sequenceNodeUuid == null) ? 0 : sequenceNodeUuid.hashCode());
113 return result;
114 }
115
116
117 @Override
118 public boolean equals(Object obj) {
119 if (this == obj) {
120 return true;
121 }
122 if (obj == null) {
123 return false;
124 }
125 if (getClass() != obj.getClass()) {
126 return false;
127 }
128 AlignmentEditorInput other = (AlignmentEditorInput) obj;
129 if (sequenceNodeUuid == null) {
130 if (other.sequenceNodeUuid != null) {
131 return false;
132 }
133 } else if (!sequenceNodeUuid.equals(other.sequenceNodeUuid)) {
134 return false;
135 }
136 return true;
137 }
138 }