3 * Copyright (C) 2007 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.
11 package eu
.etaxonomy
.taxeditor
.bulkeditor
.command
;
13 import java
.util
.HashMap
;
16 import org
.eclipse
.core
.commands
.IParameterValues
;
17 import org
.eclipse
.ui
.IEditorInput
;
19 import eu
.etaxonomy
.cdm
.model
.agent
.AgentBase
;
20 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationship
;
21 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
22 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationBase
;
23 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
24 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.AbstractBulkEditorInput
;
25 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.AgentEditorInput
;
26 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.NameEditorInput
;
27 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.NameRelationshipEditorInput
;
28 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.OccurrenceEditorInput
;
29 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.ReferenceEditorInput
;
32 * <p>BulkEditorInputTypeValues class.</p>
38 public class BulkEditorInputTypeValues
implements IParameterValues
{
40 public enum BulkEditorInputType
{
41 REFERENCE("Reference", ReferenceEditorInput
.ID
),
42 NAME("Name", NameEditorInput
.ID
),
43 AGENT("Authors and Author Teams", AgentEditorInput
.ID
),
44 OCCURRENCE("Specimen or Observations", OccurrenceEditorInput
.ID
),
45 NAME_RELATIONSHIP("Name Relationship", NameRelationshipEditorInput
.ID
);
50 BulkEditorInputType(String label
, String id
){
55 public static BulkEditorInputType
getById(String id
){
57 for(BulkEditorInputType type
: values()){
58 if(id
.equals(type
.id
)){
66 public static BulkEditorInputType
getByType(Class clazz
){
67 if (Reference
.class.isAssignableFrom(clazz
)) {
70 else if (TaxonNameBase
.class.isAssignableFrom(clazz
)) {
73 else if (AgentBase
.class.isAssignableFrom(clazz
)) {
76 else if (SpecimenOrObservationBase
.class.isAssignableFrom(clazz
)){
79 else if (NameRelationship
.class.isAssignableFrom(clazz
)){
80 return NAME_RELATIONSHIP
;
85 public static BulkEditorInputType
getByInput(IEditorInput input
) {
86 if (input
instanceof ReferenceEditorInput
) {
89 else if (input
instanceof NameEditorInput
) {
92 else if (input
instanceof AgentEditorInput
) {
95 else if (input
instanceof OccurrenceEditorInput
) {
98 else if (input
instanceof NameRelationshipEditorInput
) {
99 return NAME_RELATIONSHIP
;
104 public static AbstractBulkEditorInput
getInput(BulkEditorInputType inputType
){
107 return new ReferenceEditorInput();
109 return new NameEditorInput();
111 return new AgentEditorInput();
113 return new OccurrenceEditorInput();
114 case NAME_RELATIONSHIP
:
115 return new NameRelationshipEditorInput();
123 * @see org.eclipse.core.commands.IParameterValues#getParameterValues()
126 * <p>getParameterValues</p>
128 * @return a {@link java.util.Map} object.
130 public Map
getParameterValues() {
131 final Map values
= new HashMap();
133 // TODO user role determines which editor inputs are returned
134 for (BulkEditorInputType inputType
: BulkEditorInputType
.values()){
135 values
.put(inputType
.label
, inputType
.id
);