Deleted unused commenst and unused vars.
[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
42         private static final String PREF_PB_PHP_KEYWORD = JavaCore.COMPILER_PB_PHP_KEYWORD;
43
44         private static final String PREF_PB_PHP_UPPERCASE_IDENTIFIER = JavaCore.COMPILER_PB_PHP_UPPERCASE_IDENTIFIER;
45
46         private static final String PREF_PB_PHP_FILE_NOT_EXIST = JavaCore.COMPILER_PB_PHP_FILE_NOT_EXIST;
47
48         private static final String PREF_PB_UNREACHABLE_CODE = JavaCore.COMPILER_PB_UNREACHABLE_CODE;
49
50         private static final String PREF_PB_UNINITIALIZED_LOCAL_VARIABLE = JavaCore.COMPILER_PB_UNINITIALIZED_LOCAL_VARIABLE;
51
52         // private static final String PREF_LOCAL_VARIABLE_ATTR=
53         // JavaCore.COMPILER_LOCAL_VARIABLE_ATTR;
54         // private static final String PREF_LINE_NUMBER_ATTR=
55         // JavaCore.COMPILER_LINE_NUMBER_ATTR;
56         // private static final String PREF_SOURCE_FILE_ATTR=
57         // JavaCore.COMPILER_SOURCE_FILE_ATTR;
58         // private static final String PREF_CODEGEN_UNUSED_LOCAL=
59         // JavaCore.COMPILER_CODEGEN_UNUSED_LOCAL;
60         // private static final String PREF_CODEGEN_TARGET_PLATFORM=
61         // JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM;
62         // private static final String PREF_PB_UNREACHABLE_CODE=
63         // JavaCore.COMPILER_PB_UNREACHABLE_CODE;
64         // private static final String PREF_PB_INVALID_IMPORT=
65         // JavaCore.COMPILER_PB_INVALID_IMPORT;
66         // private static final String PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD=
67         // JavaCore.COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD;
68         // private static final String PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME=
69         // JavaCore.COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME;
70         // private static final String PREF_PB_DEPRECATION=
71         // JavaCore.COMPILER_PB_DEPRECATION;
72         // private static final String PREF_PB_DEPRECATION_WHEN_OVERRIDING=
73         // JavaCore.COMPILER_PB_DEPRECATION_WHEN_OVERRIDING_DEPRECATED_METHOD;
74
75         // private static final String PREF_PB_HIDDEN_CATCH_BLOCK=
76         // JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK;
77         // private static final String PREF_PB_UNUSED_LOCAL=
78         // JavaCore.COMPILER_PB_UNUSED_LOCAL;
79         // private static final String PREF_PB_UNUSED_PARAMETER=
80         // JavaCore.COMPILER_PB_UNUSED_PARAMETER;
81         // private static final String PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING=
82         // JavaCore.COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE;
83         // private static final String PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT=
84         // JavaCore.COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT;
85         // private static final String PREF_PB_SYNTHETIC_ACCESS_EMULATION=
86         // JavaCore.COMPILER_PB_SYNTHETIC_ACCESS_EMULATION;
87         // private static final String PREF_PB_NON_EXTERNALIZED_STRINGS=
88         // JavaCore.COMPILER_PB_NON_NLS_STRING_LITERAL;
89         // private static final String PREF_PB_ASSERT_AS_IDENTIFIER=
90         // JavaCore.COMPILER_PB_ASSERT_IDENTIFIER;
91         private static final String PREF_PB_MAX_PER_UNIT = JavaCore.COMPILER_PB_MAX_PER_UNIT;
92
93         // private static final String PREF_PB_UNUSED_IMPORT=
94         // JavaCore.COMPILER_PB_UNUSED_IMPORT;
95         // private static final String PREF_PB_UNUSED_PRIVATE=
96         // JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER;
97         // private static final String PREF_PB_STATIC_ACCESS_RECEIVER=
98         // JavaCore.COMPILER_PB_STATIC_ACCESS_RECEIVER;
99         // private static final String PREF_PB_NO_EFFECT_ASSIGNMENT=
100         // JavaCore.COMPILER_PB_NO_EFFECT_ASSIGNMENT;
101         // private static final String PREF_PB_CHAR_ARRAY_IN_CONCAT=
102         // JavaCore.COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION;
103         // private static final String
104         // PREF_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT=
105         // JavaCore.COMPILER_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT;
106         // private static final String PREF_PB_LOCAL_VARIABLE_HIDING=
107         // JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING;
108         // private static final String PREF_PB_FIELD_HIDING=
109         // JavaCore.COMPILER_PB_FIELD_HIDING;
110         // private static final String PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD=
111         // JavaCore.COMPILER_PB_SPECIAL_PARAMETER_HIDING_FIELD;
112         // private static final String PREF_PB_INDIRECT_STATIC_ACCESS=
113         // JavaCore.COMPILER_PB_INDIRECT_STATIC_ACCESS;
114         // private static final String PREF_PB_SUPERFLUOUS_SEMICOLON=
115         // JavaCore.COMPILER_PB_SUPERFLUOUS_SEMICOLON;
116         // private static final String PREF_PB_UNNECESSARY_TYPE_CHECK=
117         // JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK;
118
119         // private static final String PREF_PB_INVALID_JAVADOC=
120         // JavaCore.COMPILER_PB_INVALID_JAVADOC;
121         // private static final String PREF_PB_INVALID_JAVADOC_TAGS=
122         // JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS;
123         // private static final String PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY=
124         // JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS_VISIBILITY;
125         //
126         // private static final String PREF_PB_MISSING_JAVADOC_TAGS=
127         // JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS;
128         // private static final String PREF_PB_MISSING_JAVADOC_TAGS_VISIBILITY=
129         // JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS_VISIBILITY;
130         // private static final String PREF_PB_MISSING_JAVADOC_TAGS_OVERRIDING=
131         // JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS_OVERRIDING;
132         //
133         // private static final String PREF_PB_MISSING_JAVADOC_COMMENTS=
134         // JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS;
135         // private static final String PREF_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY=
136         // JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY;
137         // private static final String PREF_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING=
138         // JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING;
139         //      
140         // private static final String PREF_SOURCE_COMPATIBILITY=
141         // JavaCore.COMPILER_SOURCE;
142         // private static final String PREF_COMPLIANCE=
143         // JavaCore.COMPILER_COMPLIANCE;
144         //
145         // private static final String PREF_RESOURCE_FILTER=
146         // JavaCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER;
147         // private static final String PREF_BUILD_INVALID_CLASSPATH=
148         // JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH;
149         // private static final String PREF_BUILD_CLEAN_OUTPUT_FOLDER=
150         // JavaCore.CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER;
151         // private static final String PREF_ENABLE_EXCLUSION_PATTERNS=
152         // JavaCore.CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS;
153         // private static final String PREF_ENABLE_MULTIPLE_OUTPUT_LOCATIONS=
154         // JavaCore.CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS;
155         //
156         // private static final String PREF_PB_INCOMPLETE_BUILDPATH=
157         // JavaCore.CORE_INCOMPLETE_CLASSPATH;
158         // private static final String PREF_PB_CIRCULAR_BUILDPATH=
159         // JavaCore.CORE_CIRCULAR_CLASSPATH;
160         // // private static final String PREF_PB_INCOMPATIBLE_JDK_LEVEL=
161         // JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL;
162         // private static final String PREF_PB_DEPRECATION_IN_DEPRECATED_CODE=
163         // JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE;
164         // private static final String PREF_PB_DUPLICATE_RESOURCE=
165         // JavaCore.CORE_JAVA_BUILD_DUPLICATE_RESOURCE;
166         // private static final String PREF_PB_INCOMPATIBLE_INTERFACE_METHOD=
167         // JavaCore.COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD;
168
169         // private static final String PREF_PB_UNDOCUMENTED_EMPTY_BLOCK=
170         // JavaCore.COMPILER_PB_UNDOCUMENTED_EMPTY_BLOCK;
171         // private static final String PREF_PB_FINALLY_BLOCK_NOT_COMPLETING=
172         // JavaCore.COMPILER_PB_FINALLY_BLOCK_NOT_COMPLETING;
173         // private static final String PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION=
174         // JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION;
175         // private static final String
176         // PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING=
177         // JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING;
178         // private static final String PREF_PB_UNQUALIFIED_FIELD_ACCESS=
179         // JavaCore.COMPILER_PB_UNQUALIFIED_FIELD_ACCESS;
180
181         // private static final String INTR_DEFAULT_COMPLIANCE=
182         // "internal.default.compliance"; //$NON-NLS-1$
183
184         // values
185         private static final String GENERATE = JavaCore.GENERATE;
186
187         private static final String DO_NOT_GENERATE = JavaCore.DO_NOT_GENERATE;
188
189         private static final String PRESERVE = JavaCore.PRESERVE;
190
191         private static final String OPTIMIZE_OUT = JavaCore.OPTIMIZE_OUT;
192
193         private static final String VERSION_1_1 = JavaCore.VERSION_1_1;
194
195         private static final String VERSION_1_2 = JavaCore.VERSION_1_2;
196
197         private static final String VERSION_1_3 = JavaCore.VERSION_1_3;
198
199         private static final String VERSION_1_4 = JavaCore.VERSION_1_4;
200
201         private static final String ERROR = JavaCore.ERROR;
202
203         private static final String WARNING = JavaCore.WARNING;
204
205         private static final String IGNORE = JavaCore.IGNORE;
206
207         private static final String ABORT = JavaCore.ABORT;
208
209         private static final String CLEAN = JavaCore.CLEAN;
210
211         private static final String ENABLED = JavaCore.ENABLED;
212
213         private static final String DISABLED = JavaCore.DISABLED;
214
215         // private static final String PUBLIC= JavaCore.PUBLIC;
216         // private static final String PROTECTED= JavaCore.PROTECTED;
217         // private static final String DEFAULT= JavaCore.DEFAULT;
218         // private static final String PRIVATE= JavaCore.PRIVATE;
219
220         private static final String DEFAULT_CONF = "default"; //$NON-NLS-1$
221
222         private static final String USER_CONF = "user"; //$NON-NLS-1$
223
224         private ArrayList fComplianceControls;
225
226         private PixelConverter fPixelConverter;
227
228         private IStatus fMaxNumberProblemsStatus;
229
230         // private IStatus fComplianceStatus, fMaxNumberProblemsStatus,
231         // fResourceFilterStatus;
232
233         public CompilerConfigurationBlock(IStatusChangeListener context,
234                         IJavaProject project) {
235                 super(context, project, getKeys());
236
237                 fComplianceControls = new ArrayList();
238
239                 // fComplianceStatus= new StatusInfo();
240                 fMaxNumberProblemsStatus = new StatusInfo();
241                 // fResourceFilterStatus= new StatusInfo();
242
243                 // compatibilty code for the merge of the two option
244                 // PB_SIGNAL_PARAMETER:
245                 // if
246                 // (ENABLED.equals(fWorkingValues.get(PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT)))
247                 // {
248                 // fWorkingValues.put(PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING, ENABLED);
249                 // }
250
251         }
252
253         private final static String[] KEYS = new String[] {
254                         PREF_PB_PHP_FILE_NOT_EXIST, PREF_PB_PHP_VAR_DEPRECATED,
255                         PREF_PB_PHP_KEYWORD, PREF_PB_PHP_UPPERCASE_IDENTIFIER,
256                         PREF_PB_UNREACHABLE_CODE, PREF_PB_UNINITIALIZED_LOCAL_VARIABLE,
257                         // PREF_LOCAL_VARIABLE_ATTR,
258                         // PREF_LINE_NUMBER_ATTR, PREF_SOURCE_FILE_ATTR,
259                         // PREF_CODEGEN_UNUSED_LOCAL,
260                         // PREF_CODEGEN_TARGET_PLATFORM,
261                         // PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD,
262                         // PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME,
263                         // PREF_PB_DEPRECATION,
264                         // PREF_PB_HIDDEN_CATCH_BLOCK, PREF_PB_UNUSED_LOCAL,
265                         // PREF_PB_UNUSED_PARAMETER,
266                         // PREF_PB_SYNTHETIC_ACCESS_EMULATION,
267                         // PREF_PB_NON_EXTERNALIZED_STRINGS,
268                         // PREF_PB_ASSERT_AS_IDENTIFIER,
269                         // PREF_PB_UNUSED_IMPORT,
270                         PREF_PB_MAX_PER_UNIT,
271         // PREF_SOURCE_COMPATIBILITY,
272         // PREF_COMPLIANCE,
273         // PREF_RESOURCE_FILTER, PREF_BUILD_INVALID_CLASSPATH,
274         // PREF_PB_STATIC_ACCESS_RECEIVER, PREF_PB_INCOMPLETE_BUILDPATH,
275         // PREF_PB_CIRCULAR_BUILDPATH, PREF_PB_DEPRECATION_IN_DEPRECATED_CODE,
276         // PREF_BUILD_CLEAN_OUTPUT_FOLDER,
277         // PREF_PB_DUPLICATE_RESOURCE, PREF_PB_NO_EFFECT_ASSIGNMENT,
278         // PREF_PB_INCOMPATIBLE_INTERFACE_METHOD,
279         // PREF_PB_UNUSED_PRIVATE, PREF_PB_CHAR_ARRAY_IN_CONCAT,
280         // PREF_ENABLE_EXCLUSION_PATTERNS, PREF_ENABLE_MULTIPLE_OUTPUT_LOCATIONS,
281         // PREF_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT,
282         // PREF_PB_LOCAL_VARIABLE_HIDING,
283         // PREF_PB_FIELD_HIDING,
284         // PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD,
285         // PREF_PB_INCOMPATIBLE_JDK_LEVEL,
286         // PREF_PB_INDIRECT_STATIC_ACCESS,
287         // PREF_PB_SUPERFLUOUS_SEMICOLON,
288         // PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING,
289         // PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT,
290         // PREF_PB_UNNECESSARY_TYPE_CHECK,
291         // PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION,
292         // PREF_PB_UNQUALIFIED_FIELD_ACCESS,
293         // PREF_PB_UNDOCUMENTED_EMPTY_BLOCK,
294         // PREF_PB_FINALLY_BLOCK_NOT_COMPLETING,
295         // PREF_PB_DEPRECATION_WHEN_OVERRIDING,
296         // PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING,
297
298         // PREF_PB_INVALID_JAVADOC,
299         // PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY,
300         // PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY,
301         // PREF_PB_MISSING_JAVADOC_TAGS,
302         // PREF_PB_MISSING_JAVADOC_TAGS_VISIBILITY,
303         // PREF_PB_MISSING_JAVADOC_TAGS_OVERRIDING,
304         // PREF_PB_MISSING_JAVADOC_COMMENTS,
305         // PREF_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY,
306         // PREF_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING
307         };
308
309         private static String[] getKeys() {
310                 return KEYS;
311         }
312
313         protected final Map getOptions(boolean inheritJavaCoreOptions) {
314                 Map map = super.getOptions(inheritJavaCoreOptions);
315                 // map.put(INTR_DEFAULT_COMPLIANCE, getCurrentCompliance(map));
316                 return map;
317         }
318
319         protected final Map getDefaultOptions() {
320                 Map map = super.getDefaultOptions();
321                 // map.put(INTR_DEFAULT_COMPLIANCE, getCurrentCompliance(map));
322                 return map;
323         }
324
325         /*
326          * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
327          */
328         protected Control createContents(Composite parent) {
329                 fPixelConverter = new PixelConverter(parent);
330                 setShell(parent.getShell());
331
332                 TabFolder folder = new TabFolder(parent, SWT.NONE);
333                 folder.setLayout(new TabFolderLayout());
334                 folder.setLayoutData(new GridData(GridData.FILL_BOTH));
335
336                 Composite commonComposite = createStyleTabContent(folder);
337                 // Composite unusedComposite= createUnusedCodeTabContent(folder);
338                 Composite advancedComposite = createAdvancedTabContent(folder);
339                 // Composite javadocComposite= createJavadocTabContent(folder);
340                 // Composite complianceComposite= createComplianceTabContent(folder);
341                 // Composite othersComposite= createBuildPathTabContent(folder);
342
343                 TabItem item = new TabItem(folder, SWT.NONE);
344                 item.setText(PreferencesMessages
345                                 .getString("CompilerConfigurationBlock.common.tabtitle")); //$NON-NLS-1$
346                 item.setControl(commonComposite);
347
348                 item = new TabItem(folder, SWT.NONE);
349                 item.setText(PreferencesMessages
350                                 .getString("CompilerConfigurationBlock.advanced.tabtitle")); //$NON-NLS-1$
351                 item.setControl(advancedComposite);
352
353                 // item= new TabItem(folder, SWT.NONE);
354                 // item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.unused.tabtitle"));
355                 // //$NON-NLS-1$
356                 // item.setControl(unusedComposite);
357
358                 // item= new TabItem(folder, SWT.NONE);
359                 // item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.javadoc.tabtitle"));
360                 // //$NON-NLS-1$
361                 // item.setControl(javadocComposite);
362
363                 // item= new TabItem(folder, SWT.NONE);
364                 // item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.compliance.tabtitle"));
365                 // //$NON-NLS-1$
366                 // item.setControl(complianceComposite);
367
368                 // item= new TabItem(folder, SWT.NONE);
369                 // item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.others.tabtitle"));
370                 // //$NON-NLS-1$
371                 // item.setControl(othersComposite);
372
373                 validateSettings(null, null);
374
375                 return folder;
376         }
377
378         private Composite createStyleTabContent(Composite folder) {
379                 String[] errorWarningIgnore = new String[] { ERROR, WARNING, IGNORE };
380
381                 String[] errorWarningIgnoreLabels = new String[] {
382                                 PreferencesMessages
383                                                 .getString("CompilerConfigurationBlock.error"), //$NON-NLS-1$
384                                 PreferencesMessages
385                                                 .getString("CompilerConfigurationBlock.warning"), //$NON-NLS-1$
386                                 PreferencesMessages
387                                                 .getString("CompilerConfigurationBlock.ignore") //$NON-NLS-1$
388                 };
389
390                 int nColumns = 3;
391
392                 GridLayout layout = new GridLayout();
393                 layout.numColumns = nColumns;
394
395                 Composite composite = new Composite(folder, SWT.NULL);
396                 composite.setLayout(layout);
397
398                 Label description = new Label(composite, SWT.WRAP);
399                 description.setText(PreferencesMessages
400                                 .getString("CompilerConfigurationBlock.common.description")); //$NON-NLS-1$
401                 GridData gd = new GridData();
402                 gd.horizontalSpan = nColumns;
403                 gd.widthHint = fPixelConverter.convertWidthInCharsToPixels(50);
404                 description.setLayoutData(gd);
405
406                 String label = PreferencesMessages
407                                 .getString("CompilerConfigurationBlock.pb_file_not_exist.label"); //$NON-NLS-1$
408                 addComboBox(composite, label, PREF_PB_PHP_FILE_NOT_EXIST,
409                                 errorWarningIgnore, errorWarningIgnoreLabels, 0);
410
411                 label = PreferencesMessages
412                                 .getString("CompilerConfigurationBlock.pb_var_deprecated.label"); //$NON-NLS-1$
413                 addComboBox(composite, label, PREF_PB_PHP_VAR_DEPRECATED,
414                                 errorWarningIgnore, errorWarningIgnoreLabels, 0);
415
416                 label = PreferencesMessages
417                                 .getString("CompilerConfigurationBlock.pb_keyword.label"); //$NON-NLS-1$
418                 addComboBox(composite, label, PREF_PB_PHP_KEYWORD, errorWarningIgnore,
419                                 errorWarningIgnoreLabels, 0);
420
421                 label = PreferencesMessages
422                                 .getString("CompilerConfigurationBlock.pb_uppercase_identifier.label"); //$NON-NLS-1$
423                 addComboBox(composite, label, PREF_PB_PHP_UPPERCASE_IDENTIFIER,
424                                 errorWarningIgnore, errorWarningIgnoreLabels, 0);
425
426                 label = PreferencesMessages
427                                 .getString("CompilerConfigurationBlock.pb_unreachable_code.label"); //$NON-NLS-1$
428                 addComboBox(composite, label, PREF_PB_UNREACHABLE_CODE,
429                                 errorWarningIgnore, errorWarningIgnoreLabels, 0);
430
431                 label = PreferencesMessages
432                                 .getString("CompilerConfigurationBlock.pb_unitialized_local_variable.label"); //$NON-NLS-1$
433                 addComboBox(composite, label, PREF_PB_UNINITIALIZED_LOCAL_VARIABLE,
434                                 errorWarningIgnore, errorWarningIgnoreLabels, 0);
435
436                 label = PreferencesMessages
437                                 .getString("CompilerConfigurationBlock.pb_overriding_pkg_dflt.label"); //$NON-NLS-1$
438                 // addComboBox(composite, label,
439                 // PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, errorWarningIgnore,
440                 // errorWarningIgnoreLabels, 0);
441
442                 // label=
443                 // PreferencesMessages.getString("CompilerConfigurationBlock.pb_method_naming.label");
444                 // //$NON-NLS-1$
445                 // addComboBox(composite, label, PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME,
446                 // errorWarningIgnore, errorWarningIgnoreLabels, 0);
447                 //
448                 // label=
449                 // PreferencesMessages.getString("CompilerConfigurationBlock.pb_hidden_catchblock.label");
450                 // //$NON-NLS-1$
451                 // addComboBox(composite, label, PREF_PB_HIDDEN_CATCH_BLOCK,
452                 // errorWarningIgnore, errorWarningIgnoreLabels, 0);
453                 //              
454                 // label=
455                 // PreferencesMessages.getString("CompilerConfigurationBlock.pb_static_access_receiver.label");
456                 // //$NON-NLS-1$
457                 // addComboBox(composite, label, PREF_PB_STATIC_ACCESS_RECEIVER,
458                 // errorWarningIgnore, errorWarningIgnoreLabels, 0);
459                 //              
460                 // label=
461                 // PreferencesMessages.getString("CompilerConfigurationBlock.pb_no_effect_assignment.label");
462                 // //$NON-NLS-1$
463                 // addComboBox(composite, label, PREF_PB_NO_EFFECT_ASSIGNMENT,
464                 // errorWarningIgnore, errorWarningIgnoreLabels, 0);
465
466                 // label=
467                 // PreferencesMessages.getString("CompilerConfigurationBlock.pb_indirect_access_to_static.label");
468                 // //$NON-NLS-1$
469                 // addComboBox(composite, label, PREF_PB_INDIRECT_STATIC_ACCESS,
470                 // errorWarningIgnore, errorWarningIgnoreLabels, 0);
471                 //
472                 // label=
473                 // PreferencesMessages.getString("CompilerConfigurationBlock.pb_accidential_assignement.label");
474                 // //$NON-NLS-1$
475                 // addComboBox(composite, label,
476                 // PREF_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT, errorWarningIgnore,
477                 // errorWarningIgnoreLabels, 0);
478                 //
479                 // label=
480                 // PreferencesMessages.getString("CompilerConfigurationBlock.pb_finally_block_not_completing.label");
481                 // //$NON-NLS-1$
482                 // addComboBox(composite, label, PREF_PB_FINALLY_BLOCK_NOT_COMPLETING,
483                 // errorWarningIgnore, errorWarningIgnoreLabels, 0);
484                 //
485                 // label=
486                 // PreferencesMessages.getString("CompilerConfigurationBlock.pb_undocumented_empty_block.label");
487                 // //$NON-NLS-1$
488                 // addComboBox(composite, label, PREF_PB_UNDOCUMENTED_EMPTY_BLOCK,
489                 // errorWarningIgnore, errorWarningIgnoreLabels, 0);
490
491                 return composite;
492         }
493
494         private Composite createAdvancedTabContent(TabFolder folder) {
495                 String[] errorWarningIgnore = new String[] { ERROR, WARNING, IGNORE };
496
497                 String[] errorWarningIgnoreLabels = new String[] {
498                                 PreferencesMessages
499                                                 .getString("CompilerConfigurationBlock.error"), //$NON-NLS-1$
500                                 PreferencesMessages
501                                                 .getString("CompilerConfigurationBlock.warning"), //$NON-NLS-1$
502                                 PreferencesMessages
503                                                 .getString("CompilerConfigurationBlock.ignore") //$NON-NLS-1$
504                 };
505
506                 String[] enabledDisabled = new String[] { ENABLED, DISABLED };
507
508                 int nColumns = 3;
509
510                 GridLayout layout = new GridLayout();
511                 layout.numColumns = nColumns;
512
513                 Composite composite = new Composite(folder, SWT.NULL);
514                 composite.setLayout(layout);
515
516                 Label description = new Label(composite, SWT.WRAP);
517                 description.setText(PreferencesMessages
518                                 .getString("CompilerConfigurationBlock.advanced.description")); //$NON-NLS-1$
519                 GridData gd = new GridData();
520                 gd.horizontalSpan = nColumns;
521                 gd.widthHint = fPixelConverter.convertWidthInCharsToPixels(50);
522                 description.setLayoutData(gd);
523
524                 // String label=
525                 // PreferencesMessages.getString("CompilerConfigurationBlock.pb_synth_access_emul.label");
526                 // //$NON-NLS-1$
527                 // addComboBox(composite, label, PREF_PB_SYNTHETIC_ACCESS_EMULATION,
528                 // errorWarningIgnore, errorWarningIgnoreLabels, 0);
529
530                 // label=
531                 // PreferencesMessages.getString("CompilerConfigurationBlock.pb_local_variable_hiding.label");
532                 // //$NON-NLS-1$
533                 // addComboBox(composite, label, PREF_PB_LOCAL_VARIABLE_HIDING,
534                 // errorWarningIgnore, errorWarningIgnoreLabels, 0);
535
536                 // int indent= fPixelConverter.convertWidthInCharsToPixels(2);
537                 // label=
538                 // PreferencesMessages.getString("CompilerConfigurationBlock.pb_special_param_hiding.label");
539                 // //$NON-NLS-1$
540                 // addCheckBox(composite, label, PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD,
541                 // enabledDisabled, indent);
542
543                 // label=
544                 // PreferencesMessages.getString("CompilerConfigurationBlock.pb_field_hiding.label");
545                 // //$NON-NLS-1$
546                 // addComboBox(composite, label, PREF_PB_FIELD_HIDING,
547                 // errorWarningIgnore, errorWarningIgnoreLabels, 0);
548
549                 // label=
550                 // PreferencesMessages.getString("CompilerConfigurationBlock.pb_non_externalized_strings.label");
551                 // //$NON-NLS-1$
552                 // addComboBox(composite, label, PREF_PB_NON_EXTERNALIZED_STRINGS,
553                 // errorWarningIgnore, errorWarningIgnoreLabels, 0);
554                 //
555                 // label=
556                 // PreferencesMessages.getString("CompilerConfigurationBlock.pb_incompatible_interface_method.label");
557                 // //$NON-NLS-1$
558                 // addComboBox(composite, label, PREF_PB_INCOMPATIBLE_INTERFACE_METHOD,
559                 // errorWarningIgnore, errorWarningIgnoreLabels, 0);
560                 //
561                 // label=
562                 // PreferencesMessages.getString("CompilerConfigurationBlock.pb_char_array_in_concat.label");
563                 // //$NON-NLS-1$
564                 // addComboBox(composite, label, PREF_PB_CHAR_ARRAY_IN_CONCAT,
565                 // errorWarningIgnore, errorWarningIgnoreLabels, 0);
566
567                 // label=
568                 // PreferencesMessages.getString("CompilerConfigurationBlock.pb_unqualified_field_access.label");
569                 // //$NON-NLS-1$
570                 // addComboBox(composite, label, PREF_PB_UNQUALIFIED_FIELD_ACCESS,
571                 // errorWarningIgnore, errorWarningIgnoreLabels, 0);
572
573                 gd = new GridData();
574                 gd.widthHint = fPixelConverter.convertWidthInCharsToPixels(6);
575
576                 String label = PreferencesMessages
577                                 .getString("CompilerConfigurationBlock.pb_max_per_unit.label"); //$NON-NLS-1$
578                 Text text = addTextField(composite, label, PREF_PB_MAX_PER_UNIT, 0, 0);
579                 text.setTextLimit(6);
580                 text.setLayoutData(gd);
581
582                 return composite;
583         }
584
585         /*
586          * (non-javadoc) Update fields and validate. @param changedKey Key that
587          * changed, or null, if all changed.
588          */
589         protected void validateSettings(String changedKey, String newValue) {
590
591                 if (changedKey != null) {
592                         // if (INTR_DEFAULT_COMPLIANCE.equals(changedKey)) {
593                         // updateComplianceEnableState();
594                         // if (DEFAULT_CONF.equals(newValue)) {
595                         // updateComplianceDefaultSettings();
596                         // }
597                         // fComplianceStatus= validateCompliance();
598                         // } else if (PREF_COMPLIANCE.equals(changedKey)) {
599                         // if (checkValue(INTR_DEFAULT_COMPLIANCE, DEFAULT_CONF)) {
600                         // updateComplianceDefaultSettings();
601                         // }
602                         // fComplianceStatus= validateCompliance();
603                         // } else if (PREF_SOURCE_COMPATIBILITY.equals(changedKey) ||
604                         // PREF_CODEGEN_TARGET_PLATFORM.equals(changedKey) ||
605                         // PREF_PB_ASSERT_AS_IDENTIFIER.equals(changedKey)) {
606                         // fComplianceStatus= validateCompliance();
607                         // } else
608                         if (PREF_PB_MAX_PER_UNIT.equals(changedKey)) {
609                                 fMaxNumberProblemsStatus = validateMaxNumberProblems();
610                                 // } else if (PREF_RESOURCE_FILTER.equals(changedKey)) {
611                                 // fResourceFilterStatus= validateResourceFilters();
612                                 // } else if (S.equals(changedKey) ||
613                                 // PREF_PB_DEPRECATION.equals(changedKey) ) { // ||
614                                 // // PREF_PB_INVALID_JAVADOC.equals(changedKey) ||
615                                 // // PREF_PB_MISSING_JAVADOC_TAGS.equals(changedKey) ||
616                                 // // PREF_PB_MISSING_JAVADOC_COMMENTS.equals(changedKey) ||
617                                 // // PREF_PB_MISSING_JAVADOC_COMMENTS.equals(changedKey) ||
618                                 // //
619                                 // PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION.equals(changedKey))
620                                 // {
621                                 // updateEnableStates();
622                                 // } else if
623                                 // (PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING.equals(changedKey)) {
624                                 // // merging the two options
625                                 // fWorkingValues.put(PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT,
626                                 // newValue);
627                         } else {
628                                 return;
629                         }
630                 } else {
631                         // updateEnableStates();
632                         // updateComplianceEnableState();
633                         // fComplianceStatus= validateCompliance();
634                         fMaxNumberProblemsStatus = validateMaxNumberProblems();
635                         // fResourceFilterStatus= validateResourceFilters();
636                 }
637                 // IStatus status= StatusUtil.getMostSevere(new IStatus[] {
638                 // fComplianceStatus, fMaxNumberProblemsStatus, fResourceFilterStatus
639                 // });
640                 IStatus status = StatusUtil
641                                 .getMostSevere(new IStatus[] { fMaxNumberProblemsStatus });
642                 fContext.statusChanged(status);
643         }
644
645         // private void updateEnableStates() {
646         // boolean enableUnusedParams= !checkValue(PREF_PB_UNUSED_PARAMETER,
647         // IGNORE);
648         // getCheckBox(PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING).setEnabled(enableUnusedParams);
649
650         // boolean enableDeprecation= !checkValue(PREF_PB_DEPRECATION, IGNORE);
651         // getCheckBox(PREF_PB_DEPRECATION_IN_DEPRECATED_CODE).setEnabled(enableDeprecation);
652         // getCheckBox(PREF_PB_DEPRECATION_WHEN_OVERRIDING).setEnabled(enableDeprecation);
653         //              
654         // boolean enableThrownExceptions=
655         // !checkValue(PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION, IGNORE);
656         // getCheckBox(PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING).setEnabled(enableThrownExceptions);
657         //
658         // boolean enableHiding= !checkValue(PREF_PB_LOCAL_VARIABLE_HIDING, IGNORE);
659         // getCheckBox(PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD).setEnabled(enableHiding);
660         //
661         // boolean enableInvalidTagsErrors= !checkValue(PREF_PB_INVALID_JAVADOC,
662         // IGNORE);
663         // getCheckBox(PREF_PB_INVALID_JAVADOC_TAGS).setEnabled(enableInvalidTagsErrors);
664         // setComboEnabled(PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY,
665         // enableInvalidTagsErrors);
666         //              
667         // boolean enableMissingTagsErrors=
668         // !checkValue(PREF_PB_MISSING_JAVADOC_TAGS, IGNORE);
669         // getCheckBox(PREF_PB_MISSING_JAVADOC_TAGS_OVERRIDING).setEnabled(enableMissingTagsErrors);
670         // setComboEnabled(PREF_PB_MISSING_JAVADOC_TAGS_VISIBILITY,
671         // enableMissingTagsErrors);
672         //              
673         // boolean enableMissingCommentsErrors=
674         // !checkValue(PREF_PB_MISSING_JAVADOC_COMMENTS, IGNORE);
675         // getCheckBox(PREF_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING).setEnabled(enableMissingCommentsErrors);
676         // setComboEnabled(PREF_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY,
677         // enableMissingCommentsErrors);
678         // }
679
680         // private IStatus validateCompliance() {
681         // StatusInfo status= new StatusInfo();
682         // if (checkValue(PREF_COMPLIANCE, VERSION_1_3)) {
683         // if (checkValue(PREF_SOURCE_COMPATIBILITY, VERSION_1_4)) {
684         // status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.cpl13src14.error"));
685         // //$NON-NLS-1$
686         // return status;
687         // } else if (checkValue(PREF_CODEGEN_TARGET_PLATFORM, VERSION_1_4)) {
688         // status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.cpl13trg14.error"));
689         // //$NON-NLS-1$
690         // return status;
691         // }
692         // }
693         // if (checkValue(PREF_SOURCE_COMPATIBILITY, VERSION_1_4)) {
694         // if (!checkValue(PREF_PB_ASSERT_AS_IDENTIFIER, ERROR)) {
695         // status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.src14asrterr.error"));
696         // //$NON-NLS-1$
697         // return status;
698         // }
699         // }
700         // if (checkValue(PREF_SOURCE_COMPATIBILITY, VERSION_1_4)) {
701         // if (!checkValue(PREF_CODEGEN_TARGET_PLATFORM, VERSION_1_4)) {
702         // status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.src14tgt14.error"));
703         // //$NON-NLS-1$
704         // return status;
705         // }
706         // }
707         // return status;
708         // }
709
710         private IStatus validateMaxNumberProblems() {
711                 String number = (String) fWorkingValues.get(PREF_PB_MAX_PER_UNIT);
712                 StatusInfo status = new StatusInfo();
713                 if (number.length() == 0) {
714                         status.setError(PreferencesMessages
715                                         .getString("CompilerConfigurationBlock.empty_input")); //$NON-NLS-1$
716                 } else {
717                         try {
718                                 int value = Integer.parseInt(number);
719                                 if (value <= 0) {
720                                         status
721                                                         .setError(PreferencesMessages
722                                                                         .getFormattedString(
723                                                                                         "CompilerConfigurationBlock.invalid_input", number)); //$NON-NLS-1$
724                                 }
725                         } catch (NumberFormatException e) {
726                                 status.setError(PreferencesMessages.getFormattedString(
727                                                 "CompilerConfigurationBlock.invalid_input", number)); //$NON-NLS-1$
728                         }
729                 }
730                 return status;
731         }
732
733         // private IStatus validateResourceFilters() {
734         // String text= (String) fWorkingValues.get(PREF_RESOURCE_FILTER);
735         //              
736         // IWorkspace workspace= ResourcesPlugin.getWorkspace();
737         //
738         // String[] filters= getTokens(text, ","); //$NON-NLS-1$
739         // for (int i= 0; i < filters.length; i++) {
740         // String fileName= filters[i].replace('*', 'x');
741         // int resourceType= IResource.FILE;
742         // int lastCharacter= fileName.length() - 1;
743         // if (lastCharacter >= 0 && fileName.charAt(lastCharacter) == '/') {
744         // fileName= fileName.substring(0, lastCharacter);
745         // resourceType= IResource.FOLDER;
746         // }
747         // IStatus status= workspace.validateName(fileName, resourceType);
748         // if (status.matches(IStatus.ERROR)) {
749         // String message=
750         // PreferencesMessages.getFormattedString("CompilerConfigurationBlock.filter.invalidsegment.error",
751         // status.getMessage()); //$NON-NLS-1$
752         // return new StatusInfo(IStatus.ERROR, message);
753         // }
754         // }
755         // return new StatusInfo();
756         // }
757
758         protected String[] getFullBuildDialogStrings(boolean workspaceSettings) {
759                 String title = PreferencesMessages
760                                 .getString("CompilerConfigurationBlock.needsbuild.title"); //$NON-NLS-1$
761                 String message;
762                 if (workspaceSettings) {
763                         message = PreferencesMessages
764                                         .getString("CompilerConfigurationBlock.needsfullbuild.message"); //$NON-NLS-1$
765                 } else {
766                         message = PreferencesMessages
767                                         .getString("CompilerConfigurationBlock.needsprojectbuild.message"); //$NON-NLS-1$
768                 }
769                 return new String[] { title, message };
770         }
771
772 }