- added DerivateView to workbench
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / view / descriptive / DescriptiveContentProvider.java
index fce0faf8e592fc5ec687eb383a97af673547b092..cee881704e5668cdc8fe1ceebcfc0638f340ac0c 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * 
+ *
  */
 package eu.etaxonomy.taxeditor.editor.view.descriptive;
 
@@ -35,10 +35,10 @@ import eu.etaxonomy.taxeditor.store.TermStore;
  * @version $Id: $
  */
 public class DescriptiveContentProvider implements ITreeContentProvider {
-       
+
        protected static final Object[] NO_CHILDREN = new Object[0];
        protected Map<TaxonDescription, FeatureNodeContainerTree> featureNodeContainerCache;
-       
+
        /**
         * <p>Constructor for DescriptiveContentProvider.</p>
         *
@@ -47,21 +47,22 @@ public class DescriptiveContentProvider implements ITreeContentProvider {
        public DescriptiveContentProvider(Map<TaxonDescription, FeatureNodeContainerTree> featureNodeContainerCache) {
                this.featureNodeContainerCache = featureNodeContainerCache;
        }
-       
+
        /* (non-Javadoc)
         * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
         */
        /** {@inheritDoc} */
-       public Object[] getChildren(Object parentElement) {
+       @Override
+    public Object[] getChildren(Object parentElement) {
                if (parentElement instanceof TaxonEditorInput) {
-                       return getDescriptions((TaxonEditorInput) parentElement).toArray(); 
+                       return getDescriptions((TaxonEditorInput) parentElement).toArray();
                }
                else if (parentElement instanceof TaxonDescription) {
                        if ( ! ((TaxonDescription) parentElement).isImageGallery()) {
                                TaxonDescription description = (TaxonDescription) parentElement;
-                               
+
                                FeatureNodeContainerTree containerTree = getContainerTreeForDesription(description);
-                               
+
                                return containerTree.getRoot().getChildren().toArray();
                        }
                }
@@ -73,10 +74,10 @@ public class DescriptiveContentProvider implements ITreeContentProvider {
                                return container.getChildren().toArray();
                        }
                }
-               
+
                return NO_CHILDREN;
        }
-       
+
        private FeatureNodeContainerTree getContainerTreeForDesription(TaxonDescription description){
                if(! featureNodeContainerCache.containsKey(description)){
                        FeatureNodeContainerTree containerTree = new FeatureNodeContainerTree(description, getFeatureTree(description));
@@ -94,40 +95,40 @@ public class DescriptiveContentProvider implements ITreeContentProvider {
                        if(containerTree != null && containerTree.getRoot() != null){
                                return containerTree.getRoot().getChildren().size() != 0;
                        }
-               } 
+               }
                return getChildren(element).length != 0;
        }
-       
+
        /**
         * Retrieves the feature tree associated with the given description
-        * 
-        * TODO as of now this is always the same thing because feature trees may not be associated 
+        *
+        * TODO as of now this is always the same thing because feature trees may not be associated
         * to descriptions yet.
-        * 
+        *
         * @param description
         * @return
         */
        private FeatureTree getFeatureTree(DescriptionBase description){
                FeatureTree featureTree = null;
-               
+
                // TODO change this to the feature tree associated with this taxon description
-               if (description.hasStructuredData()){                                   
+               if (description.hasStructuredData()){
                        featureTree = PreferencesUtil.getDefaultFeatureTreeForStructuredDescription();
                }else{
                        featureTree = PreferencesUtil.getDefaultFeatureTreeForTextualDescription();
                }
-               
+
                // create a transient tree with all features if none was selected
                if(featureTree == null){
                        featureTree = FeatureTree.NewInstance(TermStore.getTerms(Feature.class));
                }
-               
+
                return featureTree;
        }
 
        /**
         * Get all descriptions associated with the given TaxonEditorInput
-        * 
+        *
         * @param parentElement
         * @return
         */
@@ -149,8 +150,8 @@ public class DescriptiveContentProvider implements ITreeContentProvider {
                                        descriptions.add(description);
                                }
                        }
-                       
-               }                       
+
+               }
                return descriptions;
        }
 
@@ -158,7 +159,8 @@ public class DescriptiveContentProvider implements ITreeContentProvider {
         * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
         */
        /** {@inheritDoc} */
-       public Object getParent(Object element) {
+       @Override
+    public Object getParent(Object element) {
                return null;
        }
 
@@ -166,17 +168,19 @@ public class DescriptiveContentProvider implements ITreeContentProvider {
         * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
         */
        /** {@inheritDoc} */
-       public Object[] getElements(Object inputElement) {
+       @Override
+    public Object[] getElements(Object inputElement) {
                return getChildren(inputElement);
        }
-       
+
        /* (non-Javadoc)
         * @see org.eclipse.jface.viewers.IContentProvider#dispose()
         */
        /**
         * <p>dispose</p>
         */
-       public void dispose() {
+       @Override
+    public void dispose() {
                featureNodeContainerCache.clear();
        }
 
@@ -184,6 +188,7 @@ public class DescriptiveContentProvider implements ITreeContentProvider {
         * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
         */
        /** {@inheritDoc} */
-       public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}    
-       
+       @Override
+    public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
+
 }