ref #7086 Add "browse" and "delete" button to area selection in WSeditor
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / workingSet / WorkingSetComposite.java
index be7c9e208a52e0facef7d769700d6147e1d85e49..766eec59b12c1f911ebd7793b6d0dad39485fb56 100644 (file)
@@ -12,6 +12,7 @@ import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
@@ -22,6 +23,7 @@ import eu.etaxonomy.cdm.model.description.FeatureTree;
 import eu.etaxonomy.cdm.model.location.NamedArea;
 import eu.etaxonomy.cdm.model.name.Rank;
 import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditorComposite;
+import eu.etaxonomy.taxeditor.model.ImageResources;
 import eu.etaxonomy.taxeditor.ui.combo.TermUuidComboViewer;
 import eu.etaxonomy.taxeditor.util.TaxonTreeNodeContentProvider;
 import eu.etaxonomy.taxeditor.util.TaxonTreeNodeLabelProvider;
@@ -39,6 +41,8 @@ public class WorkingSetComposite extends Composite {
     private TreeViewer taxonNodeTree;
     private NamedArea area;
     private Text textAreaText;
+    private Button btnChooseArea;
+    private Button btnRemoveArea;
 
     public WorkingSetComposite(Composite parent, int style) {
         super(parent, style);
@@ -81,13 +85,29 @@ public class WorkingSetComposite extends Composite {
         lblNewLabel_4.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
         lblNewLabel_4.setText("Area");
 
-        textAreaText = new Text(this, SWT.BORDER);
+        Composite composite = new Composite(this, SWT.NONE);
+        composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
+        GridLayout gl_composite = new GridLayout(3, false);
+        gl_composite.horizontalSpacing = 0;
+        gl_composite.verticalSpacing = 0;
+        gl_composite.marginHeight = 0;
+        gl_composite.marginWidth = 0;
+        composite.setLayout(gl_composite);
+
+        textAreaText = new Text(composite, SWT.BORDER);
         textAreaText.setEditable(false);
         textAreaText.setText("Choose...");
         textAreaText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
 
+        btnChooseArea = new Button(composite, SWT.NONE);
+        btnChooseArea.setImage(ImageResources.getImage(ImageResources.BROWSE_ICON));
+
+        btnRemoveArea = new Button(composite, SWT.NONE);
+        btnRemoveArea.setImage(ImageResources.getImage(ImageResources.TRASH_ICON));
+
         featureTreeEditorComposite = new FeatureTreeEditorComposite(this, SWT.NONE);
-        featureTreeEditorComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
+        featureTreeEditorComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 2));
+        new Label(this, SWT.NONE);
     }
 
     @Override
@@ -134,7 +154,14 @@ public class WorkingSetComposite extends Composite {
         this.area = area;
         textAreaText.setText(area.getLabel());
     }
-    public Text getTextAreaText() {
-        return textAreaText;
+    public void removeArea() {
+        this.area = null;
+        textAreaText.setText("");
+    }
+    public Button getBtnChooseArea() {
+        return btnChooseArea;
+    }
+    public Button getBtnRemoveArea() {
+        return btnRemoveArea;
     }
 }