Added a default menu entry for the checklist editor, so that one can choose distribut...
authorAlexander Oppermann <a.oppermann@bgbm.org>
Mon, 29 Sep 2014 15:40:49 +0000 (15:40 +0000)
committerAlexander Oppermann <a.oppermann@bgbm.org>
Mon, 29 Sep 2014 15:40:49 +0000 (15:40 +0000)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/listener/ChecklistDropdownSelectionListener.java

index b38fd5965f15cf1c19841398a9f25ac8c1208f40..95f1b2d87f0188b247a00370060d1d34508de0b3 100644 (file)
@@ -232,9 +232,9 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I
 
         final Text searchText = createSearchBar(parent);
 
-        if (terms != null && !terms.isEmpty()) {
+//        if (terms != null && !terms.isEmpty()) {
             createToolbar(parent);
-        }
+//        }
         viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
         getSite().setSelectionProvider(viewer);
 
index 68a1a94a11686eb90ba0d4d83a914eea13484a0a..45c558e9b3dd87b3c7d996d2249d62b894b5b0be 100644 (file)
@@ -3,6 +3,7 @@ package eu.etaxonomy.taxeditor.editor.view.checklist.listener;
 import java.util.SortedSet;
 
 import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
@@ -17,6 +18,8 @@ import org.eclipse.swt.widgets.ToolItem;
 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
 import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.preference.wizard.AvailableDistributionWizard;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
 
 /**
  * Handles drop down menu selection. Available items are defined in the
@@ -39,6 +42,7 @@ public class ChecklistDropdownSelectionListener extends SelectionAdapter {
         this.editor = editor;
         this.termSet = termSet;
         menu = new Menu(dropdown.getParent().getShell());
+        initialMenuItem();
     }
 
     // SearchOption option
@@ -89,6 +93,22 @@ public class ChecklistDropdownSelectionListener extends SelectionAdapter {
         });
     }
 
+    private void initialMenuItem(){
+        MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
+        menuItem.setText("Add Distribution");
+        menuItem.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent event) {
+                AvailableDistributionWizard availableDistributionWizard = new AvailableDistributionWizard();
+                WizardDialog dialog = new WizardDialog(StoreUtil.getShell(),
+                        availableDistributionWizard);
+
+                dialog.open();
+            }
+        });
+        new MenuItem(menu, SWT.SEPARATOR);
+    }
+
     @Override
     public void widgetSelected(SelectionEvent event) {
         if (event.detail == SWT.ARROW) {