3 * Copyright (C) 2013 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.ui
.section
.campanula
;
12 import org
.eclipse
.swt
.SWT
;
13 import org
.eclipse
.swt
.widgets
.Button
;
14 import org
.eclipse
.swt
.widgets
.Composite
;
15 import org
.eclipse
.swt
.widgets
.Display
;
16 import org
.eclipse
.swt
.widgets
.Label
;
17 import org
.eclipse
.ui
.forms
.widgets
.FormToolkit
;
18 import org
.eclipse
.ui
.forms
.widgets
.TableWrapData
;
19 import org
.eclipse
.ui
.forms
.widgets
.TableWrapLayout
;
20 import org
.eclipse
.wb
.swt
.ResourceManager
;
27 public class EntitySelectionField
extends Composite
{
28 private FormToolkit formToolkit
= new FormToolkit(Display
.getDefault());
30 private Button button_selection
;
31 private Button button_edit
;
32 private Button button_remove
;
35 * Create the composite.
39 public EntitySelectionField(Composite parent
, int style
) {
42 TableWrapLayout tableWrapLayout
= new TableWrapLayout();
43 tableWrapLayout
.verticalSpacing
= 0;
44 tableWrapLayout
.topMargin
= 0;
45 tableWrapLayout
.rightMargin
= 0;
46 tableWrapLayout
.numColumns
= 4;
47 tableWrapLayout
.leftMargin
= 0;
48 tableWrapLayout
.horizontalSpacing
= 0;
49 tableWrapLayout
.bottomMargin
= 0;
50 setLayout(tableWrapLayout
);
53 text
= formToolkit
.createLabel(this, "", SWT
.WRAP
);
54 TableWrapData twd_text
= new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1);
55 twd_text
.align
= TableWrapData
.LEFT
;
56 text
.setLayoutData(twd_text
);
58 button_selection
= formToolkit
.createButton(this, "", SWT
.NONE
);
59 button_selection
.setToolTipText("Browse existing");
60 button_selection
.setImage(ResourceManager
.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/prj_obj.gif"));
62 button_edit
= formToolkit
.createButton(this, "", SWT
.NONE
);
63 button_edit
.setToolTipText("Edit");
64 button_edit
.setImage(ResourceManager
.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/text.gif"));
66 button_remove
= formToolkit
.createButton(this, "", SWT
.NONE
);
67 button_remove
.setToolTipText("Remove");
68 button_remove
.setImage(ResourceManager
.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
72 protected void checkSubclass() {
73 // Disable the check that prevents subclassing of SWT components
75 public Label
getText() {
78 public Button
getButton_selection() {
79 return button_selection
;
81 public Button
getButton_edit() {
84 public Button
getButton_remove() {