editor now updatable via updateSite
[taxeditor.git] / taxeditor-editor / src / main / java / eu / etaxonomy / taxeditor / propertysheet / description / DescriptionElementPropertySource.java
index 4dfd9bc7e1b9e3d43e837a0e72fcd866424d5529..93ab31c268f1668c566e3926985e63cd3e5c7312 100644 (file)
@@ -15,7 +15,6 @@ import java.util.HashMap;
 import java.util.Map;\r
 import java.util.Vector;\r
 \r
-import org.apache.log4j.Logger;\r
 import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor;\r
 import org.eclipse.ui.views.properties.IPropertyDescriptor;\r
 import org.eclipse.ui.views.properties.IPropertySource;\r
@@ -34,7 +33,6 @@ import eu.etaxonomy.cdm.model.description.TextData;
 import eu.etaxonomy.cdm.model.reference.ReferenceBase;\r
 import eu.etaxonomy.taxeditor.propertysheet.reference.ReferencePropertySource;\r
 import eu.etaxonomy.taxeditor.store.model.DescriptionUtil;\r
-import eu.etaxonomy.taxeditor.store.model.ReferenceUtil;\r
 \r
 /**\r
  * @author p.ciardelli\r
@@ -42,8 +40,6 @@ import eu.etaxonomy.taxeditor.store.model.ReferenceUtil;
  * @version 1.0\r
  */\r
 public class DescriptionElementPropertySource implements IPropertySource {\r
-       private static final Logger logger = Logger\r
-                       .getLogger(DescriptionElementPropertySource.class);\r
        \r
        /**\r
         * The DescriptionElement whose properties are being displayed\r
@@ -80,7 +76,6 @@ public class DescriptionElementPropertySource implements IPropertySource {
                        P_ID_MICROREF};\r
        \r
        private String[] P_FEATURE_CLASS_NAME_MENU;\r
-       private Class[] P_FEATURE_CLASSES;\r
        \r
        /**\r
         * Constructor for top level property fields. All fields that are not subfields\r
@@ -94,7 +89,7 @@ public class DescriptionElementPropertySource implements IPropertySource {
        public DescriptionElementPropertySource(DescriptionElementBase descriptionElement, String parentid, \r
                        String[] keys) {\r
                this.descriptionElement = descriptionElement;\r
-               this.parentid = parentid;\r
+               this.setParentid(parentid);\r
                for (String key : keys) {\r
                        addDescriptor(key);\r
                }\r
@@ -122,7 +117,7 @@ public class DescriptionElementPropertySource implements IPropertySource {
                if (id.equals(P_ID_ELEMENT_CLASS)) {\r
                        \r
                        Feature feature = descriptionElement.getFeature();\r
-                       Map<Class, String> supportedClasses = new HashMap<Class, String>();\r
+                       Map<Class<?>, String> supportedClasses = new HashMap<Class<?>, String>();\r
                        \r
                        // Populate feature class arrays with classes supported by this feature\r
                        if (feature.supportsCommonTaxonName()) {\r
@@ -145,7 +140,7 @@ public class DescriptionElementPropertySource implements IPropertySource {
                        } \r
                        \r
                        P_FEATURE_CLASS_NAME_MENU = supportedClasses.values().toArray((new String[supportedClasses.size()]));\r
-                       P_FEATURE_CLASSES = supportedClasses.keySet().toArray(new Class[supportedClasses.size()]);\r
+                       supportedClasses.keySet().toArray(new Class[supportedClasses.size()]);\r
                        \r
                        descriptors.addElement(                         \r
                                        new ComboBoxPropertyDescriptor(P_ID_ELEMENT_CLASS, P_ELEMENT_CLASS, P_FEATURE_CLASS_NAME_MENU)\r
@@ -180,7 +175,7 @@ public class DescriptionElementPropertySource implements IPropertySource {
         * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()\r
         */\r
        public IPropertyDescriptor[] getPropertyDescriptors() {\r
-               return (IPropertyDescriptor[]) descriptors.toArray(\r
+               return descriptors.toArray(\r
                 new IPropertyDescriptor[descriptors.size()]);\r
        }\r
 \r
@@ -210,11 +205,11 @@ public class DescriptionElementPropertySource implements IPropertySource {
                }\r
 \r
                if (id.equals(P_ID_BIBREF)) {\r
-                       ReferenceBase citation = descriptionElement.getCitation();\r
+                       ReferenceBase<?> citation = descriptionElement.getCitation();\r
                        ReferencePropertySource bibRefPropertySource = new ReferencePropertySource(citation);\r
                        bibRefPropertySource.addPropertyChangeListener(new PropertyChangeListener() {\r
                                public void propertyChange(PropertyChangeEvent evt) {\r
-                                       descriptionElement.setCitation((ReferenceBase) evt.getNewValue());\r
+                                       descriptionElement.setCitation((ReferenceBase<?>) evt.getNewValue());\r
                                }\r
                        });\r
                        return bibRefPropertySource;\r
@@ -253,7 +248,7 @@ public class DescriptionElementPropertySource implements IPropertySource {
                \r
                if (id.equals(P_ID_BIBREF)) {\r
                        if (value instanceof ReferenceBase) {\r
-                               descriptionElement.setCitation((ReferenceBase) value);\r
+                               descriptionElement.setCitation((ReferenceBase<?>) value);\r
                        }\r
                }\r
                \r
@@ -274,4 +269,18 @@ public class DescriptionElementPropertySource implements IPropertySource {
        public DescriptionElementBase getDescriptionElement() {\r
                return descriptionElement;\r
        }\r
+\r
+       /**\r
+        * @param parentid the parentid to set\r
+        */\r
+       public void setParentid(String parentid) {\r
+               this.parentid = parentid;\r
+       }\r
+\r
+       /**\r
+        * @return the parentid\r
+        */\r
+       public String getParentid() {\r
+               return parentid;\r
+       }\r
 }\r