fixed bug with some attributes
[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 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;
23
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;
34
35 /**
36   */
37 public class CompilerConfigurationBlock extends OptionsConfigurationBlock {
38
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;
43     private static final String PREF_PB_PHP_FILE_NOT_EXIST= JavaCore.COMPILER_PB_PHP_FILE_NOT_EXIST;
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;
55         
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;
77         
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;
81 //
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;
85 //
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;
89 //      
90 //      private static final String PREF_SOURCE_COMPATIBILITY= JavaCore.COMPILER_SOURCE;
91 //      private static final String PREF_COMPLIANCE= JavaCore.COMPILER_COMPLIANCE;
92 //
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;
98 //
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;
105
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;
111         
112 //      private static final String INTR_DEFAULT_COMPLIANCE= "internal.default.compliance"; //$NON-NLS-1$
113
114         // values
115         private static final String GENERATE= JavaCore.GENERATE;
116         private static final String DO_NOT_GENERATE= JavaCore.DO_NOT_GENERATE;
117         
118         private static final String PRESERVE= JavaCore.PRESERVE;
119         private static final String OPTIMIZE_OUT= JavaCore.OPTIMIZE_OUT;
120         
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;
125         
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;
130         
131         private static final String CLEAN= JavaCore.CLEAN;
132
133         private static final String ENABLED= JavaCore.ENABLED;
134         private static final String DISABLED= JavaCore.DISABLED;
135         
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;
140         
141         private static final String DEFAULT_CONF= "default"; //$NON-NLS-1$
142         private static final String USER_CONF= "user";   //$NON-NLS-1$
143
144         private ArrayList fComplianceControls;
145         private PixelConverter fPixelConverter;
146
147         private IStatus fMaxNumberProblemsStatus;
148 //      private IStatus fComplianceStatus, fMaxNumberProblemsStatus, fResourceFilterStatus;
149
150         public CompilerConfigurationBlock(IStatusChangeListener context, IJavaProject project) {
151                 super(context, project, getKeys());
152                 
153                 fComplianceControls= new ArrayList();
154                         
155 //              fComplianceStatus= new StatusInfo();
156                 fMaxNumberProblemsStatus= new StatusInfo();
157 //              fResourceFilterStatus= new StatusInfo();
158                 
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);
162 //              }
163                 
164         }
165         
166         private final static String[] KEYS= new String[] {
167             PREF_PB_PHP_FILE_NOT_EXIST,
168             PREF_PB_PHP_VAR_DEPRECATED,
169             PREF_PB_PHP_KEYWORD,
170             PREF_PB_PHP_UPPERCASE_IDENTIFIER,
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         private static  String[] getKeys() {
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_file_not_exist.label"); //$NON-NLS-1$
306                 addComboBox(composite, label, PREF_PB_PHP_FILE_NOT_EXIST, errorWarningIgnore, errorWarningIgnoreLabels, 0);                     
307                 
308                 label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_var_deprecated.label"); //$NON-NLS-1$
309                 addComboBox(composite, label, PREF_PB_PHP_VAR_DEPRECATED, errorWarningIgnore, errorWarningIgnoreLabels, 0);                     
310                 
311                 label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_keyword.label"); //$NON-NLS-1$
312                 addComboBox(composite, label, PREF_PB_PHP_KEYWORD, errorWarningIgnore, errorWarningIgnoreLabels, 0);                    
313                 
314                 label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_uppercase_identifier.label"); //$NON-NLS-1$
315                 addComboBox(composite, label, PREF_PB_PHP_UPPERCASE_IDENTIFIER, errorWarningIgnore, errorWarningIgnoreLabels, 0);                       
316                 
317                 label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_overriding_pkg_dflt.label"); //$NON-NLS-1$
318 //              addComboBox(composite, label, PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, errorWarningIgnore, errorWarningIgnoreLabels, 0);                      
319
320 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_method_naming.label"); //$NON-NLS-1$
321 //              addComboBox(composite, label, PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME, errorWarningIgnore, errorWarningIgnoreLabels, 0);                   
322 //
323 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_hidden_catchblock.label"); //$NON-NLS-1$
324 //              addComboBox(composite, label, PREF_PB_HIDDEN_CATCH_BLOCK, errorWarningIgnore, errorWarningIgnoreLabels, 0);
325 //              
326 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_static_access_receiver.label"); //$NON-NLS-1$
327 //              addComboBox(composite, label, PREF_PB_STATIC_ACCESS_RECEIVER, errorWarningIgnore, errorWarningIgnoreLabels, 0);
328 //              
329 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_no_effect_assignment.label"); //$NON-NLS-1$
330 //              addComboBox(composite, label, PREF_PB_NO_EFFECT_ASSIGNMENT, errorWarningIgnore, errorWarningIgnoreLabels, 0);
331
332 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_indirect_access_to_static.label"); //$NON-NLS-1$
333 //              addComboBox(composite, label, PREF_PB_INDIRECT_STATIC_ACCESS, errorWarningIgnore, errorWarningIgnoreLabels, 0); 
334 //
335 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_accidential_assignement.label"); //$NON-NLS-1$
336 //              addComboBox(composite, label, PREF_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT, errorWarningIgnore, errorWarningIgnoreLabels, 0);
337 //
338 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_finally_block_not_completing.label"); //$NON-NLS-1$
339 //              addComboBox(composite, label, PREF_PB_FINALLY_BLOCK_NOT_COMPLETING, errorWarningIgnore, errorWarningIgnoreLabels, 0);
340 //
341 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_undocumented_empty_block.label"); //$NON-NLS-1$
342 //              addComboBox(composite, label, PREF_PB_UNDOCUMENTED_EMPTY_BLOCK, errorWarningIgnore, errorWarningIgnoreLabels, 0);
343
344                 
345                 return composite;
346         }
347
348         private Composite createAdvancedTabContent(TabFolder folder) {
349                 String[] errorWarningIgnore= new String[] { ERROR, WARNING, IGNORE };
350                 
351                 String[] errorWarningIgnoreLabels= new String[] {
352                         PreferencesMessages.getString("CompilerConfigurationBlock.error"),  //$NON-NLS-1$
353                         PreferencesMessages.getString("CompilerConfigurationBlock.warning"), //$NON-NLS-1$
354                         PreferencesMessages.getString("CompilerConfigurationBlock.ignore") //$NON-NLS-1$
355                 };
356                 
357                 String[] enabledDisabled= new String[] { ENABLED, DISABLED };
358                 
359                 int nColumns= 3;
360                 
361                 GridLayout layout= new GridLayout();
362                 layout.numColumns= nColumns;
363                                         
364                 Composite composite= new Composite(folder, SWT.NULL);
365                 composite.setLayout(layout);
366
367                 Label description= new Label(composite, SWT.WRAP);
368                 description.setText(PreferencesMessages.getString("CompilerConfigurationBlock.advanced.description")); //$NON-NLS-1$
369                 GridData gd= new GridData();
370                 gd.horizontalSpan= nColumns;
371                 gd.widthHint= fPixelConverter.convertWidthInCharsToPixels(50);
372                 description.setLayoutData(gd);
373                         
374 //              String label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_synth_access_emul.label"); //$NON-NLS-1$
375 //              addComboBox(composite, label, PREF_PB_SYNTHETIC_ACCESS_EMULATION, errorWarningIgnore, errorWarningIgnoreLabels, 0);
376
377 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_local_variable_hiding.label"); //$NON-NLS-1$
378 //              addComboBox(composite, label, PREF_PB_LOCAL_VARIABLE_HIDING, errorWarningIgnore, errorWarningIgnoreLabels, 0);
379
380 //              int indent= fPixelConverter.convertWidthInCharsToPixels(2);
381 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_special_param_hiding.label"); //$NON-NLS-1$
382 //              addCheckBox(composite, label, PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD, enabledDisabled, indent);
383
384 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_field_hiding.label"); //$NON-NLS-1$
385 //              addComboBox(composite, label, PREF_PB_FIELD_HIDING, errorWarningIgnore, errorWarningIgnoreLabels, 0);
386
387 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_non_externalized_strings.label"); //$NON-NLS-1$
388 //              addComboBox(composite, label, PREF_PB_NON_EXTERNALIZED_STRINGS, errorWarningIgnore, errorWarningIgnoreLabels, 0);
389 //
390 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_incompatible_interface_method.label"); //$NON-NLS-1$
391 //              addComboBox(composite, label, PREF_PB_INCOMPATIBLE_INTERFACE_METHOD, errorWarningIgnore, errorWarningIgnoreLabels, 0);
392 //
393 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_char_array_in_concat.label"); //$NON-NLS-1$
394 //              addComboBox(composite, label, PREF_PB_CHAR_ARRAY_IN_CONCAT, errorWarningIgnore, errorWarningIgnoreLabels, 0);
395
396 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_unqualified_field_access.label"); //$NON-NLS-1$
397 //              addComboBox(composite, label, PREF_PB_UNQUALIFIED_FIELD_ACCESS, errorWarningIgnore, errorWarningIgnoreLabels, 0);
398                 
399                 gd= new GridData();
400                 gd.widthHint= fPixelConverter.convertWidthInCharsToPixels(6);
401                 
402                 String label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_max_per_unit.label"); //$NON-NLS-1$
403                 Text text= addTextField(composite, label, PREF_PB_MAX_PER_UNIT, 0, 0);
404                 text.setTextLimit(6);
405                 text.setLayoutData(gd);
406
407                 return composite;
408         }
409
410         
411         
412                 
413         
414         /* (non-javadoc)
415          * Update fields and validate.
416          * @param changedKey Key that changed, or null, if all changed.
417          */     
418         protected void validateSettings(String changedKey, String newValue) {
419                 
420                 if (changedKey != null) {
421 //                      if (INTR_DEFAULT_COMPLIANCE.equals(changedKey)) {
422 //                              updateComplianceEnableState();
423 //                              if (DEFAULT_CONF.equals(newValue)) {
424 //                                      updateComplianceDefaultSettings();
425 //                              }
426 //                              fComplianceStatus= validateCompliance();
427 //                      } else if (PREF_COMPLIANCE.equals(changedKey)) {
428 //                              if (checkValue(INTR_DEFAULT_COMPLIANCE, DEFAULT_CONF)) {
429 //                                      updateComplianceDefaultSettings();
430 //                              }
431 //                              fComplianceStatus= validateCompliance();
432 //                      } else if (PREF_SOURCE_COMPATIBILITY.equals(changedKey) ||
433 //                                      PREF_CODEGEN_TARGET_PLATFORM.equals(changedKey) ||
434 //                                      PREF_PB_ASSERT_AS_IDENTIFIER.equals(changedKey)) {
435 //                              fComplianceStatus= validateCompliance();
436 //                      } else 
437                           if (PREF_PB_MAX_PER_UNIT.equals(changedKey)) {
438                                 fMaxNumberProblemsStatus= validateMaxNumberProblems();
439 //                      } else if (PREF_RESOURCE_FILTER.equals(changedKey)) {
440 //                              fResourceFilterStatus= validateResourceFilters();
441 //                      } else if (S.equals(changedKey) ||
442 //                                      PREF_PB_DEPRECATION.equals(changedKey) ) { // ||
443 ////                                    PREF_PB_INVALID_JAVADOC.equals(changedKey) ||
444 ////                                    PREF_PB_MISSING_JAVADOC_TAGS.equals(changedKey) ||
445 ////                                    PREF_PB_MISSING_JAVADOC_COMMENTS.equals(changedKey) ||
446 ////                                    PREF_PB_MISSING_JAVADOC_COMMENTS.equals(changedKey) ||
447 ////                                    PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION.equals(changedKey)) {                          
448 //                              updateEnableStates();
449 //                      } else if (PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING.equals(changedKey)) {
450 //                              // merging the two options
451 //                              fWorkingValues.put(PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT, newValue);
452                         } else {
453                                 return;
454                         }
455                 } else {
456 //                      updateEnableStates();
457 //                      updateComplianceEnableState();
458 //                      fComplianceStatus= validateCompliance();
459                         fMaxNumberProblemsStatus= validateMaxNumberProblems();
460 //                      fResourceFilterStatus= validateResourceFilters();
461                 }               
462 //              IStatus status= StatusUtil.getMostSevere(new IStatus[] { fComplianceStatus, fMaxNumberProblemsStatus, fResourceFilterStatus });
463                 IStatus status= StatusUtil.getMostSevere(new IStatus[] { fMaxNumberProblemsStatus });
464                 fContext.statusChanged(status);
465         }
466         
467 //      private void updateEnableStates() {
468 //              boolean enableUnusedParams= !checkValue(PREF_PB_UNUSED_PARAMETER, IGNORE);
469 //              getCheckBox(PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING).setEnabled(enableUnusedParams);
470                 
471 //              boolean enableDeprecation= !checkValue(PREF_PB_DEPRECATION, IGNORE);
472 //              getCheckBox(PREF_PB_DEPRECATION_IN_DEPRECATED_CODE).setEnabled(enableDeprecation);
473 //              getCheckBox(PREF_PB_DEPRECATION_WHEN_OVERRIDING).setEnabled(enableDeprecation);
474 //              
475 //              boolean enableThrownExceptions= !checkValue(PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION, IGNORE);
476 //              getCheckBox(PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING).setEnabled(enableThrownExceptions);
477 //
478 //              boolean enableHiding= !checkValue(PREF_PB_LOCAL_VARIABLE_HIDING, IGNORE);
479 //              getCheckBox(PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD).setEnabled(enableHiding);
480 //
481 //              boolean enableInvalidTagsErrors= !checkValue(PREF_PB_INVALID_JAVADOC, IGNORE);
482 //              getCheckBox(PREF_PB_INVALID_JAVADOC_TAGS).setEnabled(enableInvalidTagsErrors);
483 //              setComboEnabled(PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY, enableInvalidTagsErrors);
484 //              
485 //              boolean enableMissingTagsErrors= !checkValue(PREF_PB_MISSING_JAVADOC_TAGS, IGNORE);
486 //              getCheckBox(PREF_PB_MISSING_JAVADOC_TAGS_OVERRIDING).setEnabled(enableMissingTagsErrors);
487 //              setComboEnabled(PREF_PB_MISSING_JAVADOC_TAGS_VISIBILITY, enableMissingTagsErrors);
488 //              
489 //              boolean enableMissingCommentsErrors= !checkValue(PREF_PB_MISSING_JAVADOC_COMMENTS, IGNORE);
490 //              getCheckBox(PREF_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING).setEnabled(enableMissingCommentsErrors);
491 //              setComboEnabled(PREF_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY, enableMissingCommentsErrors);
492 //      }
493
494 //      private IStatus validateCompliance() {
495 //              StatusInfo status= new StatusInfo();
496 //              if (checkValue(PREF_COMPLIANCE, VERSION_1_3)) {
497 //                      if (checkValue(PREF_SOURCE_COMPATIBILITY, VERSION_1_4)) {
498 //                              status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.cpl13src14.error")); //$NON-NLS-1$
499 //                              return status;
500 //                      } else if (checkValue(PREF_CODEGEN_TARGET_PLATFORM, VERSION_1_4)) {
501 //                              status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.cpl13trg14.error")); //$NON-NLS-1$
502 //                              return status;
503 //                      }
504 //              }
505 //              if (checkValue(PREF_SOURCE_COMPATIBILITY, VERSION_1_4)) {
506 //                      if (!checkValue(PREF_PB_ASSERT_AS_IDENTIFIER, ERROR)) {
507 //                              status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.src14asrterr.error")); //$NON-NLS-1$
508 //                              return status;
509 //                      }
510 //              }
511 //              if (checkValue(PREF_SOURCE_COMPATIBILITY, VERSION_1_4)) {
512 //                      if (!checkValue(PREF_CODEGEN_TARGET_PLATFORM, VERSION_1_4)) {
513 //                              status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.src14tgt14.error")); //$NON-NLS-1$
514 //                              return status;
515 //                      }
516 //              }
517 //              return status;
518 //      }
519         
520         private IStatus validateMaxNumberProblems() {
521                 String number= (String) fWorkingValues.get(PREF_PB_MAX_PER_UNIT);
522                 StatusInfo status= new StatusInfo();
523                 if (number.length() == 0) {
524                         status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.empty_input")); //$NON-NLS-1$
525                 } else {
526                         try {
527                                 int value= Integer.parseInt(number);
528                                 if (value <= 0) {
529                                         status.setError(PreferencesMessages.getFormattedString("CompilerConfigurationBlock.invalid_input", number)); //$NON-NLS-1$
530                                 }
531                         } catch (NumberFormatException e) {
532                                 status.setError(PreferencesMessages.getFormattedString("CompilerConfigurationBlock.invalid_input", number)); //$NON-NLS-1$
533                         }
534                 }
535                 return status;
536         }
537         
538 //      private IStatus validateResourceFilters() {
539 //              String text= (String) fWorkingValues.get(PREF_RESOURCE_FILTER);
540 //              
541 //              IWorkspace workspace= ResourcesPlugin.getWorkspace();
542 //
543 //              String[] filters= getTokens(text, ","); //$NON-NLS-1$
544 //              for (int i= 0; i < filters.length; i++) {
545 //                      String fileName= filters[i].replace('*', 'x');
546 //                      int resourceType= IResource.FILE;
547 //                      int lastCharacter= fileName.length() - 1;
548 //                      if (lastCharacter >= 0 && fileName.charAt(lastCharacter) == '/') {
549 //                              fileName= fileName.substring(0, lastCharacter);
550 //                              resourceType= IResource.FOLDER;
551 //                      }
552 //                      IStatus status= workspace.validateName(fileName, resourceType);
553 //                      if (status.matches(IStatus.ERROR)) {
554 //                              String message= PreferencesMessages.getFormattedString("CompilerConfigurationBlock.filter.invalidsegment.error", status.getMessage()); //$NON-NLS-1$
555 //                              return new StatusInfo(IStatus.ERROR, message);
556 //                      }
557 //              }
558 //              return new StatusInfo();
559 //      }
560         
561         protected String[] getFullBuildDialogStrings(boolean workspaceSettings) {
562                 String title= PreferencesMessages.getString("CompilerConfigurationBlock.needsbuild.title"); //$NON-NLS-1$
563                 String message;
564                 if (workspaceSettings) {
565                         message= PreferencesMessages.getString("CompilerConfigurationBlock.needsfullbuild.message"); //$NON-NLS-1$
566                 } else {
567                         message= PreferencesMessages.getString("CompilerConfigurationBlock.needsprojectbuild.message"); //$NON-NLS-1$
568                 }
569                 return new String[] { title, message };
570         }       
571                         
572 }