1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.internal.ui.preferences;
13 import java.util.ArrayList;
16 import net.sourceforge.phpdt.core.IJavaProject;
17 import net.sourceforge.phpdt.core.JavaCore;
18 import net.sourceforge.phpdt.internal.ui.dialogs.StatusInfo;
19 import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil;
20 import net.sourceforge.phpdt.internal.ui.util.PixelConverter;
21 import net.sourceforge.phpdt.internal.ui.util.TabFolderLayout;
22 import net.sourceforge.phpdt.internal.ui.wizards.IStatusChangeListener;
24 import org.eclipse.core.runtime.IStatus;
25 import org.eclipse.swt.SWT;
26 import org.eclipse.swt.layout.GridData;
27 import org.eclipse.swt.layout.GridLayout;
28 import org.eclipse.swt.widgets.Composite;
29 import org.eclipse.swt.widgets.Control;
30 import org.eclipse.swt.widgets.Label;
31 import org.eclipse.swt.widgets.TabFolder;
32 import org.eclipse.swt.widgets.TabItem;
33 import org.eclipse.swt.widgets.Text;
37 public class CompilerConfigurationBlock extends OptionsConfigurationBlock {
39 // Preference store keys, see JavaCore.getOptions
40 private static final String PREF_PB_PHP_VAR_DEPRECATED= JavaCore.COMPILER_PB_PHP_VAR_DEPRECATED;
41 private static final String PREF_PB_PHP_KEYWORD= JavaCore.COMPILER_PB_PHP_KEYWORD;
42 private static final String PREF_PB_PHP_UPPERCASE_IDENTIFIER= JavaCore.COMPILER_PB_PHP_UPPERCASE_IDENTIFIER;
44 // private static final String PREF_LOCAL_VARIABLE_ATTR= JavaCore.COMPILER_LOCAL_VARIABLE_ATTR;
45 // private static final String PREF_LINE_NUMBER_ATTR= JavaCore.COMPILER_LINE_NUMBER_ATTR;
46 // private static final String PREF_SOURCE_FILE_ATTR= JavaCore.COMPILER_SOURCE_FILE_ATTR;
47 // private static final String PREF_CODEGEN_UNUSED_LOCAL= JavaCore.COMPILER_CODEGEN_UNUSED_LOCAL;
48 // private static final String PREF_CODEGEN_TARGET_PLATFORM= JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM;
49 //private static final String PREF_PB_UNREACHABLE_CODE= JavaCore.COMPILER_PB_UNREACHABLE_CODE;
50 //private static final String PREF_PB_INVALID_IMPORT= JavaCore.COMPILER_PB_INVALID_IMPORT;
51 // private static final String PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD= JavaCore.COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD;
52 // private static final String PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME= JavaCore.COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME;
53 // private static final String PREF_PB_DEPRECATION= JavaCore.COMPILER_PB_DEPRECATION;
54 // private static final String PREF_PB_DEPRECATION_WHEN_OVERRIDING= JavaCore.COMPILER_PB_DEPRECATION_WHEN_OVERRIDING_DEPRECATED_METHOD;
56 // private static final String PREF_PB_HIDDEN_CATCH_BLOCK= JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK;
57 // private static final String PREF_PB_UNUSED_LOCAL= JavaCore.COMPILER_PB_UNUSED_LOCAL;
58 // private static final String PREF_PB_UNUSED_PARAMETER= JavaCore.COMPILER_PB_UNUSED_PARAMETER;
59 // private static final String PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING= JavaCore.COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE;
60 // private static final String PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT= JavaCore.COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT;
61 // private static final String PREF_PB_SYNTHETIC_ACCESS_EMULATION= JavaCore.COMPILER_PB_SYNTHETIC_ACCESS_EMULATION;
62 // private static final String PREF_PB_NON_EXTERNALIZED_STRINGS= JavaCore.COMPILER_PB_NON_NLS_STRING_LITERAL;
63 // private static final String PREF_PB_ASSERT_AS_IDENTIFIER= JavaCore.COMPILER_PB_ASSERT_IDENTIFIER;
64 private static final String PREF_PB_MAX_PER_UNIT= JavaCore.COMPILER_PB_MAX_PER_UNIT;
65 // private static final String PREF_PB_UNUSED_IMPORT= JavaCore.COMPILER_PB_UNUSED_IMPORT;
66 // private static final String PREF_PB_UNUSED_PRIVATE= JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER;
67 // private static final String PREF_PB_STATIC_ACCESS_RECEIVER= JavaCore.COMPILER_PB_STATIC_ACCESS_RECEIVER;
68 // private static final String PREF_PB_NO_EFFECT_ASSIGNMENT= JavaCore.COMPILER_PB_NO_EFFECT_ASSIGNMENT;
69 // private static final String PREF_PB_CHAR_ARRAY_IN_CONCAT= JavaCore.COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION;
70 // private static final String PREF_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT= JavaCore.COMPILER_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT;
71 // private static final String PREF_PB_LOCAL_VARIABLE_HIDING= JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING;
72 // private static final String PREF_PB_FIELD_HIDING= JavaCore.COMPILER_PB_FIELD_HIDING;
73 // private static final String PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD= JavaCore.COMPILER_PB_SPECIAL_PARAMETER_HIDING_FIELD;
74 // private static final String PREF_PB_INDIRECT_STATIC_ACCESS= JavaCore.COMPILER_PB_INDIRECT_STATIC_ACCESS;
75 // private static final String PREF_PB_SUPERFLUOUS_SEMICOLON= JavaCore.COMPILER_PB_SUPERFLUOUS_SEMICOLON;
76 // private static final String PREF_PB_UNNECESSARY_TYPE_CHECK= JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK;
78 // private static final String PREF_PB_INVALID_JAVADOC= JavaCore.COMPILER_PB_INVALID_JAVADOC;
79 // private static final String PREF_PB_INVALID_JAVADOC_TAGS= JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS;
80 // private static final String PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY= JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS_VISIBILITY;
82 // private static final String PREF_PB_MISSING_JAVADOC_TAGS= JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS;
83 // private static final String PREF_PB_MISSING_JAVADOC_TAGS_VISIBILITY= JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS_VISIBILITY;
84 // private static final String PREF_PB_MISSING_JAVADOC_TAGS_OVERRIDING= JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS_OVERRIDING;
86 // private static final String PREF_PB_MISSING_JAVADOC_COMMENTS= JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS;
87 // private static final String PREF_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY= JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY;
88 // private static final String PREF_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING= JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING;
90 // private static final String PREF_SOURCE_COMPATIBILITY= JavaCore.COMPILER_SOURCE;
91 // private static final String PREF_COMPLIANCE= JavaCore.COMPILER_COMPLIANCE;
93 // private static final String PREF_RESOURCE_FILTER= JavaCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER;
94 // private static final String PREF_BUILD_INVALID_CLASSPATH= JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH;
95 // private static final String PREF_BUILD_CLEAN_OUTPUT_FOLDER= JavaCore.CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER;
96 // private static final String PREF_ENABLE_EXCLUSION_PATTERNS= JavaCore.CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS;
97 // private static final String PREF_ENABLE_MULTIPLE_OUTPUT_LOCATIONS= JavaCore.CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS;
99 // private static final String PREF_PB_INCOMPLETE_BUILDPATH= JavaCore.CORE_INCOMPLETE_CLASSPATH;
100 // private static final String PREF_PB_CIRCULAR_BUILDPATH= JavaCore.CORE_CIRCULAR_CLASSPATH;
101 //// private static final String PREF_PB_INCOMPATIBLE_JDK_LEVEL= JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL;
102 // private static final String PREF_PB_DEPRECATION_IN_DEPRECATED_CODE= JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE;
103 // private static final String PREF_PB_DUPLICATE_RESOURCE= JavaCore.CORE_JAVA_BUILD_DUPLICATE_RESOURCE;
104 // private static final String PREF_PB_INCOMPATIBLE_INTERFACE_METHOD= JavaCore.COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD;
106 // private static final String PREF_PB_UNDOCUMENTED_EMPTY_BLOCK= JavaCore.COMPILER_PB_UNDOCUMENTED_EMPTY_BLOCK;
107 // private static final String PREF_PB_FINALLY_BLOCK_NOT_COMPLETING= JavaCore.COMPILER_PB_FINALLY_BLOCK_NOT_COMPLETING;
108 // private static final String PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION= JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION;
109 // private static final String PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING= JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING;
110 // private static final String PREF_PB_UNQUALIFIED_FIELD_ACCESS= JavaCore.COMPILER_PB_UNQUALIFIED_FIELD_ACCESS;
112 // private static final String INTR_DEFAULT_COMPLIANCE= "internal.default.compliance"; //$NON-NLS-1$
115 private static final String GENERATE= JavaCore.GENERATE;
116 private static final String DO_NOT_GENERATE= JavaCore.DO_NOT_GENERATE;
118 private static final String PRESERVE= JavaCore.PRESERVE;
119 private static final String OPTIMIZE_OUT= JavaCore.OPTIMIZE_OUT;
121 private static final String VERSION_1_1= JavaCore.VERSION_1_1;
122 private static final String VERSION_1_2= JavaCore.VERSION_1_2;
123 private static final String VERSION_1_3= JavaCore.VERSION_1_3;
124 private static final String VERSION_1_4= JavaCore.VERSION_1_4;
126 private static final String ERROR= JavaCore.ERROR;
127 private static final String WARNING= JavaCore.WARNING;
128 private static final String IGNORE= JavaCore.IGNORE;
129 private static final String ABORT= JavaCore.ABORT;
131 private static final String CLEAN= JavaCore.CLEAN;
133 private static final String ENABLED= JavaCore.ENABLED;
134 private static final String DISABLED= JavaCore.DISABLED;
136 // private static final String PUBLIC= JavaCore.PUBLIC;
137 // private static final String PROTECTED= JavaCore.PROTECTED;
138 // private static final String DEFAULT= JavaCore.DEFAULT;
139 // private static final String PRIVATE= JavaCore.PRIVATE;
141 private static final String DEFAULT_CONF= "default"; //$NON-NLS-1$
142 private static final String USER_CONF= "user"; //$NON-NLS-1$
144 private ArrayList fComplianceControls;
145 private PixelConverter fPixelConverter;
147 private IStatus fMaxNumberProblemsStatus;
148 // private IStatus fComplianceStatus, fMaxNumberProblemsStatus, fResourceFilterStatus;
150 public CompilerConfigurationBlock(IStatusChangeListener context, IJavaProject project) {
151 super(context, project, getKeys());
153 fComplianceControls= new ArrayList();
155 // fComplianceStatus= new StatusInfo();
156 fMaxNumberProblemsStatus= new StatusInfo();
157 // fResourceFilterStatus= new StatusInfo();
159 // compatibilty code for the merge of the two option PB_SIGNAL_PARAMETER:
160 // if (ENABLED.equals(fWorkingValues.get(PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT))) {
161 // fWorkingValues.put(PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING, ENABLED);
166 private final static String[] KEYS= new String[] {
167 PREF_PB_PHP_VAR_DEPRECATED,
169 PREF_PB_PHP_UPPERCASE_IDENTIFIER,
170 // PREF_LOCAL_VARIABLE_ATTR,
171 // PREF_LINE_NUMBER_ATTR, PREF_SOURCE_FILE_ATTR, PREF_CODEGEN_UNUSED_LOCAL,
172 // PREF_CODEGEN_TARGET_PLATFORM,
173 // PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD,
174 // PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME,
175 // PREF_PB_DEPRECATION,
176 // PREF_PB_HIDDEN_CATCH_BLOCK, PREF_PB_UNUSED_LOCAL,
177 // PREF_PB_UNUSED_PARAMETER,
178 // PREF_PB_SYNTHETIC_ACCESS_EMULATION, PREF_PB_NON_EXTERNALIZED_STRINGS,
179 // PREF_PB_ASSERT_AS_IDENTIFIER,
180 // PREF_PB_UNUSED_IMPORT,
181 PREF_PB_MAX_PER_UNIT,
182 // PREF_SOURCE_COMPATIBILITY,
184 // PREF_RESOURCE_FILTER, PREF_BUILD_INVALID_CLASSPATH, PREF_PB_STATIC_ACCESS_RECEIVER, PREF_PB_INCOMPLETE_BUILDPATH,
185 // PREF_PB_CIRCULAR_BUILDPATH, PREF_PB_DEPRECATION_IN_DEPRECATED_CODE, PREF_BUILD_CLEAN_OUTPUT_FOLDER,
186 // PREF_PB_DUPLICATE_RESOURCE, PREF_PB_NO_EFFECT_ASSIGNMENT, PREF_PB_INCOMPATIBLE_INTERFACE_METHOD,
187 // PREF_PB_UNUSED_PRIVATE, PREF_PB_CHAR_ARRAY_IN_CONCAT, PREF_ENABLE_EXCLUSION_PATTERNS, PREF_ENABLE_MULTIPLE_OUTPUT_LOCATIONS,
188 // PREF_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT,
189 // PREF_PB_LOCAL_VARIABLE_HIDING,
190 // PREF_PB_FIELD_HIDING,
191 // PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD,
192 // PREF_PB_INCOMPATIBLE_JDK_LEVEL,
193 // PREF_PB_INDIRECT_STATIC_ACCESS,
194 // PREF_PB_SUPERFLUOUS_SEMICOLON,
195 // PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING,
196 // PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT,
197 // PREF_PB_UNNECESSARY_TYPE_CHECK,
198 // PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION,
199 // PREF_PB_UNQUALIFIED_FIELD_ACCESS,
200 // PREF_PB_UNDOCUMENTED_EMPTY_BLOCK,
201 // PREF_PB_FINALLY_BLOCK_NOT_COMPLETING,
202 // PREF_PB_DEPRECATION_WHEN_OVERRIDING,
203 // PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING,
205 // PREF_PB_INVALID_JAVADOC,
206 // PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY,
207 // PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY,
208 // PREF_PB_MISSING_JAVADOC_TAGS,
209 // PREF_PB_MISSING_JAVADOC_TAGS_VISIBILITY,
210 // PREF_PB_MISSING_JAVADOC_TAGS_OVERRIDING,
211 // PREF_PB_MISSING_JAVADOC_COMMENTS,
212 // PREF_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY,
213 // PREF_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING
216 private static String[] getKeys() {
220 protected final Map getOptions(boolean inheritJavaCoreOptions) {
221 Map map= super.getOptions(inheritJavaCoreOptions);
222 // map.put(INTR_DEFAULT_COMPLIANCE, getCurrentCompliance(map));
226 protected final Map getDefaultOptions() {
227 Map map= super.getDefaultOptions();
228 // map.put(INTR_DEFAULT_COMPLIANCE, getCurrentCompliance(map));
234 * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
236 protected Control createContents(Composite parent) {
237 fPixelConverter= new PixelConverter(parent);
238 setShell(parent.getShell());
240 TabFolder folder= new TabFolder(parent, SWT.NONE);
241 folder.setLayout(new TabFolderLayout());
242 folder.setLayoutData(new GridData(GridData.FILL_BOTH));
244 Composite commonComposite= createStyleTabContent(folder);
245 // Composite unusedComposite= createUnusedCodeTabContent(folder);
246 Composite advancedComposite= createAdvancedTabContent(folder);
247 // Composite javadocComposite= createJavadocTabContent(folder);
248 // Composite complianceComposite= createComplianceTabContent(folder);
249 // Composite othersComposite= createBuildPathTabContent(folder);
251 TabItem item= new TabItem(folder, SWT.NONE);
252 item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.common.tabtitle")); //$NON-NLS-1$
253 item.setControl(commonComposite);
255 item= new TabItem(folder, SWT.NONE);
256 item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.advanced.tabtitle")); //$NON-NLS-1$
257 item.setControl(advancedComposite);
259 // item= new TabItem(folder, SWT.NONE);
260 // item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.unused.tabtitle")); //$NON-NLS-1$
261 // item.setControl(unusedComposite);
263 // item= new TabItem(folder, SWT.NONE);
264 // item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.javadoc.tabtitle")); //$NON-NLS-1$
265 // item.setControl(javadocComposite);
267 // item= new TabItem(folder, SWT.NONE);
268 // item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.compliance.tabtitle")); //$NON-NLS-1$
269 // item.setControl(complianceComposite);
271 // item= new TabItem(folder, SWT.NONE);
272 // item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.others.tabtitle")); //$NON-NLS-1$
273 // item.setControl(othersComposite);
275 validateSettings(null, null);
280 private Composite createStyleTabContent(Composite folder) {
281 String[] errorWarningIgnore= new String[] { ERROR, WARNING, IGNORE };
283 String[] errorWarningIgnoreLabels= new String[] {
284 PreferencesMessages.getString("CompilerConfigurationBlock.error"), //$NON-NLS-1$
285 PreferencesMessages.getString("CompilerConfigurationBlock.warning"), //$NON-NLS-1$
286 PreferencesMessages.getString("CompilerConfigurationBlock.ignore") //$NON-NLS-1$
291 GridLayout layout= new GridLayout();
292 layout.numColumns= nColumns;
294 Composite composite= new Composite(folder, SWT.NULL);
295 composite.setLayout(layout);
297 Label description= new Label(composite, SWT.WRAP);
298 description.setText(PreferencesMessages.getString("CompilerConfigurationBlock.common.description")); //$NON-NLS-1$
299 GridData gd= new GridData();
300 gd.horizontalSpan= nColumns;
301 gd.widthHint= fPixelConverter.convertWidthInCharsToPixels(50);
302 description.setLayoutData(gd);
304 String label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_var_deprecated.label"); //$NON-NLS-1$
305 addComboBox(composite, label, PREF_PB_PHP_VAR_DEPRECATED, errorWarningIgnore, errorWarningIgnoreLabels, 0);
307 label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_keyword.label"); //$NON-NLS-1$
308 addComboBox(composite, label, PREF_PB_PHP_KEYWORD, errorWarningIgnore, errorWarningIgnoreLabels, 0);
310 label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_uppercase_identifier.label"); //$NON-NLS-1$
311 addComboBox(composite, label, PREF_PB_PHP_UPPERCASE_IDENTIFIER, errorWarningIgnore, errorWarningIgnoreLabels, 0);
313 label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_overriding_pkg_dflt.label"); //$NON-NLS-1$
314 // addComboBox(composite, label, PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, errorWarningIgnore, errorWarningIgnoreLabels, 0);
316 // label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_method_naming.label"); //$NON-NLS-1$
317 // addComboBox(composite, label, PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME, errorWarningIgnore, errorWarningIgnoreLabels, 0);
319 // label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_hidden_catchblock.label"); //$NON-NLS-1$
320 // addComboBox(composite, label, PREF_PB_HIDDEN_CATCH_BLOCK, errorWarningIgnore, errorWarningIgnoreLabels, 0);
322 // label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_static_access_receiver.label"); //$NON-NLS-1$
323 // addComboBox(composite, label, PREF_PB_STATIC_ACCESS_RECEIVER, errorWarningIgnore, errorWarningIgnoreLabels, 0);
325 // label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_no_effect_assignment.label"); //$NON-NLS-1$
326 // addComboBox(composite, label, PREF_PB_NO_EFFECT_ASSIGNMENT, errorWarningIgnore, errorWarningIgnoreLabels, 0);
328 // label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_indirect_access_to_static.label"); //$NON-NLS-1$
329 // addComboBox(composite, label, PREF_PB_INDIRECT_STATIC_ACCESS, errorWarningIgnore, errorWarningIgnoreLabels, 0);
331 // label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_accidential_assignement.label"); //$NON-NLS-1$
332 // addComboBox(composite, label, PREF_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT, errorWarningIgnore, errorWarningIgnoreLabels, 0);
334 // label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_finally_block_not_completing.label"); //$NON-NLS-1$
335 // addComboBox(composite, label, PREF_PB_FINALLY_BLOCK_NOT_COMPLETING, errorWarningIgnore, errorWarningIgnoreLabels, 0);
337 // label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_undocumented_empty_block.label"); //$NON-NLS-1$
338 // addComboBox(composite, label, PREF_PB_UNDOCUMENTED_EMPTY_BLOCK, errorWarningIgnore, errorWarningIgnoreLabels, 0);
344 private Composite createAdvancedTabContent(TabFolder folder) {
345 String[] errorWarningIgnore= new String[] { ERROR, WARNING, IGNORE };
347 String[] errorWarningIgnoreLabels= new String[] {
348 PreferencesMessages.getString("CompilerConfigurationBlock.error"), //$NON-NLS-1$
349 PreferencesMessages.getString("CompilerConfigurationBlock.warning"), //$NON-NLS-1$
350 PreferencesMessages.getString("CompilerConfigurationBlock.ignore") //$NON-NLS-1$
353 String[] enabledDisabled= new String[] { ENABLED, DISABLED };
357 GridLayout layout= new GridLayout();
358 layout.numColumns= nColumns;
360 Composite composite= new Composite(folder, SWT.NULL);
361 composite.setLayout(layout);
363 Label description= new Label(composite, SWT.WRAP);
364 description.setText(PreferencesMessages.getString("CompilerConfigurationBlock.advanced.description")); //$NON-NLS-1$
365 GridData gd= new GridData();
366 gd.horizontalSpan= nColumns;
367 gd.widthHint= fPixelConverter.convertWidthInCharsToPixels(50);
368 description.setLayoutData(gd);
370 // String label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_synth_access_emul.label"); //$NON-NLS-1$
371 // addComboBox(composite, label, PREF_PB_SYNTHETIC_ACCESS_EMULATION, errorWarningIgnore, errorWarningIgnoreLabels, 0);
373 // label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_local_variable_hiding.label"); //$NON-NLS-1$
374 // addComboBox(composite, label, PREF_PB_LOCAL_VARIABLE_HIDING, errorWarningIgnore, errorWarningIgnoreLabels, 0);
376 // int indent= fPixelConverter.convertWidthInCharsToPixels(2);
377 // label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_special_param_hiding.label"); //$NON-NLS-1$
378 // addCheckBox(composite, label, PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD, enabledDisabled, indent);
380 // label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_field_hiding.label"); //$NON-NLS-1$
381 // addComboBox(composite, label, PREF_PB_FIELD_HIDING, errorWarningIgnore, errorWarningIgnoreLabels, 0);
383 // label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_non_externalized_strings.label"); //$NON-NLS-1$
384 // addComboBox(composite, label, PREF_PB_NON_EXTERNALIZED_STRINGS, errorWarningIgnore, errorWarningIgnoreLabels, 0);
386 // label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_incompatible_interface_method.label"); //$NON-NLS-1$
387 // addComboBox(composite, label, PREF_PB_INCOMPATIBLE_INTERFACE_METHOD, errorWarningIgnore, errorWarningIgnoreLabels, 0);
389 // label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_char_array_in_concat.label"); //$NON-NLS-1$
390 // addComboBox(composite, label, PREF_PB_CHAR_ARRAY_IN_CONCAT, errorWarningIgnore, errorWarningIgnoreLabels, 0);
392 // label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_unqualified_field_access.label"); //$NON-NLS-1$
393 // addComboBox(composite, label, PREF_PB_UNQUALIFIED_FIELD_ACCESS, errorWarningIgnore, errorWarningIgnoreLabels, 0);
396 gd.widthHint= fPixelConverter.convertWidthInCharsToPixels(6);
398 String label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_max_per_unit.label"); //$NON-NLS-1$
399 Text text= addTextField(composite, label, PREF_PB_MAX_PER_UNIT, 0, 0);
400 text.setTextLimit(6);
401 text.setLayoutData(gd);
411 * Update fields and validate.
412 * @param changedKey Key that changed, or null, if all changed.
414 protected void validateSettings(String changedKey, String newValue) {
416 if (changedKey != null) {
417 // if (INTR_DEFAULT_COMPLIANCE.equals(changedKey)) {
418 // updateComplianceEnableState();
419 // if (DEFAULT_CONF.equals(newValue)) {
420 // updateComplianceDefaultSettings();
422 // fComplianceStatus= validateCompliance();
423 // } else if (PREF_COMPLIANCE.equals(changedKey)) {
424 // if (checkValue(INTR_DEFAULT_COMPLIANCE, DEFAULT_CONF)) {
425 // updateComplianceDefaultSettings();
427 // fComplianceStatus= validateCompliance();
428 // } else if (PREF_SOURCE_COMPATIBILITY.equals(changedKey) ||
429 // PREF_CODEGEN_TARGET_PLATFORM.equals(changedKey) ||
430 // PREF_PB_ASSERT_AS_IDENTIFIER.equals(changedKey)) {
431 // fComplianceStatus= validateCompliance();
433 if (PREF_PB_MAX_PER_UNIT.equals(changedKey)) {
434 fMaxNumberProblemsStatus= validateMaxNumberProblems();
435 // } else if (PREF_RESOURCE_FILTER.equals(changedKey)) {
436 // fResourceFilterStatus= validateResourceFilters();
437 // } else if (S.equals(changedKey) ||
438 // PREF_PB_DEPRECATION.equals(changedKey) ) { // ||
439 //// PREF_PB_INVALID_JAVADOC.equals(changedKey) ||
440 //// PREF_PB_MISSING_JAVADOC_TAGS.equals(changedKey) ||
441 //// PREF_PB_MISSING_JAVADOC_COMMENTS.equals(changedKey) ||
442 //// PREF_PB_MISSING_JAVADOC_COMMENTS.equals(changedKey) ||
443 //// PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION.equals(changedKey)) {
444 // updateEnableStates();
445 // } else if (PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING.equals(changedKey)) {
446 // // merging the two options
447 // fWorkingValues.put(PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT, newValue);
452 // updateEnableStates();
453 // updateComplianceEnableState();
454 // fComplianceStatus= validateCompliance();
455 fMaxNumberProblemsStatus= validateMaxNumberProblems();
456 // fResourceFilterStatus= validateResourceFilters();
458 // IStatus status= StatusUtil.getMostSevere(new IStatus[] { fComplianceStatus, fMaxNumberProblemsStatus, fResourceFilterStatus });
459 IStatus status= StatusUtil.getMostSevere(new IStatus[] { fMaxNumberProblemsStatus });
460 fContext.statusChanged(status);
463 // private void updateEnableStates() {
464 // boolean enableUnusedParams= !checkValue(PREF_PB_UNUSED_PARAMETER, IGNORE);
465 // getCheckBox(PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING).setEnabled(enableUnusedParams);
467 // boolean enableDeprecation= !checkValue(PREF_PB_DEPRECATION, IGNORE);
468 // getCheckBox(PREF_PB_DEPRECATION_IN_DEPRECATED_CODE).setEnabled(enableDeprecation);
469 // getCheckBox(PREF_PB_DEPRECATION_WHEN_OVERRIDING).setEnabled(enableDeprecation);
471 // boolean enableThrownExceptions= !checkValue(PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION, IGNORE);
472 // getCheckBox(PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING).setEnabled(enableThrownExceptions);
474 // boolean enableHiding= !checkValue(PREF_PB_LOCAL_VARIABLE_HIDING, IGNORE);
475 // getCheckBox(PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD).setEnabled(enableHiding);
477 // boolean enableInvalidTagsErrors= !checkValue(PREF_PB_INVALID_JAVADOC, IGNORE);
478 // getCheckBox(PREF_PB_INVALID_JAVADOC_TAGS).setEnabled(enableInvalidTagsErrors);
479 // setComboEnabled(PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY, enableInvalidTagsErrors);
481 // boolean enableMissingTagsErrors= !checkValue(PREF_PB_MISSING_JAVADOC_TAGS, IGNORE);
482 // getCheckBox(PREF_PB_MISSING_JAVADOC_TAGS_OVERRIDING).setEnabled(enableMissingTagsErrors);
483 // setComboEnabled(PREF_PB_MISSING_JAVADOC_TAGS_VISIBILITY, enableMissingTagsErrors);
485 // boolean enableMissingCommentsErrors= !checkValue(PREF_PB_MISSING_JAVADOC_COMMENTS, IGNORE);
486 // getCheckBox(PREF_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING).setEnabled(enableMissingCommentsErrors);
487 // setComboEnabled(PREF_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY, enableMissingCommentsErrors);
490 // private IStatus validateCompliance() {
491 // StatusInfo status= new StatusInfo();
492 // if (checkValue(PREF_COMPLIANCE, VERSION_1_3)) {
493 // if (checkValue(PREF_SOURCE_COMPATIBILITY, VERSION_1_4)) {
494 // status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.cpl13src14.error")); //$NON-NLS-1$
496 // } else if (checkValue(PREF_CODEGEN_TARGET_PLATFORM, VERSION_1_4)) {
497 // status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.cpl13trg14.error")); //$NON-NLS-1$
501 // if (checkValue(PREF_SOURCE_COMPATIBILITY, VERSION_1_4)) {
502 // if (!checkValue(PREF_PB_ASSERT_AS_IDENTIFIER, ERROR)) {
503 // status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.src14asrterr.error")); //$NON-NLS-1$
507 // if (checkValue(PREF_SOURCE_COMPATIBILITY, VERSION_1_4)) {
508 // if (!checkValue(PREF_CODEGEN_TARGET_PLATFORM, VERSION_1_4)) {
509 // status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.src14tgt14.error")); //$NON-NLS-1$
516 private IStatus validateMaxNumberProblems() {
517 String number= (String) fWorkingValues.get(PREF_PB_MAX_PER_UNIT);
518 StatusInfo status= new StatusInfo();
519 if (number.length() == 0) {
520 status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.empty_input")); //$NON-NLS-1$
523 int value= Integer.parseInt(number);
525 status.setError(PreferencesMessages.getFormattedString("CompilerConfigurationBlock.invalid_input", number)); //$NON-NLS-1$
527 } catch (NumberFormatException e) {
528 status.setError(PreferencesMessages.getFormattedString("CompilerConfigurationBlock.invalid_input", number)); //$NON-NLS-1$
534 // private IStatus validateResourceFilters() {
535 // String text= (String) fWorkingValues.get(PREF_RESOURCE_FILTER);
537 // IWorkspace workspace= ResourcesPlugin.getWorkspace();
539 // String[] filters= getTokens(text, ","); //$NON-NLS-1$
540 // for (int i= 0; i < filters.length; i++) {
541 // String fileName= filters[i].replace('*', 'x');
542 // int resourceType= IResource.FILE;
543 // int lastCharacter= fileName.length() - 1;
544 // if (lastCharacter >= 0 && fileName.charAt(lastCharacter) == '/') {
545 // fileName= fileName.substring(0, lastCharacter);
546 // resourceType= IResource.FOLDER;
548 // IStatus status= workspace.validateName(fileName, resourceType);
549 // if (status.matches(IStatus.ERROR)) {
550 // String message= PreferencesMessages.getFormattedString("CompilerConfigurationBlock.filter.invalidsegment.error", status.getMessage()); //$NON-NLS-1$
551 // return new StatusInfo(IStatus.ERROR, message);
554 // return new StatusInfo();
557 protected String[] getFullBuildDialogStrings(boolean workspaceSettings) {
558 String title= PreferencesMessages.getString("CompilerConfigurationBlock.needsbuild.title"); //$NON-NLS-1$
560 if (workspaceSettings) {
561 message= PreferencesMessages.getString("CompilerConfigurationBlock.needsfullbuild.message"); //$NON-NLS-1$
563 message= PreferencesMessages.getString("CompilerConfigurationBlock.needsprojectbuild.message"); //$NON-NLS-1$
565 return new String[] { title, message };