commit 804fe7cc242d3e25e2634d0ee66946cd790d0078
Author: Patrick Plitzner <p.plitzner@bgbm.org>
Date:   Thu Jul 13 14:03:58 2017 +0200

    ref #6806 remove buttons from FeatureTreeEditorComposite

diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/CharacterEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/CharacterEditor.java
index 78d5df86b..dba722efb 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/CharacterEditor.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/CharacterEditor.java
@@ -157,17 +157,13 @@ public class CharacterEditor implements ICdmEntitySessionEnabled, ISelectionChan
     private FeatureTreeEditorComposite addFeatureTreeEditor(Composite composite_3) {
         FeatureTreeEditorComposite featureTreeEditorComposite = new FeatureTreeEditorComposite(composite_3, SWT.BORDER);
         featureTreeEditorComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
-        featureTreeEditorComposite.getComposite_buttons().setVisible(false);
         return featureTreeEditorComposite;
     }
 
     private void initFeatureTreeComposite(FeatureTreeEditorComposite featureTreeEditorComposite,
             FeatureNodeDragListener featureNodeDragListener, FeatureNodeDropAdapter featureNodeDropAdapter) {
         featureTreeEditorComposite.init(featureNodeDragListener, featureNodeDropAdapter, this,
-                new FeatureTreeChooserListener(featureTreeEditorComposite), new SelectionAdapter() {
-                }, new SelectionAdapter() {
-                }, new SelectionAdapter() {
-                });
+                new FeatureTreeChooserListener(featureTreeEditorComposite));
     }
 
     @Focus
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditor.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditor.java
index 7627d6a2b..70c9c163a 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditor.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditor.java
@@ -11,7 +11,6 @@ package eu.etaxonomy.taxeditor.featuretree.e4;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -20,17 +19,14 @@ import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.inject.Inject;
 
-import org.eclipse.core.runtime.IStatus;
 import org.eclipse.e4.ui.di.Focus;
 import org.eclipse.e4.ui.di.Persist;
 import org.eclipse.e4.ui.model.application.ui.MDirtyable;
 import org.eclipse.e4.ui.services.EMenuService;
 import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
@@ -39,13 +35,9 @@ import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.widgets.Composite;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
 import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
-import eu.etaxonomy.cdm.api.service.config.FeatureNodeDeletionConfigurator;
-import eu.etaxonomy.cdm.model.description.Feature;
 import eu.etaxonomy.cdm.model.description.FeatureNode;
 import eu.etaxonomy.cdm.model.description.FeatureTree;
-import eu.etaxonomy.taxeditor.featuretree.AvailableFeaturesWizard;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
@@ -111,7 +103,7 @@ public class FeatureTreeEditor implements ICdmEntitySessionEnabled,
                             composite.setSelectedTree(tree, FeatureTreeEditor.this);
                         }
                     }
-                }, new AddButtonListener(), new RemoveSelectionListener(), new FeatureTreeExportListener(composite.getDisplay().getActiveShell(), composite));
+                });
 
         //create context menu
         menuService.registerContextMenu(composite.getViewer().getControl(), "eu.etaxonomy.taxeditor.store.popupmenu.featureTreeEditor");
@@ -139,11 +131,6 @@ public class FeatureTreeEditor implements ICdmEntitySessionEnabled,
 	/** {@inheritDoc} */
 	@Override
 	public void selectionChanged(SelectionChangedEvent event) {
-		IStructuredSelection selection = (IStructuredSelection) event
-				.getSelection();
-
-		composite.getBtnAdd().setEnabled(selection.size() <= 1);
-		composite.getBtnRemove().setEnabled(selection.size() > 0);
 		//propagate selection
 		selService.setSelection(AbstractUtility.getElementsFromSelectionChangedEvent(event));
 	}
@@ -221,42 +208,4 @@ public class FeatureTreeEditor implements ICdmEntitySessionEnabled,
         return root;
     }
 
-	private class AddButtonListener extends SelectionAdapter {
-		@Override
-		public void widgetSelected(SelectionEvent e) {
-			AvailableFeaturesWizard wizard = new AvailableFeaturesWizard();
-			WizardDialog dialog = new WizardDialog(e.widget.getDisplay().getActiveShell(), wizard);
-
-			if (dialog.open() == IStatus.OK) {
-                FeatureNode parent = ((FeatureTree) composite.getViewer().getInput()).getRoot();
-                Collection<Feature> additionalFeatures = wizard.getAdditionalFeatures();
-                for (Feature feature : additionalFeatures) {
-                    if(!getSelectedFeatureTree().getDistinctFeatures().contains(feature)){
-                        CdmStore.getService(IFeatureNodeService.class).addChildFeatureNode(parent.getUuid(), feature.getUuid());
-                    }
-				}
-				setDirty(true);
-				composite.getViewer().refresh();
-				composite.getViewer().expandToLevel(parent, 1);
-			}
-		}
-
-	}
-
-	private class RemoveSelectionListener extends SelectionAdapter {
-		@Override
-		public void widgetSelected(SelectionEvent e) {
-			IStructuredSelection selection = (IStructuredSelection) composite.getViewer()
-					.getSelection();
-
-			for (Object selectedObject : selection.toArray()) {
-				FeatureNode featureNode = (FeatureNode) selectedObject;
-				CdmStore.getService(IFeatureNodeService.class).deleteFeatureNode(featureNode.getUuid(), new FeatureNodeDeletionConfigurator());
-
-			}
-			setDirty(true);
-			composite.getViewer().refresh();
-		}
-	}
-
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditorComposite.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditorComposite.java
index 4567543d1..404134355 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditorComposite.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditorComposite.java
@@ -32,8 +32,6 @@ import eu.etaxonomy.taxeditor.featuretree.FeatureTreeContentProvider;
 import eu.etaxonomy.taxeditor.featuretree.FeatureTreeLabelProvider;
 import eu.etaxonomy.taxeditor.l10n.Messages;
 import eu.etaxonomy.taxeditor.model.ImageResources;
-import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
-import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
 
 /**
  * @author pplitzner
@@ -48,20 +46,15 @@ public class FeatureTreeEditorComposite extends Composite{
     private Text text_title;
     private Button btnOpenFeatureTree;
     private TreeViewer viewer;
-    private Button btnAdd;
-    private Button btnRemove;
-    private Button btnExportTree;
-
-    private Composite composite_buttons;
 
     public FeatureTreeEditorComposite(Composite parent, int style) {
         super(parent, style);
-        setLayout(new GridLayout(2, false));
+        setLayout(new GridLayout(1, false));
 
         Composite composite_treeTitle = new Composite(this, SWT.NULL);
         composite_treeTitle.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true,
                 false));
-        GridLayout gl_composite_treeTitle = new GridLayout(2, false);
+        GridLayout gl_composite_treeTitle = new GridLayout(3, false);
         gl_composite_treeTitle.marginWidth = 0;
         composite_treeTitle.setLayout(gl_composite_treeTitle);
 
@@ -73,43 +66,21 @@ public class FeatureTreeEditorComposite extends Composite{
         text_title.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
         text_title.setEnabled(false);
 
-        btnOpenFeatureTree = new Button(this, SWT.NONE);
+        btnOpenFeatureTree = new Button(composite_treeTitle, SWT.NONE);
         btnOpenFeatureTree.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
         btnOpenFeatureTree.setToolTipText(Messages.FeatureTreeEditorComposite_OPEN_TREE);
         btnOpenFeatureTree.setImage(ImageResources.getImage(ImageResources.BROWSE_ICON));
 
         viewer = new TreeViewer(this);
         Tree tree = viewer.getTree();
-        tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+        tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
         viewer.getControl().setLayoutData(
                 new GridData(SWT.FILL, SWT.FILL, true, true));
-
-        composite_buttons = new Composite(this,
-                SWT.NULL);
-        composite_buttons.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false,
-                false));
-        composite_buttons.setLayout(new GridLayout());
-
-        btnAdd = new Button(composite_buttons, SWT.PUSH);
-        btnAdd.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
-        btnAdd.setToolTipText(Messages.FeatureTreeEditorComposite_ADD_FEATURE);
-        btnAdd.setImage(ImageResources.getImage(ImageResources.ADD_EDIT));
-        btnRemove = new Button(composite_buttons, SWT.PUSH);
-        btnRemove.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
-        btnRemove.setToolTipText(Messages.FeatureTreeEditorComposite_REMOVE_FEATURE);
-        btnRemove.setImage(ImageResources.getImage(ImageResources.TRASH_ICON));
-
-        btnExportTree = new Button(composite_buttons, SWT.NONE);
-        btnExportTree.setToolTipText("Export feature tree");
-        btnExportTree.setImage(ImageResources.getImage(ImageResources.MOVE_ICON));
-        btnExportTree.setVisible(TaxeditorStorePlugin.getDefault().getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES));
-
-        setButtonsEnabled(false);
     }
 
-    public void init(DragSourceListener dragSourceListener,
-            DropTargetListener dropTargetListener, ISelectionChangedListener viewerSelectionChangedListener,
-            SelectionListener openFeatureTreeSelectionListener, SelectionListener addButtonSelectionListener, SelectionListener removeButtonSelectionListener, SelectionListener exportButtonSelectionListener) {
+    public void init(DragSourceListener dragSourceListener, DropTargetListener dropTargetListener,
+            ISelectionChangedListener viewerSelectionChangedListener,
+            SelectionListener openFeatureTreeSelectionListener) {
         viewer.setContentProvider(new FeatureTreeContentProvider());
         viewer.setLabelProvider(new FeatureTreeLabelProvider());
 
@@ -125,10 +96,6 @@ public class FeatureTreeEditorComposite extends Composite{
 
         viewer.addSelectionChangedListener(viewerSelectionChangedListener);
 
-        btnAdd.addSelectionListener(addButtonSelectionListener);
-        btnRemove.addSelectionListener(removeButtonSelectionListener);
-        btnExportTree.addSelectionListener(exportButtonSelectionListener);
-
         btnOpenFeatureTree.addSelectionListener(openFeatureTreeSelectionListener);
     }
 
@@ -141,16 +108,9 @@ public class FeatureTreeEditorComposite extends Composite{
         getText_title().setText(featureTree.getTitleCache());
         getText_title().addModifyListener(modifyListener);
         getText_title().setEnabled(true);
-        setButtonsEnabled(true);
         text_title.setEnabled(true);
     }
 
-    private void setButtonsEnabled(boolean enabled){
-        btnAdd.setEnabled(enabled);
-        btnRemove.setEnabled(enabled);
-        btnExportTree.setEnabled(enabled);
-    }
-
     /**
      * @return the featureTree
      */
@@ -186,32 +146,4 @@ public class FeatureTreeEditorComposite extends Composite{
         return viewer;
     }
 
-    /**
-     * @return the button_add
-     */
-    public Button getBtnAdd() {
-        return btnAdd;
-    }
-
-    /**
-     * @return the button_remove
-     */
-    public Button getBtnRemove() {
-        return btnRemove;
-    }
-
-    /**
-     * @return the composite_buttons
-     */
-    public Composite getComposite_buttons() {
-        return composite_buttons;
-    }
-
-    /**
-     * @return the btnExportTree
-     */
-    public Button getBtnExportTree() {
-        return btnExportTree;
-    }
-
 }
