### Eclipse Workspace Patch 1.0 #P org.eclipse.wst.jsdt.core Index: src/org/eclipse/wst/jsdt/internal/compiler/problem/ProblemReporter.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/problem/ProblemReporter.java,v retrieving revision 1.26.6.5 diff -u -r1.26.6.5 ProblemReporter.java --- src/org/eclipse/wst/jsdt/internal/compiler/problem/ProblemReporter.java 25 Nov 2008 17:04:30 -0000 1.26.6.5 +++ src/org/eclipse/wst/jsdt/internal/compiler/problem/ProblemReporter.java 19 May 2009 20:18:19 -0000 @@ -1092,8 +1092,11 @@ */ public int computeSeverity(int problemID){ - - if (this.options.onlyReportSyntaxErrors && (problemID & IProblem.Syntax) == 0) { + /* + * If semantic validation is not enabled and this is anything but a + * syntax or task problem, ignore. + */ + if (!this.options.enableSemanticValidation && (problemID & IProblem.Syntax) == 0 && problemID != IProblem.Task) { return ProblemSeverities.Ignore; } Index: src/org/eclipse/wst/jsdt/internal/compiler/impl/CompilerOptions.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/impl/CompilerOptions.java,v retrieving revision 1.11.6.2 diff -u -r1.11.6.2 CompilerOptions.java --- src/org/eclipse/wst/jsdt/internal/compiler/impl/CompilerOptions.java 21 Nov 2008 21:29:42 -0000 1.11.6.2 +++ src/org/eclipse/wst/jsdt/internal/compiler/impl/CompilerOptions.java 19 May 2009 20:18:19 -0000 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Michael Spector - Bug 243886 *******************************************************************************/ package org.eclipse.wst.jsdt.internal.compiler.impl; @@ -359,7 +360,7 @@ public InferOptions inferOptions=new InferOptions(); - public boolean onlyReportSyntaxErrors=false; + public boolean enableSemanticValidation=true; /** @@ -367,11 +368,15 @@ */ public CompilerOptions(){ // use default options - try { - this.onlyReportSyntaxErrors=JavaScriptCore.getPlugin().getPluginPreferences().getBoolean("onlySyntaxErrors"); - } catch (Exception ex) - {this.onlyReportSyntaxErrors=false;} + try { + if (JavaScriptCore.getPlugin().getPluginPreferences().contains("semanticValidation")) { //$NON-NLS-1$ + this.enableSemanticValidation = JavaScriptCore.getPlugin().getPluginPreferences().getBoolean("semanticValidation"); //$NON-NLS-1$ + } + } + catch (Exception ex) { + this.enableSemanticValidation = true; + } } /** @@ -699,9 +704,13 @@ public void set(Map optionsMap) { try { - this.onlyReportSyntaxErrors=JavaScriptCore.getPlugin().getPluginPreferences().getBoolean("onlySyntaxErrors"); - } catch (Exception ex) - {this.onlyReportSyntaxErrors=false;} + if (JavaScriptCore.getPlugin().getPluginPreferences().contains("semanticValidation")) { //$NON-NLS-1$ + this.enableSemanticValidation = JavaScriptCore.getPlugin().getPluginPreferences().getBoolean("semanticValidation"); //$NON-NLS-1$ + } + } + catch (Exception ex) { + this.enableSemanticValidation = true; + } Object optionValue; if ((optionValue = optionsMap.get(OPTION_LocalVariableAttribute)) != null) { Index: src/org/eclipse/wst/jsdt/internal/compiler/Compiler.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/Compiler.java,v retrieving revision 1.16.4.1 diff -u -r1.16.4.1 Compiler.java --- src/org/eclipse/wst/jsdt/internal/compiler/Compiler.java 21 Aug 2008 22:24:05 -0000 1.16.4.1 +++ src/org/eclipse/wst/jsdt/internal/compiler/Compiler.java 19 May 2009 20:18:19 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -398,9 +398,8 @@ CompilationUnitDeclaration unit, CompilationResult result) { - - if (this.options.onlyReportSyntaxErrors) - return; + if (!this.options.enableSemanticValidation) + return; if ((result == null) && (unit != null)) { result = unit.compilationResult; // current unit being processed ? } @@ -466,6 +465,9 @@ AbortCompilation abortException, CompilationUnitDeclaration unit) { + if (!this.options.enableSemanticValidation) + return; + /* special treatment for SilentAbort: silently cancelling the compilation process */ if (abortException.isSilent) { if (abortException.silentException == null) { Index: src/org/eclipse/wst/jsdt/internal/core/JavaCorePreferenceInitializer.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/JavaCorePreferenceInitializer.java,v retrieving revision 1.6.6.1 diff -u -r1.6.6.1 JavaCorePreferenceInitializer.java --- src/org/eclipse/wst/jsdt/internal/core/JavaCorePreferenceInitializer.java 21 Nov 2008 21:30:29 -0000 1.6.6.1 +++ src/org/eclipse/wst/jsdt/internal/core/JavaCorePreferenceInitializer.java 19 May 2009 20:18:19 -0000 @@ -110,6 +110,8 @@ // Time out for parameter names defaultOptionsMap.put(JavaScriptCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC, "50"); //$NON-NLS-1$ + defaultOptionsMap.put("semanticValidation", "true"); //$NON-NLS-1$ + // Store default values to default preferences IEclipsePreferences defaultPreferences = ((IScopeContext) new DefaultScope()).getNode(JavaScriptCore.PLUGIN_ID); for (Iterator iter = defaultOptionsMap.entrySet().iterator(); iter.hasNext();) { #P org.eclipse.wst.jsdt.ui Index: src/org/eclipse/wst/jsdt/internal/ui/preferences/ProblemSeveritiesConfigurationBlock.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/preferences/ProblemSeveritiesConfigurationBlock.java,v retrieving revision 1.10.6.1 diff -u -r1.10.6.1 ProblemSeveritiesConfigurationBlock.java --- src/org/eclipse/wst/jsdt/internal/ui/preferences/ProblemSeveritiesConfigurationBlock.java 21 Nov 2008 21:28:47 -0000 1.10.6.1 +++ src/org/eclipse/wst/jsdt/internal/ui/preferences/ProblemSeveritiesConfigurationBlock.java 19 May 2009 20:18:20 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,10 +7,12 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Michael Spector - Bug 243886 *******************************************************************************/ package org.eclipse.wst.jsdt.internal.ui.preferences; import org.eclipse.core.resources.IProject; +import org.eclipse.jface.dialogs.ControlEnableState; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; @@ -32,6 +34,8 @@ private static final String SETTINGS_SECTION_NAME= "ProblemSeveritiesConfigurationBlock"; //$NON-NLS-1$ + private static final Key PREF_PB_SEMANTIC_VALIDATION_ENABLEMENT = getJDTCoreKey("semanticValidation"); //$NON-NLS-1$ + // Preference store keys, see JavaScriptCore.getOptions private static final Key PREF_PB_UNDEFINED_FIELD= getJDTCoreKey(JavaScriptCore.COMPILER_PB_UNDEFINED_FIELD); // private static final Key PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME= getJDTCoreKey(JavaScriptCore.COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME); @@ -116,8 +120,10 @@ private static final String ENABLED= JavaScriptCore.ENABLED; private static final String DISABLED= JavaScriptCore.DISABLED; - private PixelConverter fPixelConverter; + + private ControlEnableState fBlockEnableState; + private Composite fControlsComposite; public ProblemSeveritiesConfigurationBlock(IStatusChangeListener context, IProject project, IWorkbenchPreferenceContainer container) { super(context, project, getKeys(), container); @@ -130,6 +136,7 @@ private static Key[] getKeys() { return new Key[] { + PREF_PB_SEMANTIC_VALIDATION_ENABLEMENT, PREF_PB_UNDEFINED_FIELD, /*PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME,*/ PREF_PB_DEPRECATION, PREF_PB_HIDDEN_CATCH_BLOCK, PREF_PB_UNUSED_LOCAL, PREF_PB_UNUSED_PARAMETER, PREF_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE, @@ -168,11 +175,21 @@ layout.marginHeight= 0; layout.marginWidth= 0; mainComp.setLayout(layout); - + + if (fProject == null) { + String label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_enableSemanticValidation; + addCheckBox(mainComp, label, PREF_PB_SEMANTIC_VALIDATION_ENABLEMENT, new String[]{"true", "false"}, 0); //$NON-NLS-1$ //$NON-NLS-2$ + Label horizontalLine= new Label(mainComp, SWT.SEPARATOR | SWT.HORIZONTAL); + horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1)); + horizontalLine.setFont(mainComp.getFont()); + } + Composite commonComposite= createStyleTabContent(mainComp); GridData gridData= new GridData(GridData.FILL, GridData.FILL, true, true); gridData.heightHint= fPixelConverter.convertHeightInCharsToPixels(20); commonComposite.setLayoutData(gridData); + + fControlsComposite = commonComposite; validateSettings(null, null, null); @@ -494,7 +511,7 @@ } if (changedKey != null) { - if (PREF_PB_UNUSED_PARAMETER.equals(changedKey) ) + if (PREF_PB_UNUSED_PARAMETER.equals(changedKey) || PREF_PB_SEMANTIC_VALIDATION_ENABLEMENT.equals(changedKey) ) // PREF_PB_DEPRECATION.equals(changedKey) || // PREF_PB_LOCAL_VARIABLE_HIDING.equals(changedKey) || // PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION.equals(changedKey)) @@ -513,6 +530,10 @@ } private void updateEnableStates() { + boolean semantecValidationEnablement = checkValue(PREF_PB_SEMANTIC_VALIDATION_ENABLEMENT, "true"); //$NON-NLS-1$ + enableConfigControls(semantecValidationEnablement); + + if (!semantecValidationEnablement) { boolean enableUnusedParams= !checkValue(PREF_PB_UNUSED_PARAMETER, IGNORE); // getCheckBox(PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING).setEnabled(enableUnusedParams); getCheckBox(PREF_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE).setEnabled(enableUnusedParams); @@ -526,6 +547,20 @@ // boolean enableHiding= !checkValue(PREF_PB_LOCAL_VARIABLE_HIDING, IGNORE); // getCheckBox(PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD).setEnabled(enableHiding); + } + } + + protected void enableConfigControls(boolean enable) { + if (enable) { + if (fBlockEnableState != null) { + fBlockEnableState.restore(); + fBlockEnableState= null; + } + } else { + if (fBlockEnableState == null) { + fBlockEnableState= ControlEnableState.disable(fControlsComposite); + } + } } protected String[] getFullBuildDialogStrings(boolean workspaceSettings) { Index: src/org/eclipse/wst/jsdt/internal/ui/preferences/PreferencesMessages.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/preferences/PreferencesMessages.java,v retrieving revision 1.13.6.1 diff -u -r1.13.6.1 PreferencesMessages.java --- src/org/eclipse/wst/jsdt/internal/ui/preferences/PreferencesMessages.java 21 Nov 2008 21:28:47 -0000 1.13.6.1 +++ src/org/eclipse/wst/jsdt/internal/ui/preferences/PreferencesMessages.java 19 May 2009 20:18:20 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -390,6 +390,7 @@ public static String ProblemSeveritiesConfigurationBlock_needsfullbuild_message; public static String ProblemSeveritiesConfigurationBlock_needsprojectbuild_message; public static String ProblemSeveritiesConfigurationBlock_common_description; + public static String ProblemSeveritiesConfigurationBlock_enableSemanticValidation; public static String ProblemSeveritiesConfigurationBlock_pb_unsafe_type_op_label; public static String ProblemSeveritiesConfigurationBlock_pb_raw_type_reference; public static String ProblemSeveritiesConfigurationBlock_pb_final_param_bound_label; Index: src/org/eclipse/wst/jsdt/internal/ui/preferences/PreferencesMessages.properties =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/preferences/PreferencesMessages.properties,v retrieving revision 1.18.6.1 diff -u -r1.18.6.1 PreferencesMessages.properties --- src/org/eclipse/wst/jsdt/internal/ui/preferences/PreferencesMessages.properties 21 Nov 2008 21:28:47 -0000 1.18.6.1 +++ src/org/eclipse/wst/jsdt/internal/ui/preferences/PreferencesMessages.properties 19 May 2009 20:18:20 -0000 @@ -476,6 +476,7 @@ ProblemSeveritiesConfigurationBlock_pb_missing_deprecated_annotation_label=Missing '@Deprecated' annotation: ProblemSeveritiesConfigurationBlock_pb_annotation_super_interface_label=Annotation is used as super interface: ProblemSeveritiesConfigurationBlock_ignore_documented_unused_parameters=Ignore parameters documented with '&@param' tag +ProblemSeveritiesConfigurationBlock_enableSemanticValidation=Enable se&mantic validation ProblemSeveritiesConfigurationBlock_pb_type_parameter_hiding_label=Type parameter hides another type: ProblemSeveritiesConfigurationBlock_pb_unused_label_label=Unused 'break' or 'continue' label: JavadocProblemsPreferencePage_title=Jsdoc Comments