089502a5fab733a8ac956ae85b21d7d2a4b5ed35
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / view / derivate / DerivateViewEditorInput.java
1 // $Id$
2 /**
3 * Copyright (C) 2013 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.view.derivate;
11
12 import org.eclipse.jface.resource.ImageDescriptor;
13 import org.eclipse.ui.IEditorInput;
14 import org.eclipse.ui.IPersistableElement;
15
16 import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
17
18 /**
19 * @author pplitzner
20 * @date 25.11.2013
21 *
22 */
23 public class DerivateViewEditorInput implements IEditorInput {
24
25 private final FieldUnit fieldUnit;
26
27 public DerivateViewEditorInput(FieldUnit fieldUnit) {
28 super();
29 this.fieldUnit = fieldUnit;
30 }
31
32 /* (non-Javadoc)
33 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
34 */
35 @Override
36 public Object getAdapter(Class adapter) {
37 // TODO Auto-generated method stub
38 return null;
39 }
40
41 /* (non-Javadoc)
42 * @see org.eclipse.ui.IEditorInput#exists()
43 */
44 @Override
45 public boolean exists() {
46 return false;
47 }
48
49 /* (non-Javadoc)
50 * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
51 */
52 @Override
53 public ImageDescriptor getImageDescriptor() {
54 // TODO Auto-generated method stub
55 return null;
56 }
57
58 /* (non-Javadoc)
59 * @see org.eclipse.ui.IEditorInput#getName()
60 */
61 @Override
62 public String getName() {
63 return fieldUnit.toString();
64 }
65
66 /* (non-Javadoc)
67 * @see org.eclipse.ui.IEditorInput#getPersistable()
68 */
69 @Override
70 public IPersistableElement getPersistable() {
71 return null;
72 }
73
74 /* (non-Javadoc)
75 * @see org.eclipse.ui.IEditorInput#getToolTipText()
76 */
77 @Override
78 public String getToolTipText() {
79 return fieldUnit.toString();
80 }
81
82 /**
83 * @return the fieldUnit
84 */
85 public FieldUnit getFieldUnit() {
86 return fieldUnit;
87 }
88
89 /* (non-Javadoc)
90 * @see java.lang.Object#hashCode()
91 */
92 @Override
93 public int hashCode() {
94 final int prime = 31;
95 int result = 1;
96 result = prime * result + ((fieldUnit == null) ? 0 : fieldUnit.hashCode());
97 return result;
98 }
99
100 /* (non-Javadoc)
101 * @see java.lang.Object#equals(java.lang.Object)
102 */
103 @Override
104 public boolean equals(Object obj) {
105 if (this == obj) {
106 return true;
107 }
108 if (obj == null) {
109 return false;
110 }
111 if (getClass() != obj.getClass()) {
112 return false;
113 }
114 DerivateViewEditorInput other = (DerivateViewEditorInput) obj;
115 if (fieldUnit == null) {
116 if (other.fieldUnit != null) {
117 return false;
118 }
119 } else if (!fieldUnit.equals(other.fieldUnit)) {
120 return false;
121 }
122 return true;
123 }
124
125 }