Project

General

Profile

« Previous | Next » 

Revision 0eafc672

Added by Katja Luther over 5 years ago

adapt specimen search composite to possibility to save biocase provider in preferences

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenProviderSelectionComposite.java
12 12
import org.eclipse.swt.events.DisposeEvent;
13 13
import org.eclipse.swt.events.DisposeListener;
14 14
import org.eclipse.swt.widgets.Button;
15
import org.eclipse.swt.widgets.Combo;
15 16
import org.eclipse.swt.widgets.Composite;
16 17
import org.eclipse.swt.widgets.Display;
17 18
import org.eclipse.swt.widgets.Label;
18
import org.eclipse.swt.widgets.Text;
19 19
import org.eclipse.ui.forms.widgets.FormToolkit;
20 20
import org.eclipse.ui.forms.widgets.TableWrapData;
21 21
import org.eclipse.ui.forms.widgets.TableWrapLayout;
22 22

  
23
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
24
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
25

  
23 26
/**
24 27
 * @author pplitzner
25 28
 * @date 22.05.2014
......
28 31
public class SpecimenProviderSelectionComposite extends Composite {
29 32

  
30 33
    private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
31
    private final Text txtAccessPoint;
34
    private final Combo txtAccessPoint;
32 35
    private final Button btnGbif;
33 36
    private final Button btnBioCaseProvider;
34 37
    private final Label lblAccessPointUrl;
......
62 65
        btnBioCaseProvider = new Button(this, SWT.RADIO);
63 66
        toolkit.adapt(btnBioCaseProvider, true, true);
64 67
        btnBioCaseProvider.setText("BioCASE Provider");
65
                new Label(this, SWT.NONE);
66

  
67
                txtAccessPoint = new Text(this, SWT.BORDER);
68
                txtAccessPoint.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
69
                toolkit.adapt(txtAccessPoint, true, true);
68
        txtAccessPoint = new Combo(this, SWT.BORDER);
69
        String items[] = PreferencesUtil.getPreferenceStore().getString(IPreferenceKeys.BIOCASE_PROVIDER_LIST).split(";");
70
        txtAccessPoint.setItems(items);
71
        txtAccessPoint.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
72
        toolkit.adapt(txtAccessPoint, true, true);
70 73

  
71 74
        lblAccessPointUrl = new Label(this, SWT.NONE);
72 75
        lblAccessPointUrl.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.MIDDLE, 1, 1));
......
81 84
    public Button getBtnBioCaseProvider() {
82 85
        return btnBioCaseProvider;
83 86
    }
84
    public Text getTxtAccessPoint() {
87
    public Combo getTxtAccessPoint() {
85 88
        return txtAccessPoint;
86 89
    }
87 90
    public Label getLblAccessPointUrl() {
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenProviderSelectionController.java
10 10

  
11 11
import org.eclipse.jface.wizard.IWizard;
12 12
import org.eclipse.swt.SWT;
13
import org.eclipse.swt.widgets.Combo;
13 14
import org.eclipse.swt.widgets.Composite;
14 15
import org.eclipse.swt.widgets.Event;
15 16
import org.eclipse.swt.widgets.Listener;
16
import org.eclipse.swt.widgets.Text;
17 17

  
18 18
/**
19 19
 * Controller class for handling {@link SpecimenProviderSelectionComposite}
......
66 66

  
67 67
    private void loadLastState() {
68 68
        if(lastAccessPoint!=null){
69
            Text text = composite.getTxtAccessPoint();
69
            Combo text = composite.getTxtAccessPoint();
70 70
            Listener[] listeners = text.getListeners(SWT.Modify);
71 71
            for (int i = 0; i < listeners.length; i++) {
72 72
                text.removeListener(SWT.Modify, listeners[i]);

Also available in: Unified diff