View | Details | Raw Unified | Return to bug 277000
Collapse All | Expand All

(-)src/org/eclipse/wst/jsdt/internal/compiler/problem/ProblemReporter.java (-2 / +5 lines)
Lines 1092-1099 Link Here
1092
 */
1092
 */
1093
public int computeSeverity(int problemID){
1093
public int computeSeverity(int problemID){
1094
 	
1094
 	
1095
1095
	/*
1096
	if (this.options.onlyReportSyntaxErrors && (problemID & IProblem.Syntax) == 0) {
1096
	 * If semantic validation is not enabled and this is anything but a
1097
	 * syntax or task problem, ignore.
1098
	 */
1099
	if (!this.options.enableSemanticValidation && (problemID & IProblem.Syntax) == 0 && problemID != IProblem.Task) {
1097
		return ProblemSeverities.Ignore;
1100
		return ProblemSeverities.Ignore;
1098
	}
1101
	}
1099
	
1102
	
(-)src/org/eclipse/wst/jsdt/internal/compiler/impl/CompilerOptions.java (-8 / +17 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Michael Spector <spektom@gmail.com> -  Bug 243886
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.wst.jsdt.internal.compiler.impl;
12
package org.eclipse.wst.jsdt.internal.compiler.impl;
12
13
Lines 359-365 Link Here
359
	public InferOptions inferOptions=new InferOptions();
360
	public InferOptions inferOptions=new InferOptions();
360
361
361
362
362
    public boolean onlyReportSyntaxErrors=false;
363
	public boolean enableSemanticValidation=true;
363
	
364
	
364
365
365
	/**
366
	/**
Lines 367-377 Link Here
367
	 */
368
	 */
368
	public CompilerOptions(){
369
	public CompilerOptions(){
369
		// use default options
370
		// use default options
370
		try {
371
			this.onlyReportSyntaxErrors=JavaScriptCore.getPlugin().getPluginPreferences().getBoolean("onlySyntaxErrors");
372
		} catch (Exception ex) 
373
		{this.onlyReportSyntaxErrors=false;}
374
371
372
		try {
373
			if (JavaScriptCore.getPlugin().getPluginPreferences().contains("semanticValidation")) { //$NON-NLS-1$
374
				this.enableSemanticValidation = JavaScriptCore.getPlugin().getPluginPreferences().getBoolean("semanticValidation"); //$NON-NLS-1$
375
			}
376
		}
377
		catch (Exception ex) {
378
			this.enableSemanticValidation = true;
379
		}
375
	}
380
	}
376
381
377
	/**
382
	/**
Lines 699-707 Link Here
699
	public void set(Map optionsMap) {
704
	public void set(Map optionsMap) {
700
705
701
		try {
706
		try {
702
			this.onlyReportSyntaxErrors=JavaScriptCore.getPlugin().getPluginPreferences().getBoolean("onlySyntaxErrors");
707
			if (JavaScriptCore.getPlugin().getPluginPreferences().contains("semanticValidation")) { //$NON-NLS-1$
703
		} catch (Exception ex) 
708
				this.enableSemanticValidation = JavaScriptCore.getPlugin().getPluginPreferences().getBoolean("semanticValidation"); //$NON-NLS-1$
704
		{this.onlyReportSyntaxErrors=false;}
709
			}
710
		}
711
		catch (Exception ex) {
712
			this.enableSemanticValidation = true;
713
		}
705
714
706
		Object optionValue;
715
		Object optionValue;
707
		if ((optionValue = optionsMap.get(OPTION_LocalVariableAttribute)) != null) {
716
		if ((optionValue = optionsMap.get(OPTION_LocalVariableAttribute)) != null) {
(-)src/org/eclipse/wst/jsdt/internal/compiler/Compiler.java (-4 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 398-406 Link Here
398
		CompilationUnitDeclaration unit,
398
		CompilationUnitDeclaration unit,
399
		CompilationResult result) {
399
		CompilationResult result) {
400
400
401
		
401
		if (!this.options.enableSemanticValidation)
402
		if (this.options.onlyReportSyntaxErrors)
402
			return;		
403
			return;
404
		if ((result == null) && (unit != null)) {
403
		if ((result == null) && (unit != null)) {
405
			result = unit.compilationResult; // current unit being processed ?
404
			result = unit.compilationResult; // current unit being processed ?
406
		}
405
		}
Lines 466-471 Link Here
466
		AbortCompilation abortException,
465
		AbortCompilation abortException,
467
		CompilationUnitDeclaration unit) {
466
		CompilationUnitDeclaration unit) {
468
467
468
		if (!this.options.enableSemanticValidation)
469
			return;
470
469
		/* special treatment for SilentAbort: silently cancelling the compilation process */
471
		/* special treatment for SilentAbort: silently cancelling the compilation process */
470
		if (abortException.isSilent) {
472
		if (abortException.isSilent) {
471
			if (abortException.silentException == null) {
473
			if (abortException.silentException == null) {
(-)src/org/eclipse/wst/jsdt/internal/core/JavaCorePreferenceInitializer.java (+2 lines)
Lines 110-115 Link Here
110
		// Time out for parameter names
110
		// Time out for parameter names
111
		defaultOptionsMap.put(JavaScriptCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC, "50"); //$NON-NLS-1$
111
		defaultOptionsMap.put(JavaScriptCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC, "50"); //$NON-NLS-1$
112
112
113
		defaultOptionsMap.put("semanticValidation", "true"); //$NON-NLS-1$
114
113
		// Store default values to default preferences
115
		// Store default values to default preferences
114
	 	IEclipsePreferences defaultPreferences = ((IScopeContext) new DefaultScope()).getNode(JavaScriptCore.PLUGIN_ID);
116
	 	IEclipsePreferences defaultPreferences = ((IScopeContext) new DefaultScope()).getNode(JavaScriptCore.PLUGIN_ID);
115
		for (Iterator iter = defaultOptionsMap.entrySet().iterator(); iter.hasNext();) {
117
		for (Iterator iter = defaultOptionsMap.entrySet().iterator(); iter.hasNext();) {
(-)src/org/eclipse/wst/jsdt/internal/ui/preferences/ProblemSeveritiesConfigurationBlock.java (-4 / +39 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 7-16 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Michael Spector <spektom@gmail.com> -  Bug 243886
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.wst.jsdt.internal.ui.preferences;
12
package org.eclipse.wst.jsdt.internal.ui.preferences;
12
13
13
import org.eclipse.core.resources.IProject;
14
import org.eclipse.core.resources.IProject;
15
import org.eclipse.jface.dialogs.ControlEnableState;
14
import org.eclipse.jface.dialogs.IDialogSettings;
16
import org.eclipse.jface.dialogs.IDialogSettings;
15
import org.eclipse.swt.SWT;
17
import org.eclipse.swt.SWT;
16
import org.eclipse.swt.layout.GridData;
18
import org.eclipse.swt.layout.GridData;
Lines 32-37 Link Here
32
34
33
	private static final String SETTINGS_SECTION_NAME= "ProblemSeveritiesConfigurationBlock";  //$NON-NLS-1$
35
	private static final String SETTINGS_SECTION_NAME= "ProblemSeveritiesConfigurationBlock";  //$NON-NLS-1$
34
	
36
	
37
	private static final Key PREF_PB_SEMANTIC_VALIDATION_ENABLEMENT = getJDTCoreKey("semanticValidation"); //$NON-NLS-1$
38
	
35
	// Preference store keys, see JavaScriptCore.getOptions
39
	// Preference store keys, see JavaScriptCore.getOptions
36
	private static final Key PREF_PB_UNDEFINED_FIELD= getJDTCoreKey(JavaScriptCore.COMPILER_PB_UNDEFINED_FIELD);
40
	private static final Key PREF_PB_UNDEFINED_FIELD= getJDTCoreKey(JavaScriptCore.COMPILER_PB_UNDEFINED_FIELD);
37
//	private static final Key PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME= getJDTCoreKey(JavaScriptCore.COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME);
41
//	private static final Key PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME= getJDTCoreKey(JavaScriptCore.COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME);
Lines 116-123 Link Here
116
	private static final String ENABLED= JavaScriptCore.ENABLED;
120
	private static final String ENABLED= JavaScriptCore.ENABLED;
117
	private static final String DISABLED= JavaScriptCore.DISABLED;
121
	private static final String DISABLED= JavaScriptCore.DISABLED;
118
	
122
	
119
120
	private PixelConverter fPixelConverter;
123
	private PixelConverter fPixelConverter;
124
125
	private ControlEnableState fBlockEnableState;
126
	private Composite fControlsComposite;
121
	
127
	
122
	public ProblemSeveritiesConfigurationBlock(IStatusChangeListener context, IProject project, IWorkbenchPreferenceContainer container) {
128
	public ProblemSeveritiesConfigurationBlock(IStatusChangeListener context, IProject project, IWorkbenchPreferenceContainer container) {
123
		super(context, project, getKeys(), container);
129
		super(context, project, getKeys(), container);
Lines 130-135 Link Here
130
	
136
	
131
	private static Key[] getKeys() {
137
	private static Key[] getKeys() {
132
		return new Key[] {
138
		return new Key[] {
139
				PREF_PB_SEMANTIC_VALIDATION_ENABLEMENT,
133
				PREF_PB_UNDEFINED_FIELD,
140
				PREF_PB_UNDEFINED_FIELD,
134
				/*PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME,*/ PREF_PB_DEPRECATION, PREF_PB_HIDDEN_CATCH_BLOCK, PREF_PB_UNUSED_LOCAL,
141
				/*PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME,*/ PREF_PB_DEPRECATION, PREF_PB_HIDDEN_CATCH_BLOCK, PREF_PB_UNUSED_LOCAL,
135
				PREF_PB_UNUSED_PARAMETER, PREF_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE,
142
				PREF_PB_UNUSED_PARAMETER, PREF_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE,
Lines 168-178 Link Here
168
		layout.marginHeight= 0;
175
		layout.marginHeight= 0;
169
		layout.marginWidth= 0;
176
		layout.marginWidth= 0;
170
		mainComp.setLayout(layout);
177
		mainComp.setLayout(layout);
171
		
178
179
		if (fProject == null) {
180
			String label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_enableSemanticValidation;
181
			addCheckBox(mainComp, label, PREF_PB_SEMANTIC_VALIDATION_ENABLEMENT, new String[]{"true", "false"}, 0); //$NON-NLS-1$ //$NON-NLS-2$
182
			Label horizontalLine= new Label(mainComp, SWT.SEPARATOR | SWT.HORIZONTAL);
183
			horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
184
			horizontalLine.setFont(mainComp.getFont());
185
		}
186
172
		Composite commonComposite= createStyleTabContent(mainComp);
187
		Composite commonComposite= createStyleTabContent(mainComp);
173
		GridData gridData= new GridData(GridData.FILL, GridData.FILL, true, true);
188
		GridData gridData= new GridData(GridData.FILL, GridData.FILL, true, true);
174
		gridData.heightHint= fPixelConverter.convertHeightInCharsToPixels(20);
189
		gridData.heightHint= fPixelConverter.convertHeightInCharsToPixels(20);
175
		commonComposite.setLayoutData(gridData);
190
		commonComposite.setLayoutData(gridData);
191
192
		fControlsComposite = commonComposite;
176
		
193
		
177
		validateSettings(null, null, null);
194
		validateSettings(null, null, null);
178
	
195
	
Lines 494-500 Link Here
494
		}
511
		}
495
		
512
		
496
		if (changedKey != null) {
513
		if (changedKey != null) {
497
			if (PREF_PB_UNUSED_PARAMETER.equals(changedKey)  )
514
			if (PREF_PB_UNUSED_PARAMETER.equals(changedKey) || PREF_PB_SEMANTIC_VALIDATION_ENABLEMENT.equals(changedKey) )
498
//					PREF_PB_DEPRECATION.equals(changedKey) ||
515
//					PREF_PB_DEPRECATION.equals(changedKey) ||
499
//					PREF_PB_LOCAL_VARIABLE_HIDING.equals(changedKey) ||
516
//					PREF_PB_LOCAL_VARIABLE_HIDING.equals(changedKey) ||
500
//					PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION.equals(changedKey)) 
517
//					PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION.equals(changedKey)) 
Lines 513-518 Link Here
513
	}
530
	}
514
	
531
	
515
	private void updateEnableStates() {
532
	private void updateEnableStates() {
533
		boolean semantecValidationEnablement = checkValue(PREF_PB_SEMANTIC_VALIDATION_ENABLEMENT, "true"); //$NON-NLS-1$
534
		enableConfigControls(semantecValidationEnablement);
535
		
536
		if (!semantecValidationEnablement) {
516
		boolean enableUnusedParams= !checkValue(PREF_PB_UNUSED_PARAMETER, IGNORE);
537
		boolean enableUnusedParams= !checkValue(PREF_PB_UNUSED_PARAMETER, IGNORE);
517
//		getCheckBox(PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING).setEnabled(enableUnusedParams);
538
//		getCheckBox(PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING).setEnabled(enableUnusedParams);
518
		getCheckBox(PREF_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE).setEnabled(enableUnusedParams);
539
		getCheckBox(PREF_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE).setEnabled(enableUnusedParams);
Lines 526-531 Link Here
526
547
527
//		boolean enableHiding= !checkValue(PREF_PB_LOCAL_VARIABLE_HIDING, IGNORE);
548
//		boolean enableHiding= !checkValue(PREF_PB_LOCAL_VARIABLE_HIDING, IGNORE);
528
//		getCheckBox(PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD).setEnabled(enableHiding);
549
//		getCheckBox(PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD).setEnabled(enableHiding);
550
		}
551
	}
552
	
553
	protected void enableConfigControls(boolean enable) {
554
		if (enable) {
555
			if (fBlockEnableState != null) {
556
				fBlockEnableState.restore();
557
				fBlockEnableState= null;
558
			}
559
		} else {
560
			if (fBlockEnableState == null) {
561
				fBlockEnableState= ControlEnableState.disable(fControlsComposite);
562
			}
563
		}	
529
	}
564
	}
530
565
531
	protected String[] getFullBuildDialogStrings(boolean workspaceSettings) {
566
	protected String[] getFullBuildDialogStrings(boolean workspaceSettings) {
(-)src/org/eclipse/wst/jsdt/internal/ui/preferences/PreferencesMessages.java (-1 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 390-395 Link Here
390
	public static String ProblemSeveritiesConfigurationBlock_needsfullbuild_message;
390
	public static String ProblemSeveritiesConfigurationBlock_needsfullbuild_message;
391
	public static String ProblemSeveritiesConfigurationBlock_needsprojectbuild_message;
391
	public static String ProblemSeveritiesConfigurationBlock_needsprojectbuild_message;
392
	public static String ProblemSeveritiesConfigurationBlock_common_description;
392
	public static String ProblemSeveritiesConfigurationBlock_common_description;
393
	public static String ProblemSeveritiesConfigurationBlock_enableSemanticValidation;
393
	public static String ProblemSeveritiesConfigurationBlock_pb_unsafe_type_op_label;
394
	public static String ProblemSeveritiesConfigurationBlock_pb_unsafe_type_op_label;
394
	public static String ProblemSeveritiesConfigurationBlock_pb_raw_type_reference;
395
	public static String ProblemSeveritiesConfigurationBlock_pb_raw_type_reference;
395
	public static String ProblemSeveritiesConfigurationBlock_pb_final_param_bound_label;
396
	public static String ProblemSeveritiesConfigurationBlock_pb_final_param_bound_label;
(-)src/org/eclipse/wst/jsdt/internal/ui/preferences/PreferencesMessages.properties (+1 lines)
Lines 476-481 Link Here
476
ProblemSeveritiesConfigurationBlock_pb_missing_deprecated_annotation_label=Missing '@Deprecated' annotation:
476
ProblemSeveritiesConfigurationBlock_pb_missing_deprecated_annotation_label=Missing '@Deprecated' annotation:
477
ProblemSeveritiesConfigurationBlock_pb_annotation_super_interface_label=Annotation is used as super interface:
477
ProblemSeveritiesConfigurationBlock_pb_annotation_super_interface_label=Annotation is used as super interface:
478
ProblemSeveritiesConfigurationBlock_ignore_documented_unused_parameters=Ignore parameters documented with '&@param' tag
478
ProblemSeveritiesConfigurationBlock_ignore_documented_unused_parameters=Ignore parameters documented with '&@param' tag
479
ProblemSeveritiesConfigurationBlock_enableSemanticValidation=Enable se&mantic validation
479
ProblemSeveritiesConfigurationBlock_pb_type_parameter_hiding_label=Type parameter hides another type:
480
ProblemSeveritiesConfigurationBlock_pb_type_parameter_hiding_label=Type parameter hides another type:
480
ProblemSeveritiesConfigurationBlock_pb_unused_label_label=Unused 'break' or 'continue' label:
481
ProblemSeveritiesConfigurationBlock_pb_unused_label_label=Unused 'break' or 'continue' label:
481
JavadocProblemsPreferencePage_title=Jsdoc Comments
482
JavadocProblemsPreferencePage_title=Jsdoc Comments

Return to bug 277000