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;
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;
private TreeViewer taxonNodeTree;
private NamedArea area;
private Text textAreaText;
+ private Button btnChooseArea;
+ private Button btnRemoveArea;
public WorkingSetComposite(Composite parent, int style) {
super(parent, style);
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
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;
}
}
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
composite.getRankMin().addSelectionChangedListener(event->dirty.setDirty(true));
composite.getRankMax().addSelectionChangedListener(event->dirty.setDirty(true));
- composite.getTextAreaText().addListener(SWT.MouseDown, event-> {
- NamedArea area = NamedAreaSelectionDialog.select(shell, null, null);
- if(area!=null){
- composite.setArea(area);
+ composite.getBtnChooseArea().addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
+ NamedArea area = NamedAreaSelectionDialog.select(shell, null, null);
+ if(area!=null){
+ composite.setArea(area);
+ }
+ dirty.setDirty(true);
+ }
+ });
+ composite.getBtnRemoveArea().addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
+ composite.removeArea();
+ dirty.setDirty(true);
}
- dirty.setDirty(true);
});
composite.getFeatureTreeEditorComposite().init(null, null, e->selectionService.setSelection(e.getSelection()), null);