ref #5474 Add separator and i10n to Term menu
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / editor / definedterm / DefinedTermMenu.java
index 4f3e7770f5ec7011fd5eb248c1f43e6aeaa6a48c..9bc72b20b1c8bcdbaeed8d765d06d69eb47d34c8 100644 (file)
@@ -1,4 +1,3 @@
-// $Id$
 /**
 * Copyright (C) 2009 EDIT
 * European Distributed Institute of Taxonomy
@@ -30,6 +29,7 @@ import org.eclipse.ui.menus.CommandContributionItem;
 import org.eclipse.ui.menus.CommandContributionItemParameter;
 
 import eu.etaxonomy.cdm.model.common.TermType;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 
 /**
  * Menu used in the store plugin xml to dynamically generate menu (sub-menu) contribution items
@@ -52,16 +52,30 @@ public class DefinedTermMenu extends CompoundContributionItem {
            dtMenuManager.setVisible(true);
 
            items.add(dtMenuManager);
+           //add Feature and NamedArea to top level
+           dtMenuManager.add(addChildTermsToMenuManager(TermType.Feature));
+           dtMenuManager.add(addChildTermsToMenuManager(TermType.NamedArea));
+           dtMenuManager.add(new Separator());
+
+           MenuManager otherMenuManager =
+                new MenuManager("Others","eu.etaxonomy.taxeditor.store.term.other.menu");
+           otherMenuManager.setVisible(true);
+           dtMenuManager.add(otherMenuManager);
+
            List<TermType> ttList = new ArrayList<TermType>(EnumSet.allOf(TermType.class));
            Collections.sort(ttList,new SortByTermTypeMessage());
            for (TermType tt : ttList)
            {
+               //skip Feature and NamedArea as they have already been added to top level
+               if(tt.equals(TermType.Feature) || tt.equals(TermType.NamedArea)){
+                   continue;
+               }
                // if term type has a parent, do not add it
                // it will be added in the recursive call
                if(tt.getKindOf() == null) {
                    IContributionItem ici = addChildTermsToMenuManager(tt);
                    if(ici != null) {
-                       dtMenuManager.add(ici);
+                       otherMenuManager.add(ici);
                    }
                }
            }
@@ -79,7 +93,7 @@ public class DefinedTermMenu extends CompoundContributionItem {
                        }
                        // term type has children, so create sub menu
                        MenuManager dtMenuManager =
-                                       new MenuManager(termType.getMessage(),"eu.etaxonomy.taxeditor.store." + termType.getKey() + "Menu");
+                                       new MenuManager(termType.getMessage(PreferencesUtil.getGlobalLanguage()),"eu.etaxonomy.taxeditor.store." + termType.getKey() + "Menu");
                        dtMenuManager.setVisible(true);
                        dtMenuManager.add(createDefaultMenuItem(termType));