Project

General

Profile

« Previous | Next » 

Revision 9d63eb10

Added by Alexander Oppermann over 7 years ago

Renamed classes to match the new order in PreferenceMenu

View differences:

.gitattributes
1328 1328
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/CdmPreferences.java -text
1329 1329
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/ChecklistEditorGeneralPreference.java -text
1330 1330
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/DefaultFeatureTreePreferenecs.java -text
1331
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/DefaultLanguageEditorPreferencePage.java -text
1332 1331
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/DescriptionPreferences.java -text
1333 1332
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/FeatureTreePreferences.java -text
1334 1333
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java -text
1335 1334
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/InitNomenclaturalCodePrefDialog.java -text
1336
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/LanguagePreferencePage.java -text
1335
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/LanguageEditorPreferencePage.java -text
1336
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/LanguageRepresentationPreferencePage.java -text
1337 1337
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/MatchingPreferences.java -text
1338 1338
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/MediaPreferences.java -text
1339 1339
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/MobotOpenUrlPreferences.java -text
eu.etaxonomy.taxeditor.store/plugin.xml
159 159
      </page>
160 160
      <page
161 161
            category="eu.etaxonomy.taxeditor.preference.defaultlanguagepditorpreferencePage"
162
            class="eu.etaxonomy.taxeditor.preference.LanguagePreferencePage"
162
            class="eu.etaxonomy.taxeditor.preference.LanguageRepresentationPreferencePage"
163 163
            id="eu.etaxonomy.taxeditor.preferences.language"
164 164
            name="%page.name.23">
165 165
      </page>
......
201 201
      </page>
202 202
      <page
203 203
            category="eu.etaxonomy.taxeditor.preferences.general"
204
            class="eu.etaxonomy.taxeditor.preference.DefaultLanguageEditorPreferencePage"
204
            class="eu.etaxonomy.taxeditor.preference.LanguageEditorPreferencePage"
205 205
            id="eu.etaxonomy.taxeditor.preference.defaultlanguagepditorpreferencePage"
206 206
            name="%page.name.30">
207 207
      </page>
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/DefaultLanguageEditorPreferencePage.java
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
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.
9
*/
10

  
11
package eu.etaxonomy.taxeditor.preference;
12

  
13
import java.io.IOException;
14

  
15
import org.apache.commons.lang.StringUtils;
16
import org.eclipse.jface.preference.PreferencePage;
17
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.custom.CCombo;
19
import org.eclipse.swt.events.SelectionEvent;
20
import org.eclipse.swt.events.SelectionListener;
21
import org.eclipse.swt.layout.GridData;
22
import org.eclipse.swt.layout.GridLayout;
23
import org.eclipse.swt.widgets.Composite;
24
import org.eclipse.swt.widgets.Control;
25
import org.eclipse.swt.widgets.Label;
26
import org.eclipse.ui.IWorkbench;
27
import org.eclipse.ui.IWorkbenchPreferencePage;
28

  
29
/**
30
 * @author n.hoffmann
31
 * @created Dec 3, 2010
32
 * @version 1.0
33
 */
34
public class DefaultLanguageEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage{
35

  
36
    private CCombo combo;
37
    PreferencesUtil preferencesUtil = new PreferencesUtil();
38

  
39
	/* (non-Javadoc)
40
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
41
	 */
42
	@Override
43
	protected Control createContents(Composite parent) {
44
		Composite container = new Composite(parent, SWT.NULL);
45
		final GridLayout gridLayout = new GridLayout();
46
		container.setLayout(gridLayout);
47
		createEditorDefaultLanguage(container);
48
		return container;
49
	}
50

  
51
	/**
52
     * @param container
53
     */
54
    private void createEditorDefaultLanguage(Composite container) {
55
        // TODO Auto-generated method stub
56
        final Label description = new Label(container, SWT.NONE);
57
        description.setText("After changing the default language, a restart is required,\nin order for the new settings to take effect.");
58

  
59
        final Label label = new Label(container, SWT.NONE);
60
        label.setText("Please choose your default language: ");
61

  
62
        GridData oneLine = new GridData();
63
        oneLine.grabExcessHorizontalSpace = true;
64
        oneLine.horizontalAlignment = GridData.FILL;
65

  
66
        combo = new CCombo(container, SWT.NONE);
67
        combo.setLayoutData(oneLine);
68

  
69
        combo.add(Language.GERMAN.getLabel(), 0);
70
        combo.add(Language.ENGLISH.getLabel(), 1);
71
        restoreSavedSelection();
72

  
73
        combo.addSelectionListener(new SelectionListener() {
74

  
75
            @Override
76
            public void widgetSelected(SelectionEvent e) {
77
                try {
78
                    preferencesUtil.writePropertyToConfigFile(combo.getSelectionIndex());
79
                } catch (IOException e1) {
80
                    e1.printStackTrace();
81
                }
82
            }
83

  
84
            @Override
85
            public void widgetDefaultSelected(SelectionEvent e) {
86
                // TODO Auto-generated method stub
87

  
88
            }
89
        });
90
    }
91

  
92
    /**
93
     * TODO: This method is not taking advantages of the enum field yet
94
     */
95
    private void restoreSavedSelection() {
96
        String rememberedValue = PreferencesUtil.getPreferenceStore().getString(IPreferenceKeys.DEFAULT_LANGUAGE_EDITOR);
97
        if(StringUtils.isNotEmpty(rememberedValue)&& StringUtils.isNotBlank(rememberedValue)){
98
            if(rememberedValue.equalsIgnoreCase("en")){
99
                combo.select(1);
100
            }else if(rememberedValue.equalsIgnoreCase("de")){
101
                 combo.select(0);
102
            }
103
        }
104
    }
105

  
106
    private enum Language{
107

  
108
        GERMAN("Deutsch"), ENGLISH("English");
109
        private final String label;
110
        private Language(String label){
111
            this.label = label;
112
        }
113

  
114
        /**
115
         * @return the label
116
         */
117
        public String getLabel() {
118
            return label;
119
        }
120
    }
121

  
122
 	/* (non-Javadoc)
123
	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
124
	 */
125
	@Override
126
	public void init(IWorkbench workbench) {
127
		setPreferenceStore(PreferencesUtil.getPreferenceStore());
128
	}
129

  
130
	/* (non-Javadoc)
131
	 * @see org.eclipse.jface.preference.PreferencePage#performOk()
132
	 */
133
	@Override
134
	public boolean performOk() {
135
        try {
136
            preferencesUtil.writePropertyToConfigFile(combo.getSelectionIndex());
137
        } catch (IOException e) {
138
            e.printStackTrace();
139
        }
140
		return super.performOk();
141
	}
142
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/LanguageEditorPreferencePage.java
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
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.
9
*/
10

  
11
package eu.etaxonomy.taxeditor.preference;
12

  
13
import java.io.IOException;
14

  
15
import org.apache.commons.lang.StringUtils;
16
import org.eclipse.jface.preference.PreferencePage;
17
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.custom.CCombo;
19
import org.eclipse.swt.events.SelectionEvent;
20
import org.eclipse.swt.events.SelectionListener;
21
import org.eclipse.swt.layout.GridData;
22
import org.eclipse.swt.layout.GridLayout;
23
import org.eclipse.swt.widgets.Composite;
24
import org.eclipse.swt.widgets.Control;
25
import org.eclipse.swt.widgets.Label;
26
import org.eclipse.ui.IWorkbench;
27
import org.eclipse.ui.IWorkbenchPreferencePage;
28

  
29
/**
30
 * @author n.hoffmann
31
 * @created Dec 3, 2010
32
 * @version 1.0
33
 */
34
public class LanguageEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage{
35

  
36
    private CCombo combo;
37
    PreferencesUtil preferencesUtil = new PreferencesUtil();
38

  
39
	/* (non-Javadoc)
40
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
41
	 */
42
	@Override
43
	protected Control createContents(Composite parent) {
44
		Composite container = new Composite(parent, SWT.NULL);
45
		final GridLayout gridLayout = new GridLayout();
46
		container.setLayout(gridLayout);
47
		createEditorDefaultLanguage(container);
48
		return container;
49
	}
50

  
51
	/**
52
     * @param container
53
     */
54
    private void createEditorDefaultLanguage(Composite container) {
55
        // TODO Auto-generated method stub
56
        final Label description = new Label(container, SWT.NONE);
57
        description.setText("After changing the default language, a restart is required,\nin order for the new settings to take effect.");
58

  
59
        final Label label = new Label(container, SWT.NONE);
60
        label.setText("Please choose your default language: ");
61

  
62
        GridData oneLine = new GridData();
63
        oneLine.grabExcessHorizontalSpace = true;
64
        oneLine.horizontalAlignment = GridData.FILL;
65

  
66
        combo = new CCombo(container, SWT.NONE);
67
        combo.setLayoutData(oneLine);
68

  
69
        combo.add(Language.GERMAN.getLabel(), 0);
70
        combo.add(Language.ENGLISH.getLabel(), 1);
71
        restoreSavedSelection();
72

  
73
        combo.addSelectionListener(new SelectionListener() {
74

  
75
            @Override
76
            public void widgetSelected(SelectionEvent e) {
77
                try {
78
                    preferencesUtil.writePropertyToConfigFile(combo.getSelectionIndex());
79
                } catch (IOException e1) {
80
                    e1.printStackTrace();
81
                }
82
            }
83

  
84
            @Override
85
            public void widgetDefaultSelected(SelectionEvent e) {
86
                // TODO Auto-generated method stub
87

  
88
            }
89
        });
90
    }
91

  
92
    /**
93
     * TODO: This method is not taking advantages of the enum field yet
94
     */
95
    private void restoreSavedSelection() {
96
        String rememberedValue = PreferencesUtil.getPreferenceStore().getString(IPreferenceKeys.DEFAULT_LANGUAGE_EDITOR);
97
        if(StringUtils.isNotEmpty(rememberedValue)&& StringUtils.isNotBlank(rememberedValue)){
98
            if(rememberedValue.equalsIgnoreCase("en")){
99
                combo.select(1);
100
            }else if(rememberedValue.equalsIgnoreCase("de")){
101
                 combo.select(0);
102
            }
103
        }
104
    }
105

  
106
    private enum Language{
107

  
108
        GERMAN("Deutsch"), ENGLISH("English");
109
        private final String label;
110
        private Language(String label){
111
            this.label = label;
112
        }
113

  
114
        /**
115
         * @return the label
116
         */
117
        public String getLabel() {
118
            return label;
119
        }
120
    }
121

  
122
 	/* (non-Javadoc)
123
	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
124
	 */
125
	@Override
126
	public void init(IWorkbench workbench) {
127
		setPreferenceStore(PreferencesUtil.getPreferenceStore());
128
	}
129

  
130
	/* (non-Javadoc)
131
	 * @see org.eclipse.jface.preference.PreferencePage#performOk()
132
	 */
133
	@Override
134
	public boolean performOk() {
135
        try {
136
            preferencesUtil.writePropertyToConfigFile(combo.getSelectionIndex());
137
        } catch (IOException e) {
138
            e.printStackTrace();
139
        }
140
		return super.performOk();
141
	}
142
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/LanguagePreferencePage.java
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
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.
9
*/
10

  
11
package eu.etaxonomy.taxeditor.preference;
12

  
13
import java.util.List;
14

  
15
import org.eclipse.jface.preference.PreferencePage;
16
import org.eclipse.swt.SWT;
17
import org.eclipse.swt.events.SelectionAdapter;
18
import org.eclipse.swt.events.SelectionEvent;
19
import org.eclipse.swt.layout.GridData;
20
import org.eclipse.swt.layout.GridLayout;
21
import org.eclipse.swt.layout.RowLayout;
22
import org.eclipse.swt.widgets.Button;
23
import org.eclipse.swt.widgets.Combo;
24
import org.eclipse.swt.widgets.Composite;
25
import org.eclipse.swt.widgets.Control;
26
import org.eclipse.swt.widgets.Label;
27
import org.eclipse.ui.IWorkbench;
28
import org.eclipse.ui.IWorkbenchPreferencePage;
29

  
30
import eu.etaxonomy.cdm.model.common.Language;
31
import eu.etaxonomy.taxeditor.store.CdmStore;
32

  
33
/**
34
 * @author n.hoffmann
35
 * @created Dec 3, 2010
36
 * @version 1.0
37
 */
38
public class LanguagePreferencePage extends PreferencePage implements IWorkbenchPreferencePage{
39

  
40
	private boolean isMultilanguageTextEditingCapability;
41
	private Language globalLanguage;
42

  
43
	private Composite createComposite(Composite parent){
44
		Composite composite = new Composite(parent, SWT.NULL);
45
		composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
46
		composite.setLayout(new RowLayout(SWT.HORIZONTAL));
47
		return composite;
48
	}
49

  
50
	/* (non-Javadoc)
51
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
52
	 */
53
	@Override
54
	protected Control createContents(Composite parent) {
55
		Composite container = new Composite(parent, SWT.NULL);
56
		final GridLayout gridLayout = new GridLayout();
57
		container.setLayout(gridLayout);
58

  
59
		createSetDefaultLanguage(container);
60

  
61
		createSetMultiLanguageTextEditingCapability(container);
62

  
63
		return container;
64

  
65

  
66
	}
67

  
68
	/**
69
	 * @param container
70
	 */
71
	private void createSetDefaultLanguage(Composite parent) {
72
		globalLanguage = PreferencesUtil.getGlobalLanguage();
73

  
74
		if(globalLanguage == null) {
75
		    return;
76
		}
77

  
78
		int curentSelectionIndex = 0;
79

  
80
		final Composite composite = createComposite(parent);
81
		composite.setLayout(new RowLayout(1));
82

  
83
		final Label label = new Label(composite, SWT.NONE);
84
		label.setText("Choose the global language that will be used throughout the editor to get representations in.");
85

  
86
		final Combo combo_globalLanguage = new Combo(composite, SWT.NONE);
87

  
88
		List<Language> preferredLanguages = CdmStore.getTermManager().getPreferredTerms(Language.class);
89

  
90
		for(int i = 0; i < preferredLanguages.size(); i++){
91
			Language language = preferredLanguages.get(i);
92
			combo_globalLanguage.add(language.getLabel(), i);
93
			if(language.equals(globalLanguage)){
94
				curentSelectionIndex = i;
95
			}
96
		}
97

  
98
		combo_globalLanguage.select(curentSelectionIndex);
99

  
100
		combo_globalLanguage.addSelectionListener(new SelectionAdapter() {
101
			/* (non-Javadoc)
102
			 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
103
			 */
104
			@Override
105
			public void widgetSelected(SelectionEvent e) {
106
				int selectionIndex = combo_globalLanguage.getSelectionIndex();
107
				globalLanguage = Language.getLanguageByLabel(combo_globalLanguage.getItem(selectionIndex));
108
			}
109
		});
110
	}
111

  
112
	/**
113
	 *
114
	 */
115
	private void createSetMultiLanguageTextEditingCapability(Composite parent) {
116
		isMultilanguageTextEditingCapability = getPreferenceStore().getBoolean(IPreferenceKeys.MULTILANGUAGE_TEXT_EDITING_CAPABILITY);
117

  
118
		final Composite composite = createComposite(parent);
119

  
120
		final Button button_toggle = new Button(composite, SWT.CHECK);
121

  
122

  
123
		button_toggle.setText("Enable Multiple Language Editing Capability");
124

  
125
		button_toggle.setSelection(isMultilanguageTextEditingCapability);
126

  
127

  
128
		button_toggle.addSelectionListener(new SelectionAdapter(){
129
			/* (non-Javadoc)
130
			 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
131
			 */
132
			@Override
133
			public void widgetSelected(SelectionEvent e) {
134
				isMultilanguageTextEditingCapability = button_toggle.getSelection();
135
			}
136
		});
137
	}
138

  
139
	/* (non-Javadoc)
140
	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
141
	 */
142
	@Override
143
	public void init(IWorkbench workbench) {
144
		setPreferenceStore(PreferencesUtil.getPreferenceStore());
145
	}
146

  
147
	/* (non-Javadoc)
148
	 * @see org.eclipse.jface.preference.PreferencePage#performOk()
149
	 */
150
	@Override
151
	public boolean performOk() {
152
		getPreferenceStore().setValue(IPreferenceKeys.MULTILANGUAGE_TEXT_EDITING_CAPABILITY, isMultilanguageTextEditingCapability);
153
		PreferencesUtil.setGlobalLanguage(globalLanguage);
154

  
155
		return super.performOk();
156
	}
157
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/LanguageRepresentationPreferencePage.java
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
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.
9
*/
10

  
11
package eu.etaxonomy.taxeditor.preference;
12

  
13
import java.util.List;
14

  
15
import org.eclipse.jface.preference.PreferencePage;
16
import org.eclipse.swt.SWT;
17
import org.eclipse.swt.events.SelectionAdapter;
18
import org.eclipse.swt.events.SelectionEvent;
19
import org.eclipse.swt.layout.GridData;
20
import org.eclipse.swt.layout.GridLayout;
21
import org.eclipse.swt.layout.RowLayout;
22
import org.eclipse.swt.widgets.Button;
23
import org.eclipse.swt.widgets.Combo;
24
import org.eclipse.swt.widgets.Composite;
25
import org.eclipse.swt.widgets.Control;
26
import org.eclipse.swt.widgets.Label;
27
import org.eclipse.ui.IWorkbench;
28
import org.eclipse.ui.IWorkbenchPreferencePage;
29

  
30
import eu.etaxonomy.cdm.model.common.Language;
31
import eu.etaxonomy.taxeditor.store.CdmStore;
32

  
33
/**
34
 * @author n.hoffmann
35
 * @created Dec 3, 2010
36
 * @version 1.0
37
 */
38
public class LanguageRepresentationPreferencePage extends PreferencePage implements IWorkbenchPreferencePage{
39

  
40
	private boolean isMultilanguageTextEditingCapability;
41
	private Language globalLanguage;
42

  
43
	private Composite createComposite(Composite parent){
44
		Composite composite = new Composite(parent, SWT.NULL);
45
		composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
46
		composite.setLayout(new RowLayout(SWT.HORIZONTAL));
47
		return composite;
48
	}
49

  
50
	/* (non-Javadoc)
51
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
52
	 */
53
	@Override
54
	protected Control createContents(Composite parent) {
55
		Composite container = new Composite(parent, SWT.NULL);
56
		final GridLayout gridLayout = new GridLayout();
57
		container.setLayout(gridLayout);
58

  
59
		createSetDefaultLanguage(container);
60

  
61
		createSetMultiLanguageTextEditingCapability(container);
62

  
63
		return container;
64

  
65

  
66
	}
67

  
68
	/**
69
	 * @param container
70
	 */
71
	private void createSetDefaultLanguage(Composite parent) {
72
		globalLanguage = PreferencesUtil.getGlobalLanguage();
73

  
74
		if(globalLanguage == null) {
75
		    return;
76
		}
77

  
78
		int curentSelectionIndex = 0;
79

  
80
		final Composite composite = createComposite(parent);
81
		composite.setLayout(new RowLayout(1));
82

  
83
		final Label label = new Label(composite, SWT.NONE);
84
		label.setText("Choose the global language that will be used throughout the editor to get representations in.");
85

  
86
		final Combo combo_globalLanguage = new Combo(composite, SWT.NONE);
87

  
88
		List<Language> preferredLanguages = CdmStore.getTermManager().getPreferredTerms(Language.class);
89

  
90
		for(int i = 0; i < preferredLanguages.size(); i++){
91
			Language language = preferredLanguages.get(i);
92
			combo_globalLanguage.add(language.getLabel(), i);
93
			if(language.equals(globalLanguage)){
94
				curentSelectionIndex = i;
95
			}
96
		}
97

  
98
		combo_globalLanguage.select(curentSelectionIndex);
99

  
100
		combo_globalLanguage.addSelectionListener(new SelectionAdapter() {
101
			/* (non-Javadoc)
102
			 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
103
			 */
104
			@Override
105
			public void widgetSelected(SelectionEvent e) {
106
				int selectionIndex = combo_globalLanguage.getSelectionIndex();
107
				globalLanguage = Language.getLanguageByLabel(combo_globalLanguage.getItem(selectionIndex));
108
			}
109
		});
110
	}
111

  
112
	/**
113
	 *
114
	 */
115
	private void createSetMultiLanguageTextEditingCapability(Composite parent) {
116
		isMultilanguageTextEditingCapability = getPreferenceStore().getBoolean(IPreferenceKeys.MULTILANGUAGE_TEXT_EDITING_CAPABILITY);
117

  
118
		final Composite composite = createComposite(parent);
119

  
120
		final Button button_toggle = new Button(composite, SWT.CHECK);
121

  
122

  
123
		button_toggle.setText("Enable Multiple Language Editing Capability");
124

  
125
		button_toggle.setSelection(isMultilanguageTextEditingCapability);
126

  
127

  
128
		button_toggle.addSelectionListener(new SelectionAdapter(){
129
			/* (non-Javadoc)
130
			 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
131
			 */
132
			@Override
133
			public void widgetSelected(SelectionEvent e) {
134
				isMultilanguageTextEditingCapability = button_toggle.getSelection();
135
			}
136
		});
137
	}
138

  
139
	/* (non-Javadoc)
140
	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
141
	 */
142
	@Override
143
	public void init(IWorkbench workbench) {
144
		setPreferenceStore(PreferencesUtil.getPreferenceStore());
145
	}
146

  
147
	/* (non-Javadoc)
148
	 * @see org.eclipse.jface.preference.PreferencePage#performOk()
149
	 */
150
	@Override
151
	public boolean performOk() {
152
		getPreferenceStore().setValue(IPreferenceKeys.MULTILANGUAGE_TEXT_EDITING_CAPABILITY, isMultilanguageTextEditingCapability);
153
		PreferencesUtil.setGlobalLanguage(globalLanguage);
154

  
155
		return super.performOk();
156
	}
157
}

Also available in: Unified diff