updated build.xml
[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         
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_VAR_DEPRECATED,
168             PREF_PB_PHP_KEYWORD,
169             PREF_PB_PHP_UPPERCASE_IDENTIFIER,
170 //              PREF_LOCAL_VARIABLE_ATTR, 
171 //              PREF_LINE_NUMBER_ATTR, PREF_SOURCE_FILE_ATTR, PREF_CODEGEN_UNUSED_LOCAL,
172 //              PREF_CODEGEN_TARGET_PLATFORM, 
173 //              PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, 
174 //              PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME, 
175 //              PREF_PB_DEPRECATION, 
176 //              PREF_PB_HIDDEN_CATCH_BLOCK, PREF_PB_UNUSED_LOCAL,
177 //              PREF_PB_UNUSED_PARAMETER, 
178 //              PREF_PB_SYNTHETIC_ACCESS_EMULATION, PREF_PB_NON_EXTERNALIZED_STRINGS,
179 //              PREF_PB_ASSERT_AS_IDENTIFIER, 
180 //              PREF_PB_UNUSED_IMPORT, 
181                 PREF_PB_MAX_PER_UNIT, 
182 //              PREF_SOURCE_COMPATIBILITY, 
183 //              PREF_COMPLIANCE, 
184 //              PREF_RESOURCE_FILTER, PREF_BUILD_INVALID_CLASSPATH, PREF_PB_STATIC_ACCESS_RECEIVER, PREF_PB_INCOMPLETE_BUILDPATH,
185 //              PREF_PB_CIRCULAR_BUILDPATH, PREF_PB_DEPRECATION_IN_DEPRECATED_CODE, PREF_BUILD_CLEAN_OUTPUT_FOLDER,
186 //              PREF_PB_DUPLICATE_RESOURCE, PREF_PB_NO_EFFECT_ASSIGNMENT, PREF_PB_INCOMPATIBLE_INTERFACE_METHOD,
187 //              PREF_PB_UNUSED_PRIVATE, PREF_PB_CHAR_ARRAY_IN_CONCAT, PREF_ENABLE_EXCLUSION_PATTERNS, PREF_ENABLE_MULTIPLE_OUTPUT_LOCATIONS,
188 //              PREF_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT, 
189 //              PREF_PB_LOCAL_VARIABLE_HIDING, 
190 //              PREF_PB_FIELD_HIDING,
191 //              PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD, 
192 //              PREF_PB_INCOMPATIBLE_JDK_LEVEL, 
193 //              PREF_PB_INDIRECT_STATIC_ACCESS,
194 //              PREF_PB_SUPERFLUOUS_SEMICOLON, 
195 //              PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING, 
196 //              PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT,
197 //              PREF_PB_UNNECESSARY_TYPE_CHECK, 
198 //              PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION, 
199 //              PREF_PB_UNQUALIFIED_FIELD_ACCESS,
200 //              PREF_PB_UNDOCUMENTED_EMPTY_BLOCK, 
201 //              PREF_PB_FINALLY_BLOCK_NOT_COMPLETING, 
202 //              PREF_PB_DEPRECATION_WHEN_OVERRIDING,
203 //              PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING,
204
205 //              PREF_PB_INVALID_JAVADOC, 
206 //              PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY, 
207 //              PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY,
208 //              PREF_PB_MISSING_JAVADOC_TAGS, 
209 //              PREF_PB_MISSING_JAVADOC_TAGS_VISIBILITY, 
210 //              PREF_PB_MISSING_JAVADOC_TAGS_OVERRIDING,
211 //              PREF_PB_MISSING_JAVADOC_COMMENTS, 
212 //              PREF_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY, 
213 //              PREF_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING
214         };      
215         
216         private static  String[] getKeys() {
217                 return KEYS;    
218         }
219         
220         protected final Map getOptions(boolean inheritJavaCoreOptions) {
221                 Map map= super.getOptions(inheritJavaCoreOptions);
222         //      map.put(INTR_DEFAULT_COMPLIANCE, getCurrentCompliance(map));
223                 return map;
224         }
225         
226         protected final Map getDefaultOptions() {
227                 Map map= super.getDefaultOptions();
228         //      map.put(INTR_DEFAULT_COMPLIANCE, getCurrentCompliance(map));
229                 return map;
230         }       
231         
232         
233         /*
234          * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
235          */
236         protected Control createContents(Composite parent) {
237                 fPixelConverter= new PixelConverter(parent);
238                 setShell(parent.getShell());
239                 
240                 TabFolder folder= new TabFolder(parent, SWT.NONE);
241                 folder.setLayout(new TabFolderLayout());        
242                 folder.setLayoutData(new GridData(GridData.FILL_BOTH));
243                 
244                 Composite commonComposite= createStyleTabContent(folder);
245 //              Composite unusedComposite= createUnusedCodeTabContent(folder);
246                 Composite advancedComposite= createAdvancedTabContent(folder);
247 //              Composite javadocComposite= createJavadocTabContent(folder);
248 //              Composite complianceComposite= createComplianceTabContent(folder);
249 //              Composite othersComposite= createBuildPathTabContent(folder);
250
251                 TabItem item= new TabItem(folder, SWT.NONE);
252                 item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.common.tabtitle")); //$NON-NLS-1$
253                 item.setControl(commonComposite);
254
255                 item= new TabItem(folder, SWT.NONE);
256                 item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.advanced.tabtitle")); //$NON-NLS-1$
257                 item.setControl(advancedComposite);
258
259 //              item= new TabItem(folder, SWT.NONE);
260 //              item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.unused.tabtitle")); //$NON-NLS-1$
261 //              item.setControl(unusedComposite);
262                 
263 //              item= new TabItem(folder, SWT.NONE);
264 //              item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.javadoc.tabtitle")); //$NON-NLS-1$
265 //              item.setControl(javadocComposite);
266         
267 //              item= new TabItem(folder, SWT.NONE);
268 //              item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.compliance.tabtitle")); //$NON-NLS-1$
269 //              item.setControl(complianceComposite);
270                 
271 //              item= new TabItem(folder, SWT.NONE);
272 //              item.setText(PreferencesMessages.getString("CompilerConfigurationBlock.others.tabtitle")); //$NON-NLS-1$
273 //              item.setControl(othersComposite);               
274                 
275                 validateSettings(null, null);
276         
277                 return folder;
278         }
279
280         private Composite createStyleTabContent(Composite folder) {
281                 String[] errorWarningIgnore= new String[] { ERROR, WARNING, IGNORE };
282                 
283                 String[] errorWarningIgnoreLabels= new String[] {
284                         PreferencesMessages.getString("CompilerConfigurationBlock.error"),  //$NON-NLS-1$
285                         PreferencesMessages.getString("CompilerConfigurationBlock.warning"), //$NON-NLS-1$
286                         PreferencesMessages.getString("CompilerConfigurationBlock.ignore") //$NON-NLS-1$
287                 };
288                 
289                 int nColumns= 3;
290                 
291                 GridLayout layout= new GridLayout();
292                 layout.numColumns= nColumns;
293
294                 Composite composite= new Composite(folder, SWT.NULL);
295                 composite.setLayout(layout);
296                 
297                 Label description= new Label(composite, SWT.WRAP);
298                 description.setText(PreferencesMessages.getString("CompilerConfigurationBlock.common.description")); //$NON-NLS-1$
299                 GridData gd= new GridData();
300                 gd.horizontalSpan= nColumns;
301                 gd.widthHint= fPixelConverter.convertWidthInCharsToPixels(50);
302                 description.setLayoutData(gd);          
303
304                 String label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_var_deprecated.label"); //$NON-NLS-1$
305                 addComboBox(composite, label, PREF_PB_PHP_VAR_DEPRECATED, errorWarningIgnore, errorWarningIgnoreLabels, 0);                     
306                 
307                 label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_keyword.label"); //$NON-NLS-1$
308                 addComboBox(composite, label, PREF_PB_PHP_KEYWORD, errorWarningIgnore, errorWarningIgnoreLabels, 0);                    
309                 
310                 label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_uppercase_identifier.label"); //$NON-NLS-1$
311                 addComboBox(composite, label, PREF_PB_PHP_UPPERCASE_IDENTIFIER, errorWarningIgnore, errorWarningIgnoreLabels, 0);                       
312                 
313                 label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_overriding_pkg_dflt.label"); //$NON-NLS-1$
314 //              addComboBox(composite, label, PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, errorWarningIgnore, errorWarningIgnoreLabels, 0);                      
315
316 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_method_naming.label"); //$NON-NLS-1$
317 //              addComboBox(composite, label, PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME, errorWarningIgnore, errorWarningIgnoreLabels, 0);                   
318 //
319 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_hidden_catchblock.label"); //$NON-NLS-1$
320 //              addComboBox(composite, label, PREF_PB_HIDDEN_CATCH_BLOCK, errorWarningIgnore, errorWarningIgnoreLabels, 0);
321 //              
322 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_static_access_receiver.label"); //$NON-NLS-1$
323 //              addComboBox(composite, label, PREF_PB_STATIC_ACCESS_RECEIVER, errorWarningIgnore, errorWarningIgnoreLabels, 0);
324 //              
325 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_no_effect_assignment.label"); //$NON-NLS-1$
326 //              addComboBox(composite, label, PREF_PB_NO_EFFECT_ASSIGNMENT, errorWarningIgnore, errorWarningIgnoreLabels, 0);
327
328 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_indirect_access_to_static.label"); //$NON-NLS-1$
329 //              addComboBox(composite, label, PREF_PB_INDIRECT_STATIC_ACCESS, errorWarningIgnore, errorWarningIgnoreLabels, 0); 
330 //
331 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_accidential_assignement.label"); //$NON-NLS-1$
332 //              addComboBox(composite, label, PREF_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT, errorWarningIgnore, errorWarningIgnoreLabels, 0);
333 //
334 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_finally_block_not_completing.label"); //$NON-NLS-1$
335 //              addComboBox(composite, label, PREF_PB_FINALLY_BLOCK_NOT_COMPLETING, errorWarningIgnore, errorWarningIgnoreLabels, 0);
336 //
337 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_undocumented_empty_block.label"); //$NON-NLS-1$
338 //              addComboBox(composite, label, PREF_PB_UNDOCUMENTED_EMPTY_BLOCK, errorWarningIgnore, errorWarningIgnoreLabels, 0);
339
340                 
341                 return composite;
342         }
343
344         private Composite createAdvancedTabContent(TabFolder folder) {
345                 String[] errorWarningIgnore= new String[] { ERROR, WARNING, IGNORE };
346                 
347                 String[] errorWarningIgnoreLabels= new String[] {
348                         PreferencesMessages.getString("CompilerConfigurationBlock.error"),  //$NON-NLS-1$
349                         PreferencesMessages.getString("CompilerConfigurationBlock.warning"), //$NON-NLS-1$
350                         PreferencesMessages.getString("CompilerConfigurationBlock.ignore") //$NON-NLS-1$
351                 };
352                 
353                 String[] enabledDisabled= new String[] { ENABLED, DISABLED };
354                 
355                 int nColumns= 3;
356                 
357                 GridLayout layout= new GridLayout();
358                 layout.numColumns= nColumns;
359                                         
360                 Composite composite= new Composite(folder, SWT.NULL);
361                 composite.setLayout(layout);
362
363                 Label description= new Label(composite, SWT.WRAP);
364                 description.setText(PreferencesMessages.getString("CompilerConfigurationBlock.advanced.description")); //$NON-NLS-1$
365                 GridData gd= new GridData();
366                 gd.horizontalSpan= nColumns;
367                 gd.widthHint= fPixelConverter.convertWidthInCharsToPixels(50);
368                 description.setLayoutData(gd);
369                         
370 //              String label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_synth_access_emul.label"); //$NON-NLS-1$
371 //              addComboBox(composite, label, PREF_PB_SYNTHETIC_ACCESS_EMULATION, errorWarningIgnore, errorWarningIgnoreLabels, 0);
372
373 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_local_variable_hiding.label"); //$NON-NLS-1$
374 //              addComboBox(composite, label, PREF_PB_LOCAL_VARIABLE_HIDING, errorWarningIgnore, errorWarningIgnoreLabels, 0);
375
376 //              int indent= fPixelConverter.convertWidthInCharsToPixels(2);
377 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_special_param_hiding.label"); //$NON-NLS-1$
378 //              addCheckBox(composite, label, PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD, enabledDisabled, indent);
379
380 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_field_hiding.label"); //$NON-NLS-1$
381 //              addComboBox(composite, label, PREF_PB_FIELD_HIDING, errorWarningIgnore, errorWarningIgnoreLabels, 0);
382
383 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_non_externalized_strings.label"); //$NON-NLS-1$
384 //              addComboBox(composite, label, PREF_PB_NON_EXTERNALIZED_STRINGS, errorWarningIgnore, errorWarningIgnoreLabels, 0);
385 //
386 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_incompatible_interface_method.label"); //$NON-NLS-1$
387 //              addComboBox(composite, label, PREF_PB_INCOMPATIBLE_INTERFACE_METHOD, errorWarningIgnore, errorWarningIgnoreLabels, 0);
388 //
389 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_char_array_in_concat.label"); //$NON-NLS-1$
390 //              addComboBox(composite, label, PREF_PB_CHAR_ARRAY_IN_CONCAT, errorWarningIgnore, errorWarningIgnoreLabels, 0);
391
392 //              label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_unqualified_field_access.label"); //$NON-NLS-1$
393 //              addComboBox(composite, label, PREF_PB_UNQUALIFIED_FIELD_ACCESS, errorWarningIgnore, errorWarningIgnoreLabels, 0);
394                 
395                 gd= new GridData();
396                 gd.widthHint= fPixelConverter.convertWidthInCharsToPixels(6);
397                 
398                 String label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_max_per_unit.label"); //$NON-NLS-1$
399                 Text text= addTextField(composite, label, PREF_PB_MAX_PER_UNIT, 0, 0);
400                 text.setTextLimit(6);
401                 text.setLayoutData(gd);
402
403                 return composite;
404         }
405
406         
407         
408                 
409         
410         /* (non-javadoc)
411          * Update fields and validate.
412          * @param changedKey Key that changed, or null, if all changed.
413          */     
414         protected void validateSettings(String changedKey, String newValue) {
415                 
416                 if (changedKey != null) {
417 //                      if (INTR_DEFAULT_COMPLIANCE.equals(changedKey)) {
418 //                              updateComplianceEnableState();
419 //                              if (DEFAULT_CONF.equals(newValue)) {
420 //                                      updateComplianceDefaultSettings();
421 //                              }
422 //                              fComplianceStatus= validateCompliance();
423 //                      } else if (PREF_COMPLIANCE.equals(changedKey)) {
424 //                              if (checkValue(INTR_DEFAULT_COMPLIANCE, DEFAULT_CONF)) {
425 //                                      updateComplianceDefaultSettings();
426 //                              }
427 //                              fComplianceStatus= validateCompliance();
428 //                      } else if (PREF_SOURCE_COMPATIBILITY.equals(changedKey) ||
429 //                                      PREF_CODEGEN_TARGET_PLATFORM.equals(changedKey) ||
430 //                                      PREF_PB_ASSERT_AS_IDENTIFIER.equals(changedKey)) {
431 //                              fComplianceStatus= validateCompliance();
432 //                      } else 
433                           if (PREF_PB_MAX_PER_UNIT.equals(changedKey)) {
434                                 fMaxNumberProblemsStatus= validateMaxNumberProblems();
435 //                      } else if (PREF_RESOURCE_FILTER.equals(changedKey)) {
436 //                              fResourceFilterStatus= validateResourceFilters();
437 //                      } else if (S.equals(changedKey) ||
438 //                                      PREF_PB_DEPRECATION.equals(changedKey) ) { // ||
439 ////                                    PREF_PB_INVALID_JAVADOC.equals(changedKey) ||
440 ////                                    PREF_PB_MISSING_JAVADOC_TAGS.equals(changedKey) ||
441 ////                                    PREF_PB_MISSING_JAVADOC_COMMENTS.equals(changedKey) ||
442 ////                                    PREF_PB_MISSING_JAVADOC_COMMENTS.equals(changedKey) ||
443 ////                                    PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION.equals(changedKey)) {                          
444 //                              updateEnableStates();
445 //                      } else if (PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING.equals(changedKey)) {
446 //                              // merging the two options
447 //                              fWorkingValues.put(PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT, newValue);
448                         } else {
449                                 return;
450                         }
451                 } else {
452 //                      updateEnableStates();
453 //                      updateComplianceEnableState();
454 //                      fComplianceStatus= validateCompliance();
455                         fMaxNumberProblemsStatus= validateMaxNumberProblems();
456 //                      fResourceFilterStatus= validateResourceFilters();
457                 }               
458 //              IStatus status= StatusUtil.getMostSevere(new IStatus[] { fComplianceStatus, fMaxNumberProblemsStatus, fResourceFilterStatus });
459                 IStatus status= StatusUtil.getMostSevere(new IStatus[] { fMaxNumberProblemsStatus });
460                 fContext.statusChanged(status);
461         }
462         
463 //      private void updateEnableStates() {
464 //              boolean enableUnusedParams= !checkValue(PREF_PB_UNUSED_PARAMETER, IGNORE);
465 //              getCheckBox(PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING).setEnabled(enableUnusedParams);
466                 
467 //              boolean enableDeprecation= !checkValue(PREF_PB_DEPRECATION, IGNORE);
468 //              getCheckBox(PREF_PB_DEPRECATION_IN_DEPRECATED_CODE).setEnabled(enableDeprecation);
469 //              getCheckBox(PREF_PB_DEPRECATION_WHEN_OVERRIDING).setEnabled(enableDeprecation);
470 //              
471 //              boolean enableThrownExceptions= !checkValue(PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION, IGNORE);
472 //              getCheckBox(PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING).setEnabled(enableThrownExceptions);
473 //
474 //              boolean enableHiding= !checkValue(PREF_PB_LOCAL_VARIABLE_HIDING, IGNORE);
475 //              getCheckBox(PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD).setEnabled(enableHiding);
476 //
477 //              boolean enableInvalidTagsErrors= !checkValue(PREF_PB_INVALID_JAVADOC, IGNORE);
478 //              getCheckBox(PREF_PB_INVALID_JAVADOC_TAGS).setEnabled(enableInvalidTagsErrors);
479 //              setComboEnabled(PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY, enableInvalidTagsErrors);
480 //              
481 //              boolean enableMissingTagsErrors= !checkValue(PREF_PB_MISSING_JAVADOC_TAGS, IGNORE);
482 //              getCheckBox(PREF_PB_MISSING_JAVADOC_TAGS_OVERRIDING).setEnabled(enableMissingTagsErrors);
483 //              setComboEnabled(PREF_PB_MISSING_JAVADOC_TAGS_VISIBILITY, enableMissingTagsErrors);
484 //              
485 //              boolean enableMissingCommentsErrors= !checkValue(PREF_PB_MISSING_JAVADOC_COMMENTS, IGNORE);
486 //              getCheckBox(PREF_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING).setEnabled(enableMissingCommentsErrors);
487 //              setComboEnabled(PREF_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY, enableMissingCommentsErrors);
488 //      }
489
490 //      private IStatus validateCompliance() {
491 //              StatusInfo status= new StatusInfo();
492 //              if (checkValue(PREF_COMPLIANCE, VERSION_1_3)) {
493 //                      if (checkValue(PREF_SOURCE_COMPATIBILITY, VERSION_1_4)) {
494 //                              status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.cpl13src14.error")); //$NON-NLS-1$
495 //                              return status;
496 //                      } else if (checkValue(PREF_CODEGEN_TARGET_PLATFORM, VERSION_1_4)) {
497 //                              status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.cpl13trg14.error")); //$NON-NLS-1$
498 //                              return status;
499 //                      }
500 //              }
501 //              if (checkValue(PREF_SOURCE_COMPATIBILITY, VERSION_1_4)) {
502 //                      if (!checkValue(PREF_PB_ASSERT_AS_IDENTIFIER, ERROR)) {
503 //                              status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.src14asrterr.error")); //$NON-NLS-1$
504 //                              return status;
505 //                      }
506 //              }
507 //              if (checkValue(PREF_SOURCE_COMPATIBILITY, VERSION_1_4)) {
508 //                      if (!checkValue(PREF_CODEGEN_TARGET_PLATFORM, VERSION_1_4)) {
509 //                              status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.src14tgt14.error")); //$NON-NLS-1$
510 //                              return status;
511 //                      }
512 //              }
513 //              return status;
514 //      }
515         
516         private IStatus validateMaxNumberProblems() {
517                 String number= (String) fWorkingValues.get(PREF_PB_MAX_PER_UNIT);
518                 StatusInfo status= new StatusInfo();
519                 if (number.length() == 0) {
520                         status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.empty_input")); //$NON-NLS-1$
521                 } else {
522                         try {
523                                 int value= Integer.parseInt(number);
524                                 if (value <= 0) {
525                                         status.setError(PreferencesMessages.getFormattedString("CompilerConfigurationBlock.invalid_input", number)); //$NON-NLS-1$
526                                 }
527                         } catch (NumberFormatException e) {
528                                 status.setError(PreferencesMessages.getFormattedString("CompilerConfigurationBlock.invalid_input", number)); //$NON-NLS-1$
529                         }
530                 }
531                 return status;
532         }
533         
534 //      private IStatus validateResourceFilters() {
535 //              String text= (String) fWorkingValues.get(PREF_RESOURCE_FILTER);
536 //              
537 //              IWorkspace workspace= ResourcesPlugin.getWorkspace();
538 //
539 //              String[] filters= getTokens(text, ","); //$NON-NLS-1$
540 //              for (int i= 0; i < filters.length; i++) {
541 //                      String fileName= filters[i].replace('*', 'x');
542 //                      int resourceType= IResource.FILE;
543 //                      int lastCharacter= fileName.length() - 1;
544 //                      if (lastCharacter >= 0 && fileName.charAt(lastCharacter) == '/') {
545 //                              fileName= fileName.substring(0, lastCharacter);
546 //                              resourceType= IResource.FOLDER;
547 //                      }
548 //                      IStatus status= workspace.validateName(fileName, resourceType);
549 //                      if (status.matches(IStatus.ERROR)) {
550 //                              String message= PreferencesMessages.getFormattedString("CompilerConfigurationBlock.filter.invalidsegment.error", status.getMessage()); //$NON-NLS-1$
551 //                              return new StatusInfo(IStatus.ERROR, message);
552 //                      }
553 //              }
554 //              return new StatusInfo();
555 //      }
556         
557         protected String[] getFullBuildDialogStrings(boolean workspaceSettings) {
558                 String title= PreferencesMessages.getString("CompilerConfigurationBlock.needsbuild.title"); //$NON-NLS-1$
559                 String message;
560                 if (workspaceSettings) {
561                         message= PreferencesMessages.getString("CompilerConfigurationBlock.needsfullbuild.message"); //$NON-NLS-1$
562                 } else {
563                         message= PreferencesMessages.getString("CompilerConfigurationBlock.needsprojectbuild.message"); //$NON-NLS-1$
564                 }
565                 return new String[] { title, message };
566         }       
567                         
568 }