Lines 13-23
Link Here
|
13 |
|
13 |
|
14 |
package org.eclipse.wst.xml.ui.internal.preferences; |
14 |
package org.eclipse.wst.xml.ui.internal.preferences; |
15 |
|
15 |
|
16 |
|
|
|
17 |
import org.eclipse.core.runtime.Preferences; |
16 |
import org.eclipse.core.runtime.Preferences; |
|
|
17 |
import org.eclipse.core.runtime.preferences.DefaultScope; |
18 |
import org.eclipse.core.runtime.preferences.IEclipsePreferences; |
19 |
import org.eclipse.core.runtime.preferences.IScopeContext; |
18 |
import org.eclipse.jface.dialogs.ControlEnableState; |
20 |
import org.eclipse.jface.dialogs.ControlEnableState; |
19 |
import org.eclipse.jface.resource.JFaceResources; |
21 |
import org.eclipse.jface.dialogs.IDialogSettings; |
|
|
22 |
import org.eclipse.jface.layout.GridDataFactory; |
20 |
import org.eclipse.swt.SWT; |
23 |
import org.eclipse.swt.SWT; |
|
|
24 |
import org.eclipse.swt.custom.ScrolledComposite; |
21 |
import org.eclipse.swt.events.SelectionAdapter; |
25 |
import org.eclipse.swt.events.SelectionAdapter; |
22 |
import org.eclipse.swt.events.SelectionEvent; |
26 |
import org.eclipse.swt.events.SelectionEvent; |
23 |
import org.eclipse.swt.graphics.Point; |
27 |
import org.eclipse.swt.graphics.Point; |
Lines 28-518
Link Here
|
28 |
import org.eclipse.swt.widgets.Composite; |
32 |
import org.eclipse.swt.widgets.Composite; |
29 |
import org.eclipse.swt.widgets.Control; |
33 |
import org.eclipse.swt.widgets.Control; |
30 |
import org.eclipse.swt.widgets.Group; |
34 |
import org.eclipse.swt.widgets.Group; |
31 |
import org.eclipse.swt.widgets.Label; |
35 |
import org.eclipse.ui.IWorkbench; |
32 |
import org.eclipse.ui.PlatformUI; |
36 |
import org.eclipse.wst.sse.core.internal.validate.ValidationMessage; |
33 |
import org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage; |
|
|
34 |
import org.eclipse.wst.xml.core.internal.XMLCorePlugin; |
37 |
import org.eclipse.wst.xml.core.internal.XMLCorePlugin; |
35 |
import org.eclipse.wst.xml.core.internal.preferences.XMLCorePreferenceNames; |
38 |
import org.eclipse.wst.xml.core.internal.preferences.XMLCorePreferenceNames; |
36 |
import org.eclipse.wst.xml.ui.internal.XMLUIMessages; |
39 |
import org.eclipse.wst.xml.ui.internal.XMLUIMessages; |
37 |
import org.eclipse.wst.xml.ui.internal.editor.IHelpContextIds; |
40 |
import org.eclipse.wst.xml.ui.internal.XMLUIPlugin; |
|
|
41 |
|
42 |
public class XMLValidatorPreferencePage extends AbstractValidationSettingsPage { |
43 |
private static final String SETTINGS_SECTION_NAME = "XMLValidationSeverities";//$NON-NLS-1$ |
44 |
|
45 |
boolean fOriginalUseXIncludeButtonSelected; |
46 |
|
47 |
boolean fOriginalUseHonourAllButtonSelected; |
48 |
|
49 |
boolean fOriginalUseExtendedMarkupValidation; |
50 |
|
51 |
private Combo fIndicateNoGrammar = null; |
52 |
|
53 |
private Button fHonourAllSchemaLocations = null; |
54 |
|
55 |
private Button fUseXinclude = null; |
56 |
|
57 |
private Button fExtendedMarkupValidation; |
58 |
|
59 |
private Combo fMissingStartTag; |
60 |
|
61 |
private Combo fMissingEndTag; |
62 |
|
63 |
private Combo fMissingTagName; |
64 |
|
65 |
private Combo fEmptyElementTag; |
66 |
|
67 |
private Combo fEndTagWithAttributes; |
68 |
|
69 |
private Combo fInvalidWhitespaceBeforeTagname; |
70 |
|
71 |
private Combo fMissingClosingBracket; |
72 |
|
73 |
private Combo fMissingClosingQuote; |
74 |
|
75 |
|
76 |
private Combo fMissingQuotes; |
77 |
|
78 |
private Combo fInvalidNamespaceInPI; |
79 |
|
80 |
|
81 |
private Combo fInvalidWhitespaceAtStart; |
82 |
|
83 |
private Group fMarkupValidationGroup; |
84 |
private ControlEnableState fMarkupState; |
85 |
|
86 |
|
87 |
private static final int[] XML_SEVERITIES = { ValidationMessage.WARNING, |
88 |
ValidationMessage.ERROR, ValidationMessage.IGNORE }; |
89 |
|
90 |
private static final String[] MARKUP_SEVERITIES = { |
91 |
XMLUIMessages.Severity_error, XMLUIMessages.Severity_warning, |
92 |
XMLUIMessages.Severity_ignore }; |
93 |
|
94 |
protected void createContentsForValidatingGroup(Composite validatingGroup) { |
95 |
int nColumns = 3; |
96 |
|
97 |
GridLayout layout = new GridLayout(nColumns, false); |
98 |
layout.marginHeight = 0; |
99 |
layout.marginWidth = 0; |
100 |
validatingGroup.setLayout(layout); |
101 |
|
102 |
if (fIndicateNoGrammar == null) |
103 |
fIndicateNoGrammar = addComboBox(validatingGroup, |
104 |
XMLUIMessages.Indicate_no_grammar_specified, |
105 |
XMLCorePreferenceNames.INDICATE_NO_GRAMMAR, XML_SEVERITIES, |
106 |
MARKUP_SEVERITIES, 0); |
107 |
|
108 |
if (fUseXinclude == null) { |
109 |
fUseXinclude = createCheckBox(validatingGroup, |
110 |
XMLUIMessages.Use_XInclude); |
111 |
((GridData) fUseXinclude.getLayoutData()).horizontalSpan = 2; |
112 |
} |
113 |
|
114 |
if (fHonourAllSchemaLocations == null) { |
115 |
fHonourAllSchemaLocations = createCheckBox(validatingGroup, |
116 |
XMLUIMessages.Honour_all_schema_locations); |
117 |
((GridData) fHonourAllSchemaLocations.getLayoutData()).horizontalSpan = 2; |
118 |
} |
119 |
|
120 |
IScopeContext[] contexts = createPreferenceScopes(); |
121 |
fOriginalUseXIncludeButtonSelected = contexts[0].getNode(getPreferenceNodeQualifier()).getBoolean( |
122 |
XMLCorePreferenceNames.USE_XINCLUDE, true); |
123 |
|
124 |
if (fUseXinclude != null) { |
125 |
fUseXinclude.setSelection(fOriginalUseXIncludeButtonSelected); |
126 |
} |
127 |
fOriginalUseHonourAllButtonSelected = contexts[0].getNode(getPreferenceNodeQualifier()).getBoolean( |
128 |
XMLCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS, true); |
129 |
if (fHonourAllSchemaLocations != null) { |
130 |
fHonourAllSchemaLocations.setSelection(fOriginalUseHonourAllButtonSelected); |
131 |
} |
132 |
|
133 |
} |
134 |
|
135 |
private void handleMarkupSeveritySelection(boolean selection) { |
136 |
if(selection) { |
137 |
if(fMarkupState != null) { |
138 |
fMarkupState.restore(); |
139 |
fMarkupState = null; |
140 |
} |
141 |
} |
142 |
else { |
143 |
if(fMarkupState == null) |
144 |
fMarkupState = ControlEnableState.disable(fMarkupValidationGroup); |
145 |
} |
146 |
} |
147 |
|
148 |
|
149 |
protected void createContentsForMarkupValidationGroup(Composite parent) { |
150 |
|
151 |
IScopeContext[] contexts = createPreferenceScopes(); |
152 |
|
153 |
fOriginalUseExtendedMarkupValidation = contexts[0].getNode(getPreferenceNodeQualifier()).getBoolean( |
154 |
XMLCorePreferenceNames.MARKUP_VALIDATION, false); |
155 |
fExtendedMarkupValidation = createCheckBox(parent, |
156 |
XMLUIMessages.MarkupValidation_files); |
157 |
|
158 |
((GridData) fExtendedMarkupValidation.getLayoutData()).horizontalSpan = 2; |
159 |
fExtendedMarkupValidation.setSelection(fOriginalUseExtendedMarkupValidation); |
160 |
|
161 |
fExtendedMarkupValidation |
162 |
.addSelectionListener(new SelectionAdapter() { |
163 |
public void widgetSelected(SelectionEvent e) { |
164 |
handleMarkupSeveritySelection(fExtendedMarkupValidation |
165 |
.getSelection()); |
166 |
} |
167 |
}); |
168 |
|
169 |
fMarkupValidationGroup = createGroup(parent, 3); |
170 |
((GridLayout) fMarkupValidationGroup.getLayout()).makeColumnsEqualWidth = false; |
171 |
fMarkupValidationGroup |
172 |
.setText(XMLUIMessages.MarkupValidation_files_label); |
173 |
GridLayout layout = new GridLayout(3, false); |
174 |
layout.marginHeight = 0; |
175 |
layout.marginWidth = 0; |
176 |
fMarkupValidationGroup.setLayout(layout); |
177 |
|
178 |
|
179 |
if (fMissingStartTag == null) |
180 |
fMissingStartTag = addComboBox(fMarkupValidationGroup, |
181 |
XMLUIMessages.Missing_start_tag, |
182 |
XMLCorePreferenceNames.MISSING_START_TAG, XML_SEVERITIES, |
183 |
MARKUP_SEVERITIES, 0); |
184 |
if (fMissingEndTag == null) |
185 |
fMissingEndTag = addComboBox(fMarkupValidationGroup, |
186 |
XMLUIMessages.Missing_end_tag, |
187 |
XMLCorePreferenceNames.MISSING_END_TAG, XML_SEVERITIES, |
188 |
MARKUP_SEVERITIES, 0); |
189 |
if (fMissingTagName == null) |
190 |
fMissingTagName = addComboBox(fMarkupValidationGroup, |
191 |
XMLUIMessages.Tag_name_missing, |
192 |
XMLCorePreferenceNames.MISSING_TAG_NAME, XML_SEVERITIES, |
193 |
MARKUP_SEVERITIES, 0); |
194 |
if (fMissingQuotes == null) |
195 |
fMissingQuotes = addComboBox(fMarkupValidationGroup, |
196 |
XMLUIMessages.Missing_quotes, |
197 |
XMLCorePreferenceNames.MISSING_QUOTES, XML_SEVERITIES, |
198 |
MARKUP_SEVERITIES, 0); |
199 |
if (fMissingClosingBracket == null) |
200 |
fMissingClosingBracket = addComboBox(fMarkupValidationGroup, |
201 |
XMLUIMessages.Missing_closing_bracket, |
202 |
XMLCorePreferenceNames.MISSING_CLOSING_BRACKET, |
203 |
XML_SEVERITIES, MARKUP_SEVERITIES, 0); |
204 |
if (fMissingClosingQuote == null) |
205 |
fMissingClosingQuote = addComboBox(fMarkupValidationGroup, |
206 |
XMLUIMessages.Missing_closing_quote, |
207 |
XMLCorePreferenceNames.MISSING_CLOSING_QUOTE, |
208 |
XML_SEVERITIES, MARKUP_SEVERITIES, 0); |
209 |
if (fEmptyElementTag == null) |
210 |
fEmptyElementTag = addComboBox(fMarkupValidationGroup, |
211 |
XMLUIMessages.Empty_element_tag, |
212 |
XMLCorePreferenceNames.ATTRIBUTE_HAS_NO_VALUE, |
213 |
XML_SEVERITIES, MARKUP_SEVERITIES, 0); |
214 |
if (fEndTagWithAttributes == null) |
215 |
fEndTagWithAttributes = addComboBox(fMarkupValidationGroup, |
216 |
XMLUIMessages.End_tag_with_attributes, |
217 |
XMLCorePreferenceNames.END_TAG_WITH_ATTRIBUTES, |
218 |
XML_SEVERITIES, MARKUP_SEVERITIES, 0); |
219 |
if (fInvalidWhitespaceBeforeTagname == null) |
220 |
fInvalidWhitespaceBeforeTagname = addComboBox( |
221 |
fMarkupValidationGroup, |
222 |
XMLUIMessages.Invalid_whitespace_before_tagname, |
223 |
XMLCorePreferenceNames.WHITESPACE_BEFORE_TAGNAME, |
224 |
XML_SEVERITIES, MARKUP_SEVERITIES, 0); |
225 |
if (fInvalidNamespaceInPI == null) |
226 |
fInvalidNamespaceInPI = addComboBox(fMarkupValidationGroup, |
227 |
XMLUIMessages.Namespace_in_pi_target, |
228 |
XMLCorePreferenceNames.NAMESPACE_IN_PI_TARGET, |
229 |
XML_SEVERITIES, MARKUP_SEVERITIES, 0); |
230 |
if (fInvalidWhitespaceAtStart == null) |
231 |
fInvalidWhitespaceAtStart = addComboBox(fMarkupValidationGroup, |
232 |
XMLUIMessages.Whitespace_at_start, |
233 |
XMLCorePreferenceNames.WHITESPACE_AT_START, XML_SEVERITIES, |
234 |
MARKUP_SEVERITIES, 0); |
235 |
|
236 |
|
237 |
handleMarkupSeveritySelection(fOriginalUseExtendedMarkupValidation); |
238 |
|
239 |
} |
240 |
|
241 |
|
242 |
protected void performDefaultsForValidatingGroup() { |
243 |
IEclipsePreferences modelPreferences = new DefaultScope() |
244 |
.getNode(getPreferenceNodeQualifier()); |
245 |
boolean useXIncludeButtonSelected = modelPreferences.getBoolean( |
246 |
XMLCorePreferenceNames.USE_XINCLUDE, true); |
247 |
|
248 |
if (fUseXinclude != null) { |
249 |
fUseXinclude.setSelection(useXIncludeButtonSelected); |
250 |
} |
251 |
boolean useHonourAllButtonSelected = modelPreferences.getBoolean( |
252 |
XMLCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS, true); |
253 |
if (fHonourAllSchemaLocations != null) { |
254 |
fHonourAllSchemaLocations.setSelection(useHonourAllButtonSelected); |
255 |
} |
256 |
} |
257 |
|
258 |
protected void performDefaultsForMarkupValidationGroup() { |
259 |
|
260 |
IEclipsePreferences modelPreferences = new DefaultScope() |
261 |
.getNode(getPreferenceNodeQualifier()); |
262 |
boolean useExtendedMarkupValidation = modelPreferences.getBoolean( |
263 |
XMLCorePreferenceNames.MARKUP_VALIDATION, false); |
264 |
|
265 |
if (fExtendedMarkupValidation != null) { |
266 |
if (fExtendedMarkupValidation.getSelection() != useExtendedMarkupValidation) { |
267 |
handleMarkupSeveritySelection(useExtendedMarkupValidation); |
268 |
} |
269 |
fExtendedMarkupValidation.setSelection(useExtendedMarkupValidation); |
270 |
|
271 |
} |
272 |
|
273 |
|
274 |
} |
38 |
|
275 |
|
|
|
276 |
protected void storeValuesForValidatingGroup(IScopeContext[] contexts) { |
277 |
|
278 |
if (fUseXinclude != null) { |
279 |
boolean useXIncludeButtonSelected = fUseXinclude.getSelection(); |
280 |
contexts[0].getNode(getPreferenceNodeQualifier()).putBoolean( |
281 |
XMLCorePreferenceNames.USE_XINCLUDE, |
282 |
useXIncludeButtonSelected); |
283 |
} |
284 |
if (fHonourAllSchemaLocations != null) { |
285 |
boolean honourAllButtonSelected = fHonourAllSchemaLocations |
286 |
.getSelection(); |
287 |
contexts[0].getNode(getPreferenceNodeQualifier()).putBoolean( |
288 |
XMLCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS, |
289 |
honourAllButtonSelected); |
290 |
} |
291 |
} |
292 |
|
293 |
protected void storeValuesForMarkupValidationGroup(IScopeContext[] contexts) { |
294 |
if (fExtendedMarkupValidation != null) { |
295 |
boolean extendedMarkupValidation = fExtendedMarkupValidation |
296 |
.getSelection(); |
297 |
contexts[0].getNode(getPreferenceNodeQualifier()).putBoolean( |
298 |
XMLCorePreferenceNames.MARKUP_VALIDATION, |
299 |
extendedMarkupValidation); |
300 |
} |
301 |
|
302 |
|
303 |
} |
304 |
|
305 |
protected void performDefaults() { |
306 |
resetSeverities(); |
307 |
performDefaultsForValidatingGroup(); |
308 |
performDefaultsForMarkupValidationGroup(); |
309 |
super.performDefaults(); |
310 |
} |
311 |
|
312 |
protected Preferences getModelPreferences() { |
313 |
return XMLCorePlugin.getDefault().getPluginPreferences(); |
314 |
} |
39 |
|
315 |
|
40 |
public class XMLValidatorPreferencePage extends AbstractPreferencePage { |
316 |
protected void doSavePreferenceStore() { |
41 |
private Combo fIndicateNoGrammar; |
317 |
XMLCorePlugin.getDefault().savePluginPreferences(); // model |
42 |
|
318 |
} |
43 |
private Button fHonourAllSchemaLocations; |
|
|
44 |
|
45 |
private Button fUseXinclude; |
46 |
|
47 |
private Button fExtendedMarkupValidation; |
48 |
|
49 |
private Combo fEmptyElementTag; |
50 |
|
51 |
private Combo fEndTagWithAttributes; |
52 |
|
53 |
private Combo fInvalidWhitespaceBeforeTagname; |
54 |
|
55 |
private Combo fMissingClosingBracket; |
56 |
|
57 |
private Combo fMissingClosingQuote; |
58 |
|
59 |
private Combo fMissingEndTag; |
60 |
|
61 |
private Combo fMissingStartTag; |
62 |
|
63 |
private Combo fMissingQuotes; |
64 |
|
65 |
private Combo fInvalidNamespaceInPI; |
66 |
|
67 |
private Combo fMissingTagName; |
68 |
|
69 |
private Combo fInvalidWhitespaceAtStart; |
70 |
|
71 |
private Group fMarkupValidationGroup; |
72 |
private ControlEnableState fMarkupState; |
73 |
|
74 |
private static final String[] SEVERITIES = {XMLUIMessages.Indicate_no_grammar_specified_severities_error, XMLUIMessages.Indicate_no_grammar_specified_severities_warning, XMLUIMessages.Indicate_no_grammar_specified_severities_ignore}; |
75 |
private static final String[] MARKUP_SEVERITIES = {XMLUIMessages.Severity_error, XMLUIMessages.Severity_warning, XMLUIMessages.Severity_ignore}; |
76 |
|
77 |
protected Control createContents(Composite parent) { |
78 |
Composite composite = (Composite)super.createContents(parent); |
79 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.XML_PREFWEBX_VALIDATOR_HELPID); |
80 |
createContentsForValidatingGroup(composite); |
81 |
createContentsForMarkupValidationGroup(composite); |
82 |
setSize(composite); |
83 |
loadPreferences(); |
84 |
|
85 |
return composite; |
86 |
} |
87 |
|
88 |
protected void createContentsForValidatingGroup(Composite parent) { |
89 |
Group validatingGroup = createGroup(parent, 2); |
90 |
((GridLayout)validatingGroup.getLayout()).makeColumnsEqualWidth = false; |
91 |
validatingGroup.setText(XMLUIMessages.Validating_files); |
92 |
|
93 |
if (fIndicateNoGrammar == null) { |
94 |
createLabel(validatingGroup, XMLUIMessages.Indicate_no_grammar_specified); |
95 |
fIndicateNoGrammar = createCombo(validatingGroup, SEVERITIES); |
96 |
} |
97 |
if (fUseXinclude == null) { |
98 |
fUseXinclude = createCheckBox(validatingGroup, XMLUIMessages.Use_XInclude); |
99 |
((GridData)fUseXinclude.getLayoutData()).horizontalSpan = 2; |
100 |
} |
101 |
if (fHonourAllSchemaLocations == null) { |
102 |
fHonourAllSchemaLocations = createCheckBox(validatingGroup, XMLUIMessages.Honour_all_schema_locations); |
103 |
((GridData)fHonourAllSchemaLocations.getLayoutData()).horizontalSpan = 2; |
104 |
} |
105 |
} |
106 |
private void handleMarkupSeveritySelection(boolean selection){ |
107 |
if (selection) { |
108 |
fMarkupState.restore(); |
109 |
} |
110 |
else { |
111 |
fMarkupState = ControlEnableState.disable(fMarkupValidationGroup); |
112 |
} |
113 |
} |
114 |
|
115 |
protected void createContentsForMarkupValidationGroup(Composite parent) { |
116 |
|
117 |
if (fExtendedMarkupValidation == null) { |
118 |
fExtendedMarkupValidation = createCheckBox(parent, XMLUIMessages.MarkupValidation_files); |
119 |
((GridData)fExtendedMarkupValidation.getLayoutData()).horizontalSpan = 2; |
120 |
fExtendedMarkupValidation.addSelectionListener(new SelectionAdapter() { |
121 |
public void widgetSelected(SelectionEvent e) { |
122 |
handleMarkupSeveritySelection(fExtendedMarkupValidation.getSelection()); |
123 |
} |
124 |
}); |
125 |
} |
126 |
fMarkupValidationGroup = createGroup(parent, 3); |
127 |
((GridLayout)fMarkupValidationGroup.getLayout()).makeColumnsEqualWidth = false; |
128 |
fMarkupValidationGroup.setText(XMLUIMessages.MarkupValidation_files_label); |
129 |
|
130 |
if (fMissingStartTag == null) { |
131 |
fMissingStartTag = createMarkupCombo(fMarkupValidationGroup, XMLUIMessages.Missing_start_tag, MARKUP_SEVERITIES); |
132 |
} |
133 |
if (fMissingEndTag == null) { |
134 |
fMissingEndTag = createMarkupCombo(fMarkupValidationGroup, XMLUIMessages.Missing_end_tag, MARKUP_SEVERITIES); |
135 |
} |
136 |
if (fMissingTagName == null) { |
137 |
fMissingTagName = createMarkupCombo(fMarkupValidationGroup, XMLUIMessages.Tag_name_missing, MARKUP_SEVERITIES); |
138 |
} |
139 |
if (fMissingQuotes == null) { |
140 |
fMissingQuotes = createMarkupCombo(fMarkupValidationGroup, XMLUIMessages.Missing_quotes, MARKUP_SEVERITIES); |
141 |
} |
142 |
if (fMissingClosingBracket == null) { |
143 |
fMissingClosingBracket = createMarkupCombo(fMarkupValidationGroup, XMLUIMessages.Missing_closing_bracket, MARKUP_SEVERITIES); |
144 |
} |
145 |
if (fMissingClosingQuote == null) { |
146 |
fMissingClosingQuote = createMarkupCombo(fMarkupValidationGroup, XMLUIMessages.Missing_closing_quote, MARKUP_SEVERITIES); |
147 |
} |
148 |
if (fEmptyElementTag == null) { |
149 |
fEmptyElementTag = createMarkupCombo(fMarkupValidationGroup, XMLUIMessages.Empty_element_tag, MARKUP_SEVERITIES); |
150 |
} |
151 |
if (fEndTagWithAttributes == null) { |
152 |
fEndTagWithAttributes = createMarkupCombo(fMarkupValidationGroup, XMLUIMessages.End_tag_with_attributes, MARKUP_SEVERITIES); |
153 |
} |
154 |
if (fInvalidWhitespaceBeforeTagname == null) { |
155 |
fInvalidWhitespaceBeforeTagname = createMarkupCombo(fMarkupValidationGroup, XMLUIMessages.Invalid_whitespace_before_tagname, MARKUP_SEVERITIES); |
156 |
} |
157 |
if (fInvalidNamespaceInPI == null) { |
158 |
fInvalidNamespaceInPI = createMarkupCombo(fMarkupValidationGroup, XMLUIMessages.Namespace_in_pi_target, MARKUP_SEVERITIES); |
159 |
} |
160 |
if (fInvalidWhitespaceAtStart == null) { |
161 |
fInvalidWhitespaceAtStart = createMarkupCombo(fMarkupValidationGroup, XMLUIMessages.Whitespace_at_start, MARKUP_SEVERITIES); |
162 |
} |
163 |
|
164 |
} |
165 |
|
166 |
/** |
167 |
* @param parent |
168 |
* @return |
169 |
*/ |
170 |
private Combo createCombo(Composite parent, String[] items) { |
171 |
Combo combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY); |
172 |
combo.setItems(items); |
173 |
|
174 |
//GridData |
175 |
GridData data = new GridData(SWT.FILL, SWT.CENTER, true, true); |
176 |
combo.setLayoutData(data); |
177 |
|
178 |
return combo; |
179 |
} |
180 |
|
181 |
private Combo createMarkupCombo(Composite parent, String text, String[] items) { |
182 |
Label label = new Label(parent, SWT.LEFT); |
183 |
GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1); |
184 |
label.setFont(JFaceResources.getDialogFont()); |
185 |
label.setText(text); |
186 |
label.setLayoutData(gd); |
187 |
|
188 |
Combo combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY); |
189 |
combo.setItems(items); |
190 |
|
191 |
//GridData |
192 |
// GridData data = new GridData(SWT.FILL, SWT.CENTER, false, true); |
193 |
combo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); |
194 |
|
195 |
return combo; |
196 |
} |
197 |
|
198 |
protected void initializeValues() { |
199 |
initializeValuesForValidatingGroup(); |
200 |
initializeValuesForMarkupValidationGroup(); |
201 |
} |
202 |
|
203 |
protected void initializeValuesForValidatingGroup() { |
204 |
Preferences modelPreferences = getModelPreferences(); |
205 |
int indicateNoGrammarButtonSelected = modelPreferences.getInt(XMLCorePreferenceNames.INDICATE_NO_GRAMMAR); |
206 |
boolean useXIncludeButtonSelected = modelPreferences.getBoolean(XMLCorePreferenceNames.USE_XINCLUDE); |
207 |
|
208 |
if (fIndicateNoGrammar != null) { |
209 |
fIndicateNoGrammar.select(2 - indicateNoGrammarButtonSelected); |
210 |
fIndicateNoGrammar.setText(SEVERITIES[2 - indicateNoGrammarButtonSelected]); |
211 |
} |
212 |
if (fUseXinclude != null) { |
213 |
fUseXinclude.setSelection(useXIncludeButtonSelected); |
214 |
} |
215 |
|
216 |
boolean honourAllSelected = modelPreferences.getBoolean(XMLCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS); |
217 |
if (fHonourAllSchemaLocations != null) { |
218 |
fHonourAllSchemaLocations.setSelection(honourAllSelected); |
219 |
} |
220 |
} |
221 |
|
222 |
protected void initializeValuesForMarkupValidationGroup() { |
223 |
Preferences modelPreferences = getModelPreferences(); |
224 |
boolean useExtendedMarkupValidation = modelPreferences.getBoolean(XMLCorePreferenceNames.MARKUP_VALIDATION); |
225 |
|
226 |
|
227 |
if (fExtendedMarkupValidation != null) { |
228 |
fExtendedMarkupValidation.setSelection(useExtendedMarkupValidation); |
229 |
} |
230 |
int emptyElementTag = modelPreferences.getInt(XMLCorePreferenceNames.ATTRIBUTE_HAS_NO_VALUE); |
231 |
|
232 |
if (fEmptyElementTag != null) { |
233 |
fEmptyElementTag.select(2 - emptyElementTag); |
234 |
fEmptyElementTag.setText(MARKUP_SEVERITIES[2 - emptyElementTag]); |
235 |
} |
236 |
|
237 |
int endTagWithAttributes = modelPreferences.getInt(XMLCorePreferenceNames.END_TAG_WITH_ATTRIBUTES); |
238 |
|
239 |
if (fEndTagWithAttributes != null) { |
240 |
fEndTagWithAttributes.select(2 - endTagWithAttributes); |
241 |
fEndTagWithAttributes.setText(MARKUP_SEVERITIES[2 - endTagWithAttributes]); |
242 |
} |
243 |
|
244 |
int invalidWhitespaceBeforeTagname = modelPreferences.getInt(XMLCorePreferenceNames.WHITESPACE_BEFORE_TAGNAME); |
245 |
|
246 |
if (fInvalidWhitespaceBeforeTagname != null) { |
247 |
fInvalidWhitespaceBeforeTagname.select(2 - invalidWhitespaceBeforeTagname); |
248 |
fInvalidWhitespaceBeforeTagname.setText(MARKUP_SEVERITIES[2 - invalidWhitespaceBeforeTagname]); |
249 |
} |
250 |
|
251 |
int missingClosingBracket = modelPreferences.getInt(XMLCorePreferenceNames.MISSING_CLOSING_BRACKET); |
252 |
|
253 |
if (fMissingClosingBracket != null) { |
254 |
fMissingClosingBracket.select(2 - missingClosingBracket); |
255 |
fMissingClosingBracket.setText(MARKUP_SEVERITIES[2 - missingClosingBracket]); |
256 |
} |
257 |
|
258 |
int missingClosingQuote = modelPreferences.getInt(XMLCorePreferenceNames.MISSING_CLOSING_QUOTE); |
259 |
|
260 |
if (fMissingClosingQuote != null) { |
261 |
fMissingClosingQuote.select(2 - missingClosingQuote); |
262 |
fMissingClosingQuote.setText(MARKUP_SEVERITIES[2 - missingClosingQuote]); |
263 |
} |
264 |
|
265 |
int missingEndTag = modelPreferences.getInt(XMLCorePreferenceNames.MISSING_END_TAG); |
266 |
|
267 |
if (fMissingEndTag != null) { |
268 |
fMissingEndTag.select(2 - missingEndTag); |
269 |
fMissingEndTag.setText(MARKUP_SEVERITIES[2 - missingEndTag]); |
270 |
} |
271 |
|
272 |
int missingStartTag = modelPreferences.getInt(XMLCorePreferenceNames.MISSING_START_TAG); |
273 |
|
274 |
if (fMissingStartTag != null) { |
275 |
fMissingStartTag.select(2 - missingStartTag); |
276 |
fMissingStartTag.setText(MARKUP_SEVERITIES[2 - missingStartTag]); |
277 |
} |
278 |
|
279 |
int missingQuotes = modelPreferences.getInt(XMLCorePreferenceNames.MISSING_QUOTES); |
280 |
|
281 |
if (fMissingQuotes != null) { |
282 |
fMissingQuotes.select(2 - missingQuotes); |
283 |
fMissingQuotes.setText(MARKUP_SEVERITIES[2 - missingQuotes]); |
284 |
} |
285 |
|
286 |
int invalidNamespaceInPI = modelPreferences.getInt(XMLCorePreferenceNames.NAMESPACE_IN_PI_TARGET); |
287 |
|
288 |
if (fInvalidNamespaceInPI != null) { |
289 |
fInvalidNamespaceInPI.select(2 - invalidNamespaceInPI); |
290 |
fInvalidNamespaceInPI.setText(MARKUP_SEVERITIES[2 - invalidNamespaceInPI]); |
291 |
} |
292 |
|
293 |
int tagNameMissing = modelPreferences.getInt(XMLCorePreferenceNames.MISSING_TAG_NAME); |
294 |
|
295 |
if (fMissingTagName != null) { |
296 |
fMissingTagName.select(2 - tagNameMissing); |
297 |
fMissingTagName.setText(MARKUP_SEVERITIES[2 - tagNameMissing]); |
298 |
} |
299 |
|
300 |
int invalidWhitespaceAtStart = modelPreferences.getInt(XMLCorePreferenceNames.WHITESPACE_AT_START); |
301 |
|
302 |
if (fInvalidWhitespaceAtStart != null) { |
303 |
fInvalidWhitespaceAtStart.select(2 - invalidWhitespaceAtStart); |
304 |
fInvalidWhitespaceAtStart.setText(MARKUP_SEVERITIES[2 - invalidWhitespaceAtStart]); |
305 |
} |
306 |
|
307 |
if (!useExtendedMarkupValidation) |
308 |
fMarkupState = ControlEnableState.disable(fMarkupValidationGroup); |
309 |
} |
310 |
|
311 |
protected void performDefaultsForValidatingGroup() { |
312 |
Preferences modelPreferences = getModelPreferences(); |
313 |
int indicateNoGrammarButtonSelected = modelPreferences.getDefaultInt(XMLCorePreferenceNames.INDICATE_NO_GRAMMAR); |
314 |
boolean useXIncludeButtonSelected = modelPreferences.getDefaultBoolean(XMLCorePreferenceNames.USE_XINCLUDE); |
315 |
|
316 |
if (fIndicateNoGrammar != null) { |
317 |
fIndicateNoGrammar.setSelection(new Point(indicateNoGrammarButtonSelected, 2 - indicateNoGrammarButtonSelected)); |
318 |
fIndicateNoGrammar.setText(SEVERITIES[indicateNoGrammarButtonSelected]); |
319 |
} |
320 |
if (fUseXinclude != null) { |
321 |
fUseXinclude.setSelection(useXIncludeButtonSelected); |
322 |
} |
323 |
|
324 |
boolean honourAllButtonSelected = modelPreferences.getDefaultBoolean(XMLCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS); |
325 |
if (fHonourAllSchemaLocations != null) { |
326 |
fHonourAllSchemaLocations.setSelection(honourAllButtonSelected); |
327 |
} |
328 |
} |
329 |
|
330 |
protected void performDefaultsForMarkupValidationGroup() { |
331 |
Preferences modelPreferences = getModelPreferences(); |
332 |
boolean useExtendedMarkupValidation = modelPreferences.getDefaultBoolean(XMLCorePreferenceNames.MARKUP_VALIDATION); |
333 |
|
334 |
|
335 |
if (fExtendedMarkupValidation != null) { |
336 |
if (fExtendedMarkupValidation.getSelection() != useExtendedMarkupValidation) { |
337 |
handleMarkupSeveritySelection(useExtendedMarkupValidation); |
338 |
} |
339 |
fExtendedMarkupValidation.setSelection(useExtendedMarkupValidation); |
340 |
|
341 |
} |
342 |
int emptyElementTag = modelPreferences.getDefaultInt(XMLCorePreferenceNames.ATTRIBUTE_HAS_NO_VALUE); |
343 |
|
344 |
if (fEmptyElementTag != null) { |
345 |
fEmptyElementTag.setSelection(new Point(emptyElementTag,2 - emptyElementTag)); |
346 |
fEmptyElementTag.setText(MARKUP_SEVERITIES[2 - emptyElementTag]); |
347 |
} |
348 |
|
349 |
int endTagWithAttributes = modelPreferences.getDefaultInt(XMLCorePreferenceNames.END_TAG_WITH_ATTRIBUTES); |
350 |
|
351 |
if (fEndTagWithAttributes != null) { |
352 |
fEndTagWithAttributes.setSelection(new Point(endTagWithAttributes,2 - endTagWithAttributes)); |
353 |
fEndTagWithAttributes.setText(MARKUP_SEVERITIES[2 - endTagWithAttributes]); |
354 |
} |
355 |
|
356 |
int invalidWhitespaceBeforeTagname = modelPreferences.getDefaultInt(XMLCorePreferenceNames.WHITESPACE_BEFORE_TAGNAME); |
357 |
|
358 |
if (fInvalidWhitespaceBeforeTagname != null) { |
359 |
fInvalidWhitespaceBeforeTagname.setSelection(new Point(invalidWhitespaceBeforeTagname,2 - invalidWhitespaceBeforeTagname)); |
360 |
fInvalidWhitespaceBeforeTagname.setText(MARKUP_SEVERITIES[2 - invalidWhitespaceBeforeTagname]); |
361 |
} |
362 |
|
363 |
int missingClosingBracket = modelPreferences.getDefaultInt(XMLCorePreferenceNames.MISSING_CLOSING_BRACKET); |
364 |
|
365 |
if (fMissingClosingBracket != null) { |
366 |
fMissingClosingBracket.setSelection(new Point(missingClosingBracket,2 - missingClosingBracket)); |
367 |
fMissingClosingBracket.setText(MARKUP_SEVERITIES[2 - missingClosingBracket]); |
368 |
} |
369 |
|
370 |
int missingClosingQuote = modelPreferences.getDefaultInt(XMLCorePreferenceNames.MISSING_CLOSING_QUOTE); |
371 |
|
372 |
if (fMissingClosingQuote != null) { |
373 |
fMissingClosingQuote.setSelection(new Point(missingClosingQuote,2 - missingClosingQuote)); |
374 |
fMissingClosingQuote.setText(MARKUP_SEVERITIES[2 - missingClosingQuote]); |
375 |
} |
376 |
|
377 |
int missingEndTag = modelPreferences.getDefaultInt(XMLCorePreferenceNames.MISSING_END_TAG); |
378 |
|
379 |
if (fMissingEndTag != null) { |
380 |
fMissingEndTag.setSelection(new Point(missingEndTag,2 - missingEndTag)); |
381 |
fMissingEndTag.setText(MARKUP_SEVERITIES[2 - missingEndTag]); |
382 |
} |
383 |
|
384 |
int missingStartTag = modelPreferences.getDefaultInt(XMLCorePreferenceNames.MISSING_START_TAG); |
385 |
|
386 |
if (fMissingStartTag != null) { |
387 |
fMissingStartTag.setSelection(new Point(missingStartTag,2 - missingStartTag)); |
388 |
fMissingStartTag.setText(MARKUP_SEVERITIES[2 - missingStartTag]); |
389 |
} |
390 |
|
391 |
int missingQuotes = modelPreferences.getDefaultInt(XMLCorePreferenceNames.MISSING_QUOTES); |
392 |
|
393 |
if (fMissingQuotes != null) { |
394 |
fMissingQuotes.setSelection(new Point(missingQuotes,2 - missingQuotes)); |
395 |
fMissingQuotes.setText(MARKUP_SEVERITIES[2 - missingQuotes]); |
396 |
} |
397 |
|
398 |
int invalidNamespaceInPI = modelPreferences.getDefaultInt(XMLCorePreferenceNames.NAMESPACE_IN_PI_TARGET); |
399 |
|
400 |
if (fInvalidNamespaceInPI != null) { |
401 |
fInvalidNamespaceInPI.setSelection(new Point(invalidNamespaceInPI,2 - invalidNamespaceInPI)); |
402 |
fInvalidNamespaceInPI.setText(MARKUP_SEVERITIES[2 - invalidNamespaceInPI]); |
403 |
} |
404 |
|
405 |
int tagNameMissing = modelPreferences.getDefaultInt(XMLCorePreferenceNames.MISSING_TAG_NAME); |
406 |
|
407 |
if (fMissingTagName != null) { |
408 |
fMissingTagName.setSelection(new Point(tagNameMissing,2 - tagNameMissing)); |
409 |
fMissingTagName.setText(MARKUP_SEVERITIES[2 - tagNameMissing]); |
410 |
} |
411 |
|
412 |
int invalidWhitespaceAtStart = modelPreferences.getDefaultInt(XMLCorePreferenceNames.WHITESPACE_AT_START); |
413 |
|
414 |
if (fInvalidWhitespaceAtStart != null) { |
415 |
fInvalidWhitespaceAtStart.setSelection(new Point(invalidWhitespaceAtStart,2 - invalidWhitespaceAtStart)); |
416 |
fInvalidWhitespaceAtStart.setText(MARKUP_SEVERITIES[2 - invalidWhitespaceAtStart]); |
417 |
} |
418 |
} |
419 |
|
420 |
protected void storeValuesForValidatingGroup() |
421 |
{ |
422 |
Preferences modelPreferences = getModelPreferences(); |
423 |
if (fIndicateNoGrammar != null) { |
424 |
int warnNoGrammarButtonSelected = 2 - fIndicateNoGrammar.getSelectionIndex(); |
425 |
modelPreferences.setValue(XMLCorePreferenceNames.INDICATE_NO_GRAMMAR, warnNoGrammarButtonSelected); |
426 |
} |
427 |
if (fUseXinclude != null) { |
428 |
boolean useXIncludeButtonSelected = fUseXinclude.getSelection(); |
429 |
modelPreferences.setValue(XMLCorePreferenceNames.USE_XINCLUDE, useXIncludeButtonSelected); |
430 |
} |
431 |
if (fHonourAllSchemaLocations != null) { |
432 |
boolean honourAllButtonSelected = fHonourAllSchemaLocations.getSelection(); |
433 |
modelPreferences.setValue(XMLCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS, honourAllButtonSelected); |
434 |
} |
435 |
} |
436 |
protected void storeValuesForMarkupValidationGroup() |
437 |
{ |
438 |
Preferences modelPreferences = getModelPreferences(); |
439 |
if (fExtendedMarkupValidation != null) { |
440 |
boolean extendedMarkupValidation = fExtendedMarkupValidation.getSelection(); |
441 |
modelPreferences.setValue(XMLCorePreferenceNames.MARKUP_VALIDATION, extendedMarkupValidation); |
442 |
} |
443 |
if (fEmptyElementTag != null) { |
444 |
int emptyElementTag = 2 - fEmptyElementTag.getSelectionIndex(); |
445 |
modelPreferences.setValue(XMLCorePreferenceNames.ATTRIBUTE_HAS_NO_VALUE, emptyElementTag); |
446 |
} |
447 |
if (fEndTagWithAttributes != null) { |
448 |
int endTagWithAttributes = 2 - fEndTagWithAttributes.getSelectionIndex(); |
449 |
modelPreferences.setValue(XMLCorePreferenceNames.END_TAG_WITH_ATTRIBUTES, endTagWithAttributes); |
450 |
} |
451 |
if (fInvalidWhitespaceBeforeTagname != null) { |
452 |
int invalidWhitespaceBeforeTagname = 2 - fInvalidWhitespaceBeforeTagname.getSelectionIndex(); |
453 |
modelPreferences.setValue(XMLCorePreferenceNames.WHITESPACE_BEFORE_TAGNAME, invalidWhitespaceBeforeTagname); |
454 |
} |
455 |
if (fMissingClosingBracket != null) { |
456 |
int missingClosingBracket = 2 - fMissingClosingBracket.getSelectionIndex(); |
457 |
modelPreferences.setValue(XMLCorePreferenceNames.MISSING_CLOSING_BRACKET, missingClosingBracket); |
458 |
} |
459 |
if (fMissingClosingQuote != null) { |
460 |
int missingClosingQuote = 2 - fMissingClosingQuote.getSelectionIndex(); |
461 |
modelPreferences.setValue(XMLCorePreferenceNames.MISSING_CLOSING_BRACKET, missingClosingQuote); |
462 |
} |
463 |
if (fMissingEndTag != null) { |
464 |
int missingEndTag = 2 - fMissingEndTag.getSelectionIndex(); |
465 |
modelPreferences.setValue(XMLCorePreferenceNames.MISSING_END_TAG, missingEndTag); |
466 |
modelPreferences.getInt(XMLCorePreferenceNames.MISSING_END_TAG); |
467 |
} |
468 |
if (fMissingStartTag != null) { |
469 |
int missingStartTag = 2 - fMissingStartTag.getSelectionIndex(); |
470 |
modelPreferences.setValue(XMLCorePreferenceNames.MISSING_START_TAG, missingStartTag); |
471 |
} |
472 |
if (fMissingQuotes != null) { |
473 |
int missingQuotes = 2 - fMissingQuotes.getSelectionIndex(); |
474 |
modelPreferences.setValue(XMLCorePreferenceNames.MISSING_QUOTES, missingQuotes); |
475 |
} |
476 |
if (fInvalidNamespaceInPI != null) { |
477 |
int invalidNamespaceInPI = 2 - fInvalidNamespaceInPI.getSelectionIndex(); |
478 |
modelPreferences.setValue(XMLCorePreferenceNames.NAMESPACE_IN_PI_TARGET, invalidNamespaceInPI); |
479 |
} |
480 |
if (fMissingTagName != null) { |
481 |
int missingTagName = 2 - fMissingTagName.getSelectionIndex(); |
482 |
modelPreferences.setValue(XMLCorePreferenceNames.MISSING_TAG_NAME, missingTagName); |
483 |
} |
484 |
if (fInvalidWhitespaceAtStart != null) { |
485 |
int invalidWhitespaceAtStart = 2 - fInvalidWhitespaceAtStart.getSelectionIndex(); |
486 |
modelPreferences.setValue(XMLCorePreferenceNames.WHITESPACE_AT_START, invalidWhitespaceAtStart); |
487 |
} |
488 |
|
489 |
|
490 |
} |
491 |
|
492 |
protected void storeValues() { |
493 |
storeValuesForValidatingGroup(); |
494 |
storeValuesForMarkupValidationGroup(); |
495 |
} |
496 |
|
497 |
protected void performDefaults() { |
498 |
performDefaultsForValidatingGroup(); |
499 |
performDefaultsForMarkupValidationGroup(); |
500 |
super.performDefaults(); |
501 |
} |
502 |
|
503 |
protected Preferences getModelPreferences() { |
504 |
return XMLCorePlugin.getDefault().getPluginPreferences(); |
505 |
} |
506 |
|
507 |
protected void doSavePreferenceStore() { |
508 |
XMLCorePlugin.getDefault().savePluginPreferences(); // model |
509 |
} |
510 |
|
319 |
|
511 |
public boolean performOk() { |
320 |
protected void storeValues() { |
512 |
boolean result = super.performOk(); |
321 |
super.storeValues(); |
|
|
322 |
IScopeContext[] contexts = createPreferenceScopes(); |
323 |
|
324 |
storeValuesForValidatingGroup(contexts); |
325 |
storeValuesForMarkupValidationGroup(contexts); |
326 |
} |
327 |
protected Control createCommonContents(Composite parent) { |
328 |
final Composite page = new Composite(parent, SWT.NULL); |
513 |
|
329 |
|
514 |
doSavePreferenceStore(); |
330 |
GridLayout layout = new GridLayout(); |
|
|
331 |
layout.numColumns = 2; |
332 |
page.setLayout(layout); |
333 |
|
334 |
Group validatingGroup = new Group(page, SWT.NONE); |
335 |
validatingGroup.setLayoutData(GridDataFactory.fillDefaults() |
336 |
.grab(true, false).create()); |
337 |
validatingGroup.setLayout(new GridLayout(1, false)); |
338 |
validatingGroup.setText(XMLUIMessages.Validating_files); |
339 |
createContentsForValidatingGroup(validatingGroup); |
340 |
|
341 |
|
342 |
createContentsForMarkupValidationGroup(page); |
343 |
|
344 |
return page; |
345 |
} |
346 |
|
347 |
protected Composite createComposite(Composite parent, int numColumns) { |
348 |
Composite composite = new Composite(parent, SWT.NULL); |
349 |
|
350 |
// GridLayout |
351 |
GridLayout layout = new GridLayout(); |
352 |
layout.numColumns = numColumns; |
353 |
composite.setLayout(layout); |
354 |
|
355 |
// GridData |
356 |
GridData data = new GridData(GridData.FILL); |
357 |
data.horizontalIndent = 0; |
358 |
data.verticalAlignment = GridData.FILL; |
359 |
data.horizontalAlignment = GridData.FILL; |
360 |
composite.setLayoutData(data); |
361 |
|
362 |
return composite; |
363 |
} |
364 |
|
365 |
protected Composite createScrolledComposite(Composite parent) { |
366 |
// create scrollbars for this parent when needed |
367 |
final ScrolledComposite sc1 = new ScrolledComposite(parent, |
368 |
SWT.H_SCROLL | SWT.V_SCROLL); |
369 |
sc1.setLayoutData(new GridData(GridData.FILL_BOTH)); |
370 |
Composite composite = createComposite(sc1, 1); |
371 |
sc1.setContent(composite); |
372 |
|
373 |
// not calling setSize for composite will result in a blank composite, |
374 |
// so calling it here initially |
375 |
// setSize actually needs to be called after all controls are created, |
376 |
// so scrolledComposite |
377 |
// has correct minSize |
378 |
setSize(composite); |
379 |
return composite; |
380 |
} |
381 |
|
382 |
protected void setSize(Composite composite) { |
383 |
if (composite != null) { |
384 |
// Note: The font is set here in anticipation that the class |
385 |
// inheriting |
386 |
// this base class may add widgets to the dialog. setSize |
387 |
// is assumed to be called just before we go live. |
388 |
applyDialogFont(composite); |
389 |
Point minSize = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT); |
390 |
composite.setSize(minSize); |
391 |
// set scrollbar composite's min size so page is expandable but |
392 |
// has scrollbars when needed |
393 |
if (composite.getParent() instanceof ScrolledComposite) { |
394 |
ScrolledComposite sc1 = (ScrolledComposite) composite |
395 |
.getParent(); |
396 |
sc1.setMinSize(minSize); |
397 |
sc1.setExpandHorizontal(true); |
398 |
sc1.setExpandVertical(true); |
399 |
} |
400 |
} |
401 |
} |
402 |
|
403 |
protected String getPreferenceNodeQualifier() { |
404 |
return XMLCorePlugin.getDefault().getBundle().getSymbolicName(); |
405 |
} |
515 |
|
406 |
|
516 |
return result; |
407 |
protected String getPreferencePageID() { |
517 |
} |
408 |
return "org.eclipse.wst.sse.ui.preferences.xml.validation";//$NON-NLS-1$ |
|
|
409 |
} |
410 |
|
411 |
protected String getProjectSettingsKey() { |
412 |
return XMLCorePreferenceNames.USE_PROJECT_SETTINGS; |
413 |
} |
414 |
|
415 |
protected String getPropertyPageID() { |
416 |
return "org.eclipse.wst.xml.ui.propertyPage.project.validation";//$NON-NLS-1$ |
417 |
} |
418 |
|
419 |
public void init(IWorkbench workbench) { |
420 |
} |
421 |
|
422 |
private Group createGroup(Composite parent, int numColumns) { |
423 |
|
424 |
Group group = new Group(parent, SWT.NULL); |
425 |
|
426 |
// GridLayout |
427 |
GridLayout layout = new GridLayout(); |
428 |
layout.numColumns = numColumns; |
429 |
group.setLayout(layout); |
430 |
|
431 |
// GridData |
432 |
GridData data = new GridData(GridData.FILL); |
433 |
data.horizontalIndent = 0; |
434 |
data.verticalAlignment = GridData.FILL; |
435 |
data.horizontalAlignment = GridData.FILL; |
436 |
data.grabExcessHorizontalSpace = true; |
437 |
group.setLayoutData(data); |
438 |
|
439 |
return group; |
440 |
} |
441 |
|
442 |
|
443 |
|
444 |
private Button createCheckBox(Composite group, String label) { |
445 |
Button button = new Button(group, SWT.CHECK | SWT.LEFT); |
446 |
button.setText(label); |
447 |
|
448 |
// button.setLayoutData(GridDataFactory.fillDefaults().create()); |
449 |
|
450 |
// GridData |
451 |
GridData data = new GridData(GridData.FILL); |
452 |
data.verticalAlignment = GridData.CENTER; |
453 |
data.horizontalAlignment = GridData.FILL; |
454 |
button.setLayoutData(data); |
455 |
|
456 |
return button; |
457 |
} |
458 |
|
459 |
public void dispose() { |
460 |
storeSectionExpansionStates(getDialogSettings().addNewSection(SETTINGS_SECTION_NAME)); |
461 |
super.dispose(); |
462 |
} |
463 |
|
464 |
protected IDialogSettings getDialogSettings() { |
465 |
return XMLUIPlugin.getDefault().getDialogSettings(); |
466 |
} |
467 |
|
468 |
protected boolean shouldRevalidateOnSettingsChange() { |
469 |
return fOriginalUseExtendedMarkupValidation != fExtendedMarkupValidation.getSelection() || |
470 |
fOriginalUseXIncludeButtonSelected != fUseXinclude.getSelection() || |
471 |
fOriginalUseHonourAllButtonSelected != fHonourAllSchemaLocations.getSelection() || |
472 |
super.shouldRevalidateOnSettingsChange(); |
473 |
} |
518 |
} |
474 |
} |