- added include declarations to Outline view
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / preferences / CompilerConfigurationBlock.java
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.ui.preferences;
12
13 import java.util.ArrayList;
14 import java.util.Map;
15
16 import org.eclipse.core.resources.IResource;
17 import org.eclipse.core.resources.IWorkspace;
18 import org.eclipse.core.resources.ResourcesPlugin;
19 import org.eclipse.core.runtime.IStatus;
20
21 import org.eclipse.swt.SWT;
22 import org.eclipse.swt.layout.GridData;
23 import org.eclipse.swt.layout.GridLayout;
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.swt.widgets.TabFolder;
28 import org.eclipse.swt.widgets.TabItem;
29 import org.eclipse.swt.widgets.Text;
30
31 import net.sourceforge.phpdt.core.IJavaProject;
32 import net.sourceforge.phpdt.core.JavaCore;
33
34 import net.sourceforge.phpdt.internal.ui.dialogs.StatusInfo;
35 import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil;
36 import net.sourceforge.phpdt.internal.ui.util.PixelConverter;
37 import net.sourceforge.phpdt.internal.ui.util.TabFolderLayout;
38 import net.sourceforge.phpdt.internal.ui.wizards.IStatusChangeListener;
39
40 /**
41   */
42 public class CompilerConfigurationBlock extends OptionsConfigurationBlock {
43
44         // Preference store keys, see JavaCore.getOptions
45     private static final String PREF_PB_PHP_VAR_DEPRECATED= JavaCore.COMPILER_PB_PHP_VAR_DEPRECATED;
46         
47 //      private static final String PREF_LOCAL_VARIABLE_ATTR=  JavaCore.COMPILER_LOCAL_VARIABLE_ATTR;
48 //      private static final String PREF_LINE_NUMBER_ATTR= JavaCore.COMPILER_LINE_NUMBER_ATTR;
49 //      private static final String PREF_SOURCE_FILE_ATTR= JavaCore.COMPILER_SOURCE_FILE_ATTR;
50 //      private static final String PREF_CODEGEN_UNUSED_LOCAL= JavaCore.COMPILER_CODEGEN_UNUSED_LOCAL;
51 //      private static final String PREF_CODEGEN_TARGET_PLATFORM= JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM;
52         //private static final String PREF_PB_UNREACHABLE_CODE= JavaCore.COMPILER_PB_UNREACHABLE_CODE;
53         //private static final String PREF_PB_INVALID_IMPORT= JavaCore.COMPILER_PB_INVALID_IMPORT;
54 //      private static final String PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD= JavaCore.COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD;
55 //      private static final String PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME= JavaCore.COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME;
56 //      private static final String PREF_PB_DEPRECATION= JavaCore.COMPILER_PB_DEPRECATION;
57 //      private static final String PREF_PB_DEPRECATION_WHEN_OVERRIDING= JavaCore.COMPILER_PB_DEPRECATION_WHEN_OVERRIDING_DEPRECATED_METHOD;
58         
59 //      private static final String PREF_PB_HIDDEN_CATCH_BLOCK= JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK;
60 //      private static final String PREF_PB_UNUSED_LOCAL= JavaCore.COMPILER_PB_UNUSED_LOCAL;
61 //      private static final String PREF_PB_UNUSED_PARAMETER= JavaCore.COMPILER_PB_UNUSED_PARAMETER;
62 //      private static final String PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING= JavaCore.COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE;
63 //      private static final String PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT= JavaCore.COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT;
64 //      private static final String PREF_PB_SYNTHETIC_ACCESS_EMULATION= JavaCore.COMPILER_PB_SYNTHETIC_ACCESS_EMULATION;
65 //      private static final String PREF_PB_NON_EXTERNALIZED_STRINGS= JavaCore.COMPILER_PB_NON_NLS_STRING_LITERAL;
66 //      private static final String PREF_PB_ASSERT_AS_IDENTIFIER= JavaCore.COMPILER_PB_ASSERT_IDENTIFIER;
67         private static final String PREF_PB_MAX_PER_UNIT= JavaCore.COMPILER_PB_MAX_PER_UNIT;
68 //      private static final String PREF_PB_UNUSED_IMPORT= JavaCore.COMPILER_PB_UNUSED_IMPORT;
69 //      private static final String PREF_PB_UNUSED_PRIVATE= JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER;
70 //      private static final String PREF_PB_STATIC_ACCESS_RECEIVER= JavaCore.COMPILER_PB_STATIC_ACCESS_RECEIVER;
71 //      private static final String PREF_PB_NO_EFFECT_ASSIGNMENT= JavaCore.COMPILER_PB_NO_EFFECT_ASSIGNMENT;
72 //      private static final String PREF_PB_CHAR_ARRAY_IN_CONCAT= JavaCore.COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION;
73 //      private static final String PREF_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT= JavaCore.COMPILER_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT;
74 //      private static final String PREF_PB_LOCAL_VARIABLE_HIDING= JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING;
75 //      private static final String PREF_PB_FIELD_HIDING= JavaCore.COMPILER_PB_FIELD_HIDING;
76 //      private static final String PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD= JavaCore.COMPILER_PB_SPECIAL_PARAMETER_HIDING_FIELD;
77 //      private static final String PREF_PB_INDIRECT_STATIC_ACCESS= JavaCore.COMPILER_PB_INDIRECT_STATIC_ACCESS;
78 //      private static final String PREF_PB_SUPERFLUOUS_SEMICOLON= JavaCore.COMPILER_PB_SUPERFLUOUS_SEMICOLON;
79 //      private static final String PREF_PB_UNNECESSARY_TYPE_CHECK= JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK;
80         
81 //      private static final String PREF_PB_INVALID_JAVADOC= JavaCore.COMPILER_PB_INVALID_JAVADOC;
82 //      private static final String PREF_PB_INVALID_JAVADOC_TAGS= JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS;
83 //      private static final String PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY= JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS_VISIBILITY;
84 //
85 //      private static final String PREF_PB_MISSING_JAVADOC_TAGS= JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS;
86 //      private static final String PREF_PB_MISSING_JAVADOC_TAGS_VISIBILITY= JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS_VISIBILITY;
87 //      private static final String PREF_PB_MISSING_JAVADOC_TAGS_OVERRIDING= JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS_OVERRIDING;
88 //
89 //      private static final String PREF_PB_MISSING_JAVADOC_COMMENTS= JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS;
90 //      private static final String PREF_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY= JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY;
91 //      private static final String PREF_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING= JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING;
92 //      
93 //      private static final String PREF_SOURCE_COMPATIBILITY= JavaCore.COMPILER_SOURCE;
94 //      private static final String PREF_COMPLIANCE= JavaCore.COMPILER_COMPLIANCE;
95 //
96 //      private static final String PREF_RESOURCE_FILTER= JavaCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER;
97 //      private static final String PREF_BUILD_INVALID_CLASSPATH= JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH;
98 //      private static final String PREF_BUILD_CLEAN_OUTPUT_FOLDER= JavaCore.CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER;
99 //      private static final String PREF_ENABLE_EXCLUSION_PATTERNS= JavaCore.CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS;
100 //      private static final String PREF_ENABLE_MULTIPLE_OUTPUT_LOCATIONS= JavaCore.CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS;
101 //
102 //      private static final String PREF_PB_INCOMPLETE_BUILDPATH= JavaCore.CORE_INCOMPLETE_CLASSPATH;
103 //      private static final String PREF_PB_CIRCULAR_BUILDPATH= JavaCore.CORE_CIRCULAR_CLASSPATH;
104 ////    private static final String PREF_PB_INCOMPATIBLE_JDK_LEVEL= JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL;
105 //      private static final String PREF_PB_DEPRECATION_IN_DEPRECATED_CODE= JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE;
106 //      private static final String PREF_PB_DUPLICATE_RESOURCE= JavaCore.CORE_JAVA_BUILD_DUPLICATE_RESOURCE;
107 //      private static final String PREF_PB_INCOMPATIBLE_INTERFACE_METHOD= JavaCore.COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD;
108
109 //      private static final String PREF_PB_UNDOCUMENTED_EMPTY_BLOCK= JavaCore.COMPILER_PB_UNDOCUMENTED_EMPTY_BLOCK;
110 //      private static final String PREF_PB_FINALLY_BLOCK_NOT_COMPLETING= JavaCore.COMPILER_PB_FINALLY_BLOCK_NOT_COMPLETING;
111 //      private static final String PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION= JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION;
112 //      private static final String PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING= JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING;
113 //      private static final String PREF_PB_UNQUALIFIED_FIELD_ACCESS= JavaCore.COMPILER_PB_UNQUALIFIED_FIELD_ACCESS;
114         
115 //      private static final String INTR_DEFAULT_COMPLIANCE= "internal.default.compliance"; //$NON-NLS-1$
116
117         // values
118         private static final String GENERATE= JavaCore.GENERATE;
119         private static final String DO_NOT_GENERATE= JavaCore.DO_NOT_GENERATE;
120         
121         private static final String PRESERVE= JavaCore.PRESERVE;
122         private static final String OPTIMIZE_OUT= JavaCore.OPTIMIZE_OUT;
123         
124         private static final String VERSION_1_1= JavaCore.VERSION_1_1;
125         private static final String VERSION_1_2= JavaCore.VERSION_1_2;
126         private static final String VERSION_1_3= JavaCore.VERSION_1_3;
127         private static final String VERSION_1_4= JavaCore.VERSION_1_4;
128         
129         private static final String ERROR= JavaCore.ERROR;
130         private static final String WARNING= JavaCore.WARNING;
131         private static final String IGNORE= JavaCore.IGNORE;
132         private static final String ABORT= JavaCore.ABORT;
133         
134         private static final String CLEAN= JavaCore.CLEAN;
135
136         private static final String ENABLED= JavaCore.ENABLED;
137         private static final String DISABLED= JavaCore.DISABLED;
138         
139 //      private static final String PUBLIC= JavaCore.PUBLIC;
140 //      private static final String PROTECTED= JavaCore.PROTECTED;
141 //      private static final String DEFAULT= JavaCore.DEFAULT;
142 //      private static final String PRIVATE= JavaCore.PRIVATE;
143         
144         private static final String DEFAULT_CONF= "default"; //$NON-NLS-1$
145         private static final String USER_CONF= "user";   //$NON-NLS-1$
146
147         private ArrayList fComplianceControls;
148         private PixelConverter fPixelConverter;
149
150         private IStatus fMaxNumberProblemsStatus;
151 //      private IStatus fComplianceStatus, fMaxNumberProblemsStatus, fResourceFilterStatus;
152
153         public CompilerConfigurationBlock(IStatusChangeListener context, IJavaProject project) {
154                 super(context, project);
155                 
156                 fComplianceControls= new ArrayList();
157                         
158 //              fComplianceStatus= new StatusInfo();
159                 fMaxNumberProblemsStatus= new StatusInfo();
160 //              fResourceFilterStatus= new StatusInfo();
161                 
162                 // compatibilty code for the merge of the two option PB_SIGNAL_PARAMETER: 
163 //              if (ENABLED.equals(fWorkingValues.get(PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT))) {
164 //                      fWorkingValues.put(PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING, ENABLED);
165 //              }
166                 
167         }
168         
169         private final String[] KEYS= new String[] {
170             PREF_PB_PHP_VAR_DEPRECATED,
171 //              PREF_LOCAL_VARIABLE_ATTR, 
172 //              PREF_LINE_NUMBER_ATTR, PREF_SOURCE_FILE_ATTR, PREF_CODEGEN_UNUSED_LOCAL,
173 //              PREF_CODEGEN_TARGET_PLATFORM, 
174 //              PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, 
175 //              PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME, 
176 //              PREF_PB_DEPRECATION, 
177 //              PREF_PB_HIDDEN_CATCH_BLOCK, PREF_PB_UNUSED_LOCAL,
178 //              PREF_PB_UNUSED_PARAMETER, 
179 //              PREF_PB_SYNTHETIC_ACCESS_EMULATION, PREF_PB_NON_EXTERNALIZED_STRINGS,
180 //              PREF_PB_ASSERT_AS_IDENTIFIER, 
181 //              PREF_PB_UNUSED_IMPORT, 
182                 PREF_PB_MAX_PER_UNIT, 
183 //              PREF_SOURCE_COMPATIBILITY, 
184 //              PREF_COMPLIANCE, 
185 //              PREF_RESOURCE_FILTER, PREF_BUILD_INVALID_CLASSPATH, PREF_PB_STATIC_ACCESS_RECEIVER, PREF_PB_INCOMPLETE_BUILDPATH,
186 //              PREF_PB_CIRCULAR_BUILDPATH, PREF_PB_DEPRECATION_IN_DEPRECATED_CODE, PREF_BUILD_CLEAN_OUTPUT_FOLDER,
187 //              PREF_PB_DUPLICATE_RESOURCE, PREF_PB_NO_EFFECT_ASSIGNMENT, PREF_PB_INCOMPATIBLE_INTERFACE_METHOD,
188 //              PREF_PB_UNUSED_PRIVATE, PREF_PB_CHAR_ARRAY_IN_CONCAT, PREF_ENABLE_EXCLUSION_PATTERNS, PREF_ENABLE_MULTIPLE_OUTPUT_LOCATIONS,
189 //              PREF_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT, 
190 //              PREF_PB_LOCAL_VARIABLE_HIDING, 
191 //              PREF_PB_FIELD_HIDING,
192 //              PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD, 
193 //              PREF_PB_INCOMPATIBLE_JDK_LEVEL, 
194 //              PREF_PB_INDIRECT_STATIC_ACCESS,
195 //              PREF_PB_SUPERFLUOUS_SEMICOLON, 
196 //              PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING, 
197 //              PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT,
198 //              PREF_PB_UNNECESSARY_TYPE_CHECK, 
199 //              PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION, 
200 //              PREF_PB_UNQUALIFIED_FIELD_ACCESS,
201 //              PREF_PB_UNDOCUMENTED_EMPTY_BLOCK, 
202 //              PREF_PB_FINALLY_BLOCK_NOT_COMPLETING, 
203 //              PREF_PB_DEPRECATION_WHEN_OVERRIDING,
204 //              PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING,
205
206 //              PREF_PB_INVALID_JAVADOC, 
207 //              PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY, 
208 //              PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY,
209 //              PREF_PB_MISSING_JAVADOC_TAGS, 
210 //              PREF_PB_MISSING_JAVADOC_TAGS_VISIBILITY, 
211 //              PREF_PB_MISSING_JAVADOC_TAGS_OVERRIDING,
212 //              PREF_PB_MISSING_JAVADOC_COMMENTS, 
213 //              PREF_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY, 
214 //              PREF_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING
215         };      
216         
217         protected String[] getAllKeys() {
218                 return KEYS;    
219         }
220         
221         protected final Map getOptions(boolean inheritJavaCoreOptions) {
222                 Map map= super.getOptions(inheritJavaCoreOptions);
223         //      map.put(INTR_DEFAULT_COMPLIANCE, getCurrentCompliance(map));
224                 return map;
225         }
226         
227         protected final Map getDefaultOptions() {
228                 Map map= super.getDefaultOptions();
229         //      map.put(INTR_DEFAULT_COMPLIANCE, getCurrentCompliance(map));
230                 return map;
231         }       
232         
233         
234         /*
235          * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
236          */
237         protected Control createContents(Composite parent) {
238                 fPixelConverter= new PixelConverter(parent);
239                 setShell(parent.getShell());
240                 
241                 TabFolder folder= new TabFolder(parent, SWT.NONE);
242                 folder.setLayout(new TabFolderLayout());        
243                 folder.setLayoutData(new GridData(GridData.FILL_BOTH));
244                 
245                 Composite commonComposite= createStyleTabContent(folder);
246 //              Composite unusedComposite= createUnusedCodeTabContent(folder);
247                 Composite advancedComposite= createAdvancedTabContent(folder);
248 //              Composite javadocComposite= createJavadocTabContent(folder);
249 //              Composite complianceComposite= createComplianceTabContent(folder);
250 //              Composite othersComposite= createBuildPathTabContent(folder);
251
252                 TabItem item= new TabItem(folder, SWT.NONE);
253                 item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.common.tabtitle")); //$NON-NLS-1$
254                 item.setControl(commonComposite);
255
256                 item= new TabItem(folder, SWT.NONE);
257                 item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.advanced.tabtitle")); //$NON-NLS-1$
258                 item.setControl(advancedComposite);
259
260 //              item= new TabItem(folder, SWT.NONE);
261 //              item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.unused.tabtitle")); //$NON-NLS-1$
262 //              item.setControl(unusedComposite);
263                 
264 //              item= new TabItem(folder, SWT.NONE);
265 //              item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.javadoc.tabtitle")); //$NON-NLS-1$
266 //              item.setControl(javadocComposite);
267         
268 //              item= new TabItem(folder, SWT.NONE);
269 //              item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.compliance.tabtitle")); //$NON-NLS-1$
270 //              item.setControl(complianceComposite);
271                 
272 //              item= new TabItem(folder, SWT.NONE);
273 //              item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.others.tabtitle")); //$NON-NLS-1$
274 //              item.setControl(othersComposite);               
275                 
276                 validateSettings(null, null);
277         
278                 return folder;
279         }
280
281         private Composite createStyleTabContent(Composite folder) {
282                 String[] errorWarningIgnore= new String[] { ERROR, WARNING, IGNORE };
283                 
284                 String[] errorWarningIgnoreLabels= new String[] {
285                         PreferencesMessages.getString("CompilerConfigurationBlock.error"),  //$NON-NLS-1$
286                         PreferencesMessages.getString("CompilerConfigurationBlock.warning"), //$NON-NLS-1$
287                         PreferencesMessages.getString("CompilerConfigurationBlock.ignore") //$NON-NLS-1$
288                 };
289                 
290                 int nColumns= 3;
291                 
292                 GridLayout layout= new GridLayout();
293                 layout.numColumns= nColumns;
294
295                 Composite composite= new Composite(folder, SWT.NULL);
296                 composite.setLayout(layout);
297                 
298                 Label description= new Label(composite, SWT.WRAP);
299                 description.setText(PreferencesMessages.getString("CompilerConfigurationBlock.common.description")); //$NON-NLS-1$
300                 GridData gd= new GridData();
301                 gd.horizontalSpan= nColumns;
302                 gd.widthHint= fPixelConverter.convertWidthInCharsToPixels(50);
303                 description.setLayoutData(gd);          
304
305                 String label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_var_deprecated.label"); //$NON-NLS-1$
306                 addComboBox(composite, label, PREF_PB_PHP_VAR_DEPRECATED, errorWarningIgnore, errorWarningIgnoreLabels, 0);                     
307
308                 label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_overriding_pkg_dflt.label"); //$NON-NLS-1$
309 //              addComboBox(composite, label, PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, errorWarningIgnore, errorWarningIgnoreLabels, 0);                      
310
311 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_method_naming.label"); //$NON-NLS-1$
312 //              addComboBox(composite, label, PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME, errorWarningIgnore, errorWarningIgnoreLabels, 0);                   
313 //
314 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_hidden_catchblock.label"); //$NON-NLS-1$
315 //              addComboBox(composite, label, PREF_PB_HIDDEN_CATCH_BLOCK, errorWarningIgnore, errorWarningIgnoreLabels, 0);
316 //              
317 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_static_access_receiver.label"); //$NON-NLS-1$
318 //              addComboBox(composite, label, PREF_PB_STATIC_ACCESS_RECEIVER, errorWarningIgnore, errorWarningIgnoreLabels, 0);
319 //              
320 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_no_effect_assignment.label"); //$NON-NLS-1$
321 //              addComboBox(composite, label, PREF_PB_NO_EFFECT_ASSIGNMENT, errorWarningIgnore, errorWarningIgnoreLabels, 0);
322
323 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_indirect_access_to_static.label"); //$NON-NLS-1$
324 //              addComboBox(composite, label, PREF_PB_INDIRECT_STATIC_ACCESS, errorWarningIgnore, errorWarningIgnoreLabels, 0); 
325 //
326 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_accidential_assignement.label"); //$NON-NLS-1$
327 //              addComboBox(composite, label, PREF_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT, errorWarningIgnore, errorWarningIgnoreLabels, 0);
328 //
329 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_finally_block_not_completing.label"); //$NON-NLS-1$
330 //              addComboBox(composite, label, PREF_PB_FINALLY_BLOCK_NOT_COMPLETING, errorWarningIgnore, errorWarningIgnoreLabels, 0);
331 //
332 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_undocumented_empty_block.label"); //$NON-NLS-1$
333 //              addComboBox(composite, label, PREF_PB_UNDOCUMENTED_EMPTY_BLOCK, errorWarningIgnore, errorWarningIgnoreLabels, 0);
334
335                 
336                 return composite;
337         }
338
339         private Composite createAdvancedTabContent(TabFolder folder) {
340                 String[] errorWarningIgnore= new String[] { ERROR, WARNING, IGNORE };
341                 
342                 String[] errorWarningIgnoreLabels= new String[] {
343                         PreferencesMessages.getString("CompilerConfigurationBlock.error"),  //$NON-NLS-1$
344                         PreferencesMessages.getString("CompilerConfigurationBlock.warning"), //$NON-NLS-1$
345                         PreferencesMessages.getString("CompilerConfigurationBlock.ignore") //$NON-NLS-1$
346                 };
347                 
348                 String[] enabledDisabled= new String[] { ENABLED, DISABLED };
349                 
350                 int nColumns= 3;
351                 
352                 GridLayout layout= new GridLayout();
353                 layout.numColumns= nColumns;
354                                         
355                 Composite composite= new Composite(folder, SWT.NULL);
356                 composite.setLayout(layout);
357
358                 Label description= new Label(composite, SWT.WRAP);
359                 description.setText(PreferencesMessages.getString("CompilerConfigurationBlock.advanced.description")); //$NON-NLS-1$
360                 GridData gd= new GridData();
361                 gd.horizontalSpan= nColumns;
362                 gd.widthHint= fPixelConverter.convertWidthInCharsToPixels(50);
363                 description.setLayoutData(gd);
364                         
365 //              String label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_synth_access_emul.label"); //$NON-NLS-1$
366 //              addComboBox(composite, label, PREF_PB_SYNTHETIC_ACCESS_EMULATION, errorWarningIgnore, errorWarningIgnoreLabels, 0);
367
368 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_local_variable_hiding.label"); //$NON-NLS-1$
369 //              addComboBox(composite, label, PREF_PB_LOCAL_VARIABLE_HIDING, errorWarningIgnore, errorWarningIgnoreLabels, 0);
370
371 //              int indent= fPixelConverter.convertWidthInCharsToPixels(2);
372 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_special_param_hiding.label"); //$NON-NLS-1$
373 //              addCheckBox(composite, label, PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD, enabledDisabled, indent);
374
375 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_field_hiding.label"); //$NON-NLS-1$
376 //              addComboBox(composite, label, PREF_PB_FIELD_HIDING, errorWarningIgnore, errorWarningIgnoreLabels, 0);
377
378 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_non_externalized_strings.label"); //$NON-NLS-1$
379 //              addComboBox(composite, label, PREF_PB_NON_EXTERNALIZED_STRINGS, errorWarningIgnore, errorWarningIgnoreLabels, 0);
380 //
381 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_incompatible_interface_method.label"); //$NON-NLS-1$
382 //              addComboBox(composite, label, PREF_PB_INCOMPATIBLE_INTERFACE_METHOD, errorWarningIgnore, errorWarningIgnoreLabels, 0);
383 //
384 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_char_array_in_concat.label"); //$NON-NLS-1$
385 //              addComboBox(composite, label, PREF_PB_CHAR_ARRAY_IN_CONCAT, errorWarningIgnore, errorWarningIgnoreLabels, 0);
386
387 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_unqualified_field_access.label"); //$NON-NLS-1$
388 //              addComboBox(composite, label, PREF_PB_UNQUALIFIED_FIELD_ACCESS, errorWarningIgnore, errorWarningIgnoreLabels, 0);
389                 
390                 gd= new GridData();
391                 gd.widthHint= fPixelConverter.convertWidthInCharsToPixels(6);
392                 
393                 String label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_max_per_unit.label"); //$NON-NLS-1$
394                 Text text= addTextField(composite, label, PREF_PB_MAX_PER_UNIT, 0, 0);
395                 text.setTextLimit(6);
396                 text.setLayoutData(gd);
397
398                 return composite;
399         }
400
401         
402         
403                 
404         
405         /* (non-javadoc)
406          * Update fields and validate.
407          * @param changedKey Key that changed, or null, if all changed.
408          */     
409         protected void validateSettings(String changedKey, String newValue) {
410                 
411                 if (changedKey != null) {
412 //                      if (INTR_DEFAULT_COMPLIANCE.equals(changedKey)) {
413 //                              updateComplianceEnableState();
414 //                              if (DEFAULT_CONF.equals(newValue)) {
415 //                                      updateComplianceDefaultSettings();
416 //                              }
417 //                              fComplianceStatus= validateCompliance();
418 //                      } else if (PREF_COMPLIANCE.equals(changedKey)) {
419 //                              if (checkValue(INTR_DEFAULT_COMPLIANCE, DEFAULT_CONF)) {
420 //                                      updateComplianceDefaultSettings();
421 //                              }
422 //                              fComplianceStatus= validateCompliance();
423 //                      } else if (PREF_SOURCE_COMPATIBILITY.equals(changedKey) ||
424 //                                      PREF_CODEGEN_TARGET_PLATFORM.equals(changedKey) ||
425 //                                      PREF_PB_ASSERT_AS_IDENTIFIER.equals(changedKey)) {
426 //                              fComplianceStatus= validateCompliance();
427 //                      } else 
428                           if (PREF_PB_MAX_PER_UNIT.equals(changedKey)) {
429                                 fMaxNumberProblemsStatus= validateMaxNumberProblems();
430 //                      } else if (PREF_RESOURCE_FILTER.equals(changedKey)) {
431 //                              fResourceFilterStatus= validateResourceFilters();
432 //                      } else if (S.equals(changedKey) ||
433 //                                      PREF_PB_DEPRECATION.equals(changedKey) ) { // ||
434 ////                                    PREF_PB_INVALID_JAVADOC.equals(changedKey) ||
435 ////                                    PREF_PB_MISSING_JAVADOC_TAGS.equals(changedKey) ||
436 ////                                    PREF_PB_MISSING_JAVADOC_COMMENTS.equals(changedKey) ||
437 ////                                    PREF_PB_MISSING_JAVADOC_COMMENTS.equals(changedKey) ||
438 ////                                    PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION.equals(changedKey)) {                          
439 //                              updateEnableStates();
440 //                      } else if (PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING.equals(changedKey)) {
441 //                              // merging the two options
442 //                              fWorkingValues.put(PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT, newValue);
443                         } else {
444                                 return;
445                         }
446                 } else {
447 //                      updateEnableStates();
448 //                      updateComplianceEnableState();
449 //                      fComplianceStatus= validateCompliance();
450                         fMaxNumberProblemsStatus= validateMaxNumberProblems();
451 //                      fResourceFilterStatus= validateResourceFilters();
452                 }               
453 //              IStatus status= StatusUtil.getMostSevere(new IStatus[] { fComplianceStatus, fMaxNumberProblemsStatus, fResourceFilterStatus });
454                 IStatus status= StatusUtil.getMostSevere(new IStatus[] { fMaxNumberProblemsStatus });
455                 fContext.statusChanged(status);
456         }
457         
458 //      private void updateEnableStates() {
459 //              boolean enableUnusedParams= !checkValue(PREF_PB_UNUSED_PARAMETER, IGNORE);
460 //              getCheckBox(PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING).setEnabled(enableUnusedParams);
461                 
462 //              boolean enableDeprecation= !checkValue(PREF_PB_DEPRECATION, IGNORE);
463 //              getCheckBox(PREF_PB_DEPRECATION_IN_DEPRECATED_CODE).setEnabled(enableDeprecation);
464 //              getCheckBox(PREF_PB_DEPRECATION_WHEN_OVERRIDING).setEnabled(enableDeprecation);
465 //              
466 //              boolean enableThrownExceptions= !checkValue(PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION, IGNORE);
467 //              getCheckBox(PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING).setEnabled(enableThrownExceptions);
468 //
469 //              boolean enableHiding= !checkValue(PREF_PB_LOCAL_VARIABLE_HIDING, IGNORE);
470 //              getCheckBox(PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD).setEnabled(enableHiding);
471 //
472 //              boolean enableInvalidTagsErrors= !checkValue(PREF_PB_INVALID_JAVADOC, IGNORE);
473 //              getCheckBox(PREF_PB_INVALID_JAVADOC_TAGS).setEnabled(enableInvalidTagsErrors);
474 //              setComboEnabled(PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY, enableInvalidTagsErrors);
475 //              
476 //              boolean enableMissingTagsErrors= !checkValue(PREF_PB_MISSING_JAVADOC_TAGS, IGNORE);
477 //              getCheckBox(PREF_PB_MISSING_JAVADOC_TAGS_OVERRIDING).setEnabled(enableMissingTagsErrors);
478 //              setComboEnabled(PREF_PB_MISSING_JAVADOC_TAGS_VISIBILITY, enableMissingTagsErrors);
479 //              
480 //              boolean enableMissingCommentsErrors= !checkValue(PREF_PB_MISSING_JAVADOC_COMMENTS, IGNORE);
481 //              getCheckBox(PREF_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING).setEnabled(enableMissingCommentsErrors);
482 //              setComboEnabled(PREF_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY, enableMissingCommentsErrors);
483 //      }
484
485 //      private IStatus validateCompliance() {
486 //              StatusInfo status= new StatusInfo();
487 //              if (checkValue(PREF_COMPLIANCE, VERSION_1_3)) {
488 //                      if (checkValue(PREF_SOURCE_COMPATIBILITY, VERSION_1_4)) {
489 //                              status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.cpl13src14.error")); //$NON-NLS-1$
490 //                              return status;
491 //                      } else if (checkValue(PREF_CODEGEN_TARGET_PLATFORM, VERSION_1_4)) {
492 //                              status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.cpl13trg14.error")); //$NON-NLS-1$
493 //                              return status;
494 //                      }
495 //              }
496 //              if (checkValue(PREF_SOURCE_COMPATIBILITY, VERSION_1_4)) {
497 //                      if (!checkValue(PREF_PB_ASSERT_AS_IDENTIFIER, ERROR)) {
498 //                              status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.src14asrterr.error")); //$NON-NLS-1$
499 //                              return status;
500 //                      }
501 //              }
502 //              if (checkValue(PREF_SOURCE_COMPATIBILITY, VERSION_1_4)) {
503 //                      if (!checkValue(PREF_CODEGEN_TARGET_PLATFORM, VERSION_1_4)) {
504 //                              status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.src14tgt14.error")); //$NON-NLS-1$
505 //                              return status;
506 //                      }
507 //              }
508 //              return status;
509 //      }
510         
511         private IStatus validateMaxNumberProblems() {
512                 String number= (String) fWorkingValues.get(PREF_PB_MAX_PER_UNIT);
513                 StatusInfo status= new StatusInfo();
514                 if (number.length() == 0) {
515                         status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.empty_input")); //$NON-NLS-1$
516                 } else {
517                         try {
518                                 int value= Integer.parseInt(number);
519                                 if (value <= 0) {
520                                         status.setError(PreferencesMessages.getFormattedString("CompilerConfigurationBlock.invalid_input", number)); //$NON-NLS-1$
521                                 }
522                         } catch (NumberFormatException e) {
523                                 status.setError(PreferencesMessages.getFormattedString("CompilerConfigurationBlock.invalid_input", number)); //$NON-NLS-1$
524                         }
525                 }
526                 return status;
527         }
528         
529 //      private IStatus validateResourceFilters() {
530 //              String text= (String) fWorkingValues.get(PREF_RESOURCE_FILTER);
531 //              
532 //              IWorkspace workspace= ResourcesPlugin.getWorkspace();
533 //
534 //              String[] filters= getTokens(text, ","); //$NON-NLS-1$
535 //              for (int i= 0; i < filters.length; i++) {
536 //                      String fileName= filters[i].replace('*', 'x');
537 //                      int resourceType= IResource.FILE;
538 //                      int lastCharacter= fileName.length() - 1;
539 //                      if (lastCharacter >= 0 && fileName.charAt(lastCharacter) == '/') {
540 //                              fileName= fileName.substring(0, lastCharacter);
541 //                              resourceType= IResource.FOLDER;
542 //                      }
543 //                      IStatus status= workspace.validateName(fileName, resourceType);
544 //                      if (status.matches(IStatus.ERROR)) {
545 //                              String message= PreferencesMessages.getFormattedString("CompilerConfigurationBlock.filter.invalidsegment.error", status.getMessage()); //$NON-NLS-1$
546 //                              return new StatusInfo(IStatus.ERROR, message);
547 //                      }
548 //              }
549 //              return new StatusInfo();
550 //      }
551         
552         protected String[] getFullBuildDialogStrings(boolean workspaceSettings) {
553                 String title= PreferencesMessages.getString("CompilerConfigurationBlock.needsbuild.title"); //$NON-NLS-1$
554                 String message;
555                 if (workspaceSettings) {
556                         message= PreferencesMessages.getString("CompilerConfigurationBlock.needsfullbuild.message"); //$NON-NLS-1$
557                 } else {
558                         message= PreferencesMessages.getString("CompilerConfigurationBlock.needsprojectbuild.message"); //$NON-NLS-1$
559                 }
560                 return new String[] { title, message };
561         }       
562                         
563 }