-// $Id$\r
-/**\r
-* Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy \r
-* http://www.e-taxonomy.eu\r
-* \r
-* The contents of this file are subject to the Mozilla Public License Version 1.1\r
-* See LICENSE.TXT at the top of this package for the full license terms.\r
-*/\r
-\r
-package eu.etaxonomy.taxeditor.bulkeditor.command;\r
-\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import org.eclipse.core.commands.IParameterValues;\r
-import org.eclipse.ui.IEditorInput;\r
-\r
-import eu.etaxonomy.cdm.model.agent.AgentBase;\r
-import eu.etaxonomy.cdm.model.name.NameRelationship;\r
-import eu.etaxonomy.cdm.model.name.TaxonNameBase;\r
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;\r
-import eu.etaxonomy.cdm.model.reference.ReferenceBase;\r
-import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;\r
-import eu.etaxonomy.taxeditor.bulkeditor.input.AgentEditorInput;\r
-import eu.etaxonomy.taxeditor.bulkeditor.input.NameEditorInput;\r
-import eu.etaxonomy.taxeditor.bulkeditor.input.NameRelationshipEditorInput;\r
-import eu.etaxonomy.taxeditor.bulkeditor.input.OccurrenceEditorInput;\r
-import eu.etaxonomy.taxeditor.bulkeditor.input.ReferenceEditorInput;\r
-\r
-/**\r
- * @author p.ciardelli\r
- * @created 20.08.2009\r
- * @version 1.0\r
- */\r
-public class BulkEditorInputTypeValues implements IParameterValues {\r
-\r
- public enum BulkEditorInputType{\r
- REFERENCE("Reference", ReferenceEditorInput.ID),\r
- NAME("Name", NameEditorInput.ID),\r
- AGENT("Authors and Author Teams", AgentEditorInput.ID),\r
- OCCURRENCE("Specimen or Observations", OccurrenceEditorInput.ID), \r
- NAME_RELATIONSHIP("Name Relationship", NameRelationshipEditorInput.ID);\r
- \r
- public String id;\r
- public String label;\r
- \r
- BulkEditorInputType(String label, String id){\r
- this.id = id;\r
- this.label = label;\r
- }\r
- \r
- public static BulkEditorInputType getById(String id){\r
- \r
- for(BulkEditorInputType type : values()){\r
- if(id.equals(type.id)){\r
- return type;\r
- }\r
- }\r
- \r
- return null;\r
- }\r
- \r
- public static BulkEditorInputType getByType(Class clazz){\r
- if (ReferenceBase.class.isAssignableFrom(clazz)) {\r
- return REFERENCE;\r
- }\r
- else if (TaxonNameBase.class.isAssignableFrom(clazz)) {\r
- return NAME;\r
- }\r
- else if (AgentBase.class.isAssignableFrom(clazz)) {\r
- return AGENT;\r
- }\r
- else if (SpecimenOrObservationBase.class.isAssignableFrom(clazz)){\r
- return OCCURRENCE;\r
- }\r
- else if (NameRelationship.class.isAssignableFrom(clazz)){\r
- return NAME_RELATIONSHIP;\r
- }\r
- return null;\r
- }\r
- \r
- public static BulkEditorInputType getByInput(IEditorInput input) {\r
- if (input instanceof ReferenceEditorInput) {\r
- return REFERENCE;\r
- }\r
- else if (input instanceof NameEditorInput) {\r
- return NAME;\r
- }\r
- else if (input instanceof AgentEditorInput) {\r
- return AGENT;\r
- }\r
- else if (input instanceof OccurrenceEditorInput) {\r
- return OCCURRENCE;\r
- }\r
- else if (input instanceof NameRelationshipEditorInput) {\r
- return NAME_RELATIONSHIP;\r
- }\r
- return null;\r
- }\r
- \r
- public static AbstractBulkEditorInput getInput(BulkEditorInputType inputType){\r
- switch (inputType) {\r
- case REFERENCE:\r
- return new ReferenceEditorInput();\r
- case NAME:\r
- return new NameEditorInput();\r
- case AGENT:\r
- return new AgentEditorInput();\r
- case OCCURRENCE:\r
- return new OccurrenceEditorInput();\r
- case NAME_RELATIONSHIP:\r
- return new NameRelationshipEditorInput();\r
- default:\r
- return null;\r
- }\r
- }\r
- }\r
- \r
- /* (non-Javadoc)\r
- * @see org.eclipse.core.commands.IParameterValues#getParameterValues()\r
- */\r
- public Map getParameterValues() {\r
- final Map values = new HashMap();\r
- \r
- // TODO user role determines which editor inputs are returned\r
- for (BulkEditorInputType inputType : BulkEditorInputType.values()){\r
- values.put(inputType.label, inputType.id);\r
- } \r
- \r
- return values;\r
- }\r
-}\r
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.bulkeditor.command;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.commands.IParameterValues;
+import org.eclipse.ui.IEditorInput;
+
+import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.name.NameRelationship;
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.reference.ReferenceBase;
+import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
+import eu.etaxonomy.taxeditor.bulkeditor.input.AgentEditorInput;
+import eu.etaxonomy.taxeditor.bulkeditor.input.NameEditorInput;
+import eu.etaxonomy.taxeditor.bulkeditor.input.NameRelationshipEditorInput;
+import eu.etaxonomy.taxeditor.bulkeditor.input.OccurrenceEditorInput;
+import eu.etaxonomy.taxeditor.bulkeditor.input.ReferenceEditorInput;
+
+/**
+ * <p>BulkEditorInputTypeValues class.</p>
+ *
+ * @author p.ciardelli
+ * @created 20.08.2009
+ * @version 1.0
+ */
+public class BulkEditorInputTypeValues implements IParameterValues {
+
+ public enum BulkEditorInputType{
+ REFERENCE("Reference", ReferenceEditorInput.ID),
+ NAME("Name", NameEditorInput.ID),
+ AGENT("Authors and Author Teams", AgentEditorInput.ID),
+ OCCURRENCE("Specimen or Observations", OccurrenceEditorInput.ID),
+ NAME_RELATIONSHIP("Name Relationship", NameRelationshipEditorInput.ID);
+
+ public String id;
+ public String label;
+
+ BulkEditorInputType(String label, String id){
+ this.id = id;
+ this.label = label;
+ }
+
+ public static BulkEditorInputType getById(String id){
+
+ for(BulkEditorInputType type : values()){
+ if(id.equals(type.id)){
+ return type;
+ }
+ }
+
+ return null;
+ }
+
+ public static BulkEditorInputType getByType(Class clazz){
+ if (ReferenceBase.class.isAssignableFrom(clazz)) {
+ return REFERENCE;
+ }
+ else if (TaxonNameBase.class.isAssignableFrom(clazz)) {
+ return NAME;
+ }
+ else if (AgentBase.class.isAssignableFrom(clazz)) {
+ return AGENT;
+ }
+ else if (SpecimenOrObservationBase.class.isAssignableFrom(clazz)){
+ return OCCURRENCE;
+ }
+ else if (NameRelationship.class.isAssignableFrom(clazz)){
+ return NAME_RELATIONSHIP;
+ }
+ return null;
+ }
+
+ public static BulkEditorInputType getByInput(IEditorInput input) {
+ if (input instanceof ReferenceEditorInput) {
+ return REFERENCE;
+ }
+ else if (input instanceof NameEditorInput) {
+ return NAME;
+ }
+ else if (input instanceof AgentEditorInput) {
+ return AGENT;
+ }
+ else if (input instanceof OccurrenceEditorInput) {
+ return OCCURRENCE;
+ }
+ else if (input instanceof NameRelationshipEditorInput) {
+ return NAME_RELATIONSHIP;
+ }
+ return null;
+ }
+
+ public static AbstractBulkEditorInput getInput(BulkEditorInputType inputType){
+ switch (inputType) {
+ case REFERENCE:
+ return new ReferenceEditorInput();
+ case NAME:
+ return new NameEditorInput();
+ case AGENT:
+ return new AgentEditorInput();
+ case OCCURRENCE:
+ return new OccurrenceEditorInput();
+ case NAME_RELATIONSHIP:
+ return new NameRelationshipEditorInput();
+ default:
+ return null;
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IParameterValues#getParameterValues()
+ */
+ /**
+ * <p>getParameterValues</p>
+ *
+ * @return a {@link java.util.Map} object.
+ */
+ public Map getParameterValues() {
+ final Map values = new HashMap();
+
+ // TODO user role determines which editor inputs are returned
+ for (BulkEditorInputType inputType : BulkEditorInputType.values()){
+ values.put(inputType.label, inputType.id);
+ }
+
+ return values;
+ }
+}