1 | package de.ugoe.cs.swe.bnftools.ui.preferences;
|
---|
2 |
|
---|
3 | import org.eclipse.jface.preference.BooleanFieldEditor;
|
---|
4 | import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
---|
5 | import org.eclipse.ui.IWorkbench;
|
---|
6 | import org.eclipse.ui.IWorkbenchPreferencePage;
|
---|
7 | import de.ugoe.cs.swe.bnftools.ui.EbnfUiModule;
|
---|
8 |
|
---|
9 | public class ValidationPreferencePage extends FieldEditorPreferencePage
|
---|
10 | implements IWorkbenchPreferencePage {
|
---|
11 |
|
---|
12 | @Override
|
---|
13 | protected void createFieldEditors() {
|
---|
14 | addField(new BooleanFieldEditor("RULE_REFERENCED_ONLY_ONCE",
|
---|
15 | "&Rule referenced only once", getFieldEditorParent()));
|
---|
16 | addField(new BooleanFieldEditor("PASSTHROUGH_RULE",
|
---|
17 | "&Passthrough rule", getFieldEditorParent()));
|
---|
18 | addField(new BooleanFieldEditor("UNUSED_RULE",
|
---|
19 | "&Unused rule", getFieldEditorParent()));
|
---|
20 | addField(new BooleanFieldEditor("EQUAL_ALTERNATIVES_RULE",
|
---|
21 | "&Rule with equal alternatives", getFieldEditorParent()));
|
---|
22 | addField(new BooleanFieldEditor("CHECK_DUPLICATE_RULES",
|
---|
23 | "&Duplicate Rules", getFieldEditorParent()));
|
---|
24 | addField(new BooleanFieldEditor("CHECK_SUBRULE_DUPLICATES",
|
---|
25 | "&Subrule Duplicates", getFieldEditorParent()));
|
---|
26 | addField(new BooleanFieldEditor("CHECK_UPDATED_GRAMMAR_CONSISTENCY",
|
---|
27 | "&Updated Grammar Consistency (in delta grammar)", getFieldEditorParent()));
|
---|
28 | }
|
---|
29 |
|
---|
30 | public void init(IWorkbench workbench) {
|
---|
31 | setPreferenceStore(de.ugoe.cs.swe.bnftools.ui.internal.EbnfActivator.getInstance().getPreferenceStore());
|
---|
32 | setDescription("Enable or disable validation rules");
|
---|
33 | }
|
---|
34 |
|
---|
35 | public boolean performOk() {
|
---|
36 | boolean result = super.performOk();
|
---|
37 | EbnfUiModule.updateValidatorSettings(); // must be updated for each new validation rule!
|
---|
38 | return result;
|
---|
39 | }
|
---|
40 |
|
---|
41 | }
|
---|