3 * Copyright (C) 2013 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.editor
.view
.derivate
;
13 import java
.util
.UUID
;
15 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
16 import org
.eclipse
.ui
.IEditorInput
;
17 import org
.eclipse
.ui
.IPersistableElement
;
19 import eu
.etaxonomy
.cdm
.model
.occurrence
.FieldUnit
;
20 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationBase
;
23 * Editor input for the {@link DerivateView} which holds the currently selected derivate for which
24 * the derivate hierarchy should be shown in the DerivateView.<br>
25 * It also holds a {@link SpecimenOrObservationBase} which is the root of the hierarchy. (both may be the same object)
30 public class DerivateViewEditorInput
implements IEditorInput
{
33 * The {@link UUID}s of the derivative entities
35 private Set
<UUID
> derivativeUUIDs
;
38 * Creates an editor input for the {@link DerivateView} with the currently selected derivates and the
39 * corresponding {@link FieldUnit}s (both may be the same object).
40 * @param derivateUuids the {@link UUID}s of the derivates for which the derivate hierarchy should be shown
41 * @param derivativeUUIDs the root of the hierarchy
43 public DerivateViewEditorInput(Set
<UUID
> derivateUuids
) {
44 this.derivativeUUIDs
= derivateUuids
;
48 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
51 public Object
getAdapter(Class adapter
) {
52 // TODO Auto-generated method stub
57 * @see org.eclipse.ui.IEditorInput#exists()
60 public boolean exists() {
65 * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
68 public ImageDescriptor
getImageDescriptor() {
69 // TODO Auto-generated method stub
74 * @see org.eclipse.ui.IEditorInput#getName()
77 public String
getName() {
78 return getEditorName();
82 * @see org.eclipse.ui.IEditorInput#getPersistable()
85 public IPersistableElement
getPersistable() {
90 * @see org.eclipse.ui.IEditorInput#getToolTipText()
93 public String
getToolTipText() {
94 return getEditorName();
97 private String
getEditorName() {
98 return "Derivative Editor";
102 * @return the derivativeUUIDs
104 public Set
<UUID
> getDerivativeUUIDs() {
105 return derivativeUUIDs
;
109 public int hashCode() {
110 final int prime
= 31;
112 result
= prime
* result
+ ((derivativeUUIDs
== null) ?
0 : derivativeUUIDs
.hashCode());
117 public boolean equals(Object obj
) {
124 if (getClass() != obj
.getClass()) {
127 DerivateViewEditorInput other
= (DerivateViewEditorInput
) obj
;
128 if (derivativeUUIDs
== null) {
129 if (other
.derivativeUUIDs
!= null) {
132 } else if (!derivativeUUIDs
.equals(other
.derivativeUUIDs
)) {