- activated filter in factual data view for displaying only IndividualsAssociations
authorPatric Plitzner <p.plitzner@bgbm.org>
Wed, 26 Nov 2014 14:20:29 +0000 (14:20 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Wed, 26 Nov 2014 14:20:29 +0000 (14:20 +0000)
.gitattributes
eu.etaxonomy.taxeditor.editor/icons/link_obj.gif [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/plugin.xml
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveContentProvider.java

index 279de7dbe6d93d9f16d10054d438a632157b3390..03a3a308100b889127190287cd83520083fb5dc7 100644 (file)
@@ -357,6 +357,7 @@ eu.etaxonomy.taxeditor.editor/icons/derivate_view-16x16-32.png -text
 eu.etaxonomy.taxeditor.editor/icons/edit_16x16.gif -text
 eu.etaxonomy.taxeditor.editor/icons/emblem-photos.png -text
 eu.etaxonomy.taxeditor.editor/icons/leaf_detail.png -text
+eu.etaxonomy.taxeditor.editor/icons/link_obj.gif -text
 eu.etaxonomy.taxeditor.editor/icons/xper64.png -text
 eu.etaxonomy.taxeditor.editor/p2.inf -text
 eu.etaxonomy.taxeditor.editor/plugin.xml -text
diff --git a/eu.etaxonomy.taxeditor.editor/icons/link_obj.gif b/eu.etaxonomy.taxeditor.editor/icons/link_obj.gif
new file mode 100644 (file)
index 0000000..5fd9c94
Binary files /dev/null and b/eu.etaxonomy.taxeditor.editor/icons/link_obj.gif differ
index c0c7fc3ddd824173ccc0d1ab2e00a9f4689bb462..e0dc27452a6e82856dd48cd39980258a16e69300 100644 (file)
             </visibleWhen>
          </command>
       </menuContribution>
-      <!--menuContribution
+      <menuContribution
             allPopups="false"
             locationURI="toolbar:eu.etaxonomy.taxeditor.editor.view.descriptive">
          <command
                commandId="eu.etaxonomy.taxeditor.editor.handler.showOnlyIndividualAssociations"
-               label="Show Only Individual Associations"
-               style="toggle">
+               icon="icons/link_obj.gif"
+               style="toggle"
+               tooltip="Show Only Individuals Associations">
          </command>
-      </menuContribution-->
+      </menuContribution>
       <menuContribution
             allPopups="false"
             locationURI="popup:eu.etaxonomy.taxeditor.navigation.navigatorpopup?after=taxeditor-navigation.separator2">
             </with>
          </activeWhen>
       </handler>
-      <!--handler
+      <handler
             class="eu.etaxonomy.taxeditor.editor.view.descriptive.handler.ToggleShowOnlyIndividualAssociationsHandler"
             commandId="eu.etaxonomy.taxeditor.editor.handler.showOnlyIndividualAssociations">
-         <activeWhen>
-            <with
-                  variable="activePartId">
-               <equals
-                     value="eu.etaxonomy.taxeditor.editor.view.descriptive">
-               </equals>
-            </with>
-         </activeWhen>
-      </handler-->
+      </handler>
    </extension>
    <extension
          name="%extension.name"
             id="eu.etaxonomy.taxeditor.editor.command.new.datasource"
             name="%command.name.39">
       </command>
-      <!--command
+      <command
             id="eu.etaxonomy.taxeditor.editor.handler.showOnlyIndividualAssociations"
             name="Show Only Individual Associations">
-      </command-->
+      </command>
    </extension>
    <extension
          point="org.eclipse.core.expressions.definitions">
index b24ee1704742dae6cb0d0e50b2f36f7673970a18..ddbb3525abc1c795239678ee843aa39b4dae0983 100644 (file)
@@ -67,10 +67,15 @@ public class DescriptiveContentProvider implements ITreeContentProvider {
                            DescriptionBase<?> description = (DescriptionBase<?>) parentElement;
 
                                FeatureNodeContainerTree containerTree = getContainerTreeForDesription(description);
-
-                               if(getChildren(containerTree).length>=0){
-                                   return containerTree.getRoot().getChildren().toArray();
-                               }
+                               List<FeatureNodeContainer> children = containerTree.getRoot().getChildren();
+                               //filter out containers with no children
+                               List<FeatureNodeContainer> childrenWithChildren = new ArrayList<FeatureNodeContainer>();
+                               for (FeatureNodeContainer featureNodeContainer : children) {
+                                   if(getChildren(featureNodeContainer).length>0){
+                                       childrenWithChildren.add(featureNodeContainer);
+                                   }
+                }
+                               return childrenWithChildren.toArray();
                        }
                }
                else if (parentElement instanceof FeatureNodeContainer){