2 * Copyright (C) 2019 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.preference
;
11 import org
.eclipse
.jface
.layout
.GridLayoutFactory
;
12 import org
.eclipse
.jface
.preference
.IntegerFieldEditor
;
13 import org
.eclipse
.jface
.preference
.StringFieldEditor
;
14 import org
.eclipse
.swt
.SWT
;
15 import org
.eclipse
.swt
.layout
.GridData
;
16 import org
.eclipse
.swt
.widgets
.Composite
;
17 import org
.eclipse
.swt
.widgets
.Control
;
18 import org
.eclipse
.swt
.widgets
.Label
;
20 import eu
.etaxonomy
.cdm
.model
.metadata
.PreferencePredicate
;
21 import eu
.etaxonomy
.taxeditor
.l10n
.Messages
;
22 import eu
.etaxonomy
.taxeditor
.preference
.menu
.CdmPreferencePage
;
29 public class ExternalServicesPreferences
extends CdmPreferencePage
{
31 StringFieldEditor openUrl
;
32 IntegerFieldEditor maxWidth
;
33 IntegerFieldEditor maxHeight
;
35 StringFieldEditor mapService
;
40 protected Control
createContents(Composite parent
) {
41 Composite top
= new Composite(parent
, SWT
.LEFT
);
42 GridData gridData
= new GridData(GridData
.FILL_HORIZONTAL
);
43 GridLayoutFactory
.fillDefaults().applyTo(top
);
44 top
.setLayoutData(gridData
);
45 Label mobot
= new Label(top
, SWT
.NULL
);
46 mobot
.setText("Mobot Open Url Service"); //$NON-NLS-1$
47 GridData gridDataLabel
= new GridData(GridData
.FILL_HORIZONTAL
);
48 gridDataLabel
.horizontalSpan
=2;
50 mobot
.setLayoutData(gridDataLabel
);
52 Composite mobotComp
= new Composite(top
, SWT
.NULL
);
54 GridLayoutFactory
.fillDefaults().applyTo(mobotComp
);
56 GridData data
= new GridData();
57 data
.horizontalIndent
= 5;
58 data
.horizontalSpan
= 2;
59 mobotComp
.setLayoutData(data
);
62 openUrl
= new StringFieldEditor(PreferencesUtil
.createPreferenceString(PreferencePredicate
.MobotOpenUrlServiceAccessPoint
.getKey()),
63 "Access Point", mobotComp
); //$NON-NLS-1$
64 openUrl
.setPreferenceStore(getPreferenceStore());
67 Label reference
= new Label(mobotComp
, SWT
.NULL
);
68 reference
.setText("BHL Reference Image"); //$NON-NLS-1$
70 reference
.setLayoutData(gridDataLabel
);
71 maxWidth
= new IntegerFieldEditor(
72 PreferencesUtil
.createPreferenceString(PreferencePredicate
.MobotOpenUrlServiceMaxWidth
.getKey()),
73 Messages
.ExternalServicesPreferences_max_width
,
75 maxWidth
.setPreferenceStore(getPreferenceStore());
78 maxHeight
= new IntegerFieldEditor(
79 PreferencesUtil
.createPreferenceString(PreferencePredicate
.MobotOpenUrlServiceMaxHeight
.getKey()),
80 Messages
.ExternalServicesPreferences_max_height
,
82 maxHeight
.setPreferenceStore(getPreferenceStore());
84 Label separator
= new Label(top
, SWT
.HORIZONTAL
| SWT
.SEPARATOR
);
85 GridData sepGrid
= createTextGridData();
86 separator
.setLayoutData(sepGrid
);
90 Label mapServiceLabel
= new Label(top
, SWT
.NULL
);
91 mapServiceLabel
.setText("EDIT Map Service"); //$NON-NLS-1$
92 mapServiceLabel
.setLayoutData(gridDataLabel
);
94 mapService
= new StringFieldEditor(PreferencesUtil
.createPreferenceString(
95 PreferencePredicate
.EditMapServiceAccessPoint
.getKey()),
96 "Access Point", top
); //$NON-NLS-1$
97 mapService
.setPreferenceStore(getPreferenceStore());
107 public void createControl(Composite parent
){
108 super.createControl(parent
);
109 if (getApplyButton() != null){
110 this.getApplyButton().setEnabled(true);
115 protected void performDefaults() {
116 openUrl
.loadDefault();
117 maxHeight
.loadDefault();
118 maxWidth
.loadDefault();
119 mapService
.loadDefault();
120 super.performDefaults();