Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 243886 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/wst/jsdt/internal/ui/preferences/ProblemSeveritiesConfigurationBlock.java (-13 / +43 lines)
Lines 11-16 Link Here
11
package org.eclipse.wst.jsdt.internal.ui.preferences;
11
package org.eclipse.wst.jsdt.internal.ui.preferences;
12
12
13
import org.eclipse.core.resources.IProject;
13
import org.eclipse.core.resources.IProject;
14
import org.eclipse.jface.dialogs.ControlEnableState;
14
import org.eclipse.jface.dialogs.IDialogSettings;
15
import org.eclipse.jface.dialogs.IDialogSettings;
15
import org.eclipse.swt.SWT;
16
import org.eclipse.swt.SWT;
16
import org.eclipse.swt.layout.GridData;
17
import org.eclipse.swt.layout.GridData;
Lines 32-37 Link Here
32
33
33
	private static final String SETTINGS_SECTION_NAME= "ProblemSeveritiesConfigurationBlock";  //$NON-NLS-1$
34
	private static final String SETTINGS_SECTION_NAME= "ProblemSeveritiesConfigurationBlock";  //$NON-NLS-1$
34
	
35
	
36
	private static final Key PREF_PB_ONLY_PARSE_ERRORS = getJDTCoreKey("onlySyntaxErrors"); //$NON-NLS-1$
37
	
35
	// Preference store keys, see JavaScriptCore.getOptions
38
	// Preference store keys, see JavaScriptCore.getOptions
36
	private static final Key PREF_PB_UNDEFINED_FIELD= getJDTCoreKey(JavaScriptCore.COMPILER_PB_UNDEFINED_FIELD);
39
	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);
40
//	private static final Key PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME= getJDTCoreKey(JavaScriptCore.COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME);
Lines 117-122 Link Here
117
	
120
	
118
121
119
	private PixelConverter fPixelConverter;
122
	private PixelConverter fPixelConverter;
123
124
	private ControlEnableState fBlockEnableState;
125
	private Composite fControlsComposite;
120
	
126
	
121
	public ProblemSeveritiesConfigurationBlock(IStatusChangeListener context, IProject project, IWorkbenchPreferenceContainer container) {
127
	public ProblemSeveritiesConfigurationBlock(IStatusChangeListener context, IProject project, IWorkbenchPreferenceContainer container) {
122
		super(context, project, getKeys(), container);
128
		super(context, project, getKeys(), container);
Lines 129-134 Link Here
129
	
135
	
130
	private static Key[] getKeys() {
136
	private static Key[] getKeys() {
131
		return new Key[] {
137
		return new Key[] {
138
				PREF_PB_ONLY_PARSE_ERRORS,
132
				PREF_PB_UNDEFINED_FIELD,
139
				PREF_PB_UNDEFINED_FIELD,
133
				/*PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME,*/ PREF_PB_DEPRECATION, PREF_PB_HIDDEN_CATCH_BLOCK, PREF_PB_UNUSED_LOCAL,
140
				/*PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME,*/ PREF_PB_DEPRECATION, PREF_PB_HIDDEN_CATCH_BLOCK, PREF_PB_UNUSED_LOCAL,
134
				PREF_PB_UNUSED_PARAMETER, PREF_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE,
141
				PREF_PB_UNUSED_PARAMETER, PREF_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE,
Lines 167-176 Link Here
167
		layout.marginWidth= 0;
174
		layout.marginWidth= 0;
168
		mainComp.setLayout(layout);
175
		mainComp.setLayout(layout);
169
		
176
		
177
		String label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_onlySyntaxErrors; 
178
		addCheckBox(mainComp, label, PREF_PB_ONLY_PARSE_ERRORS, new String[] {"true", "false"}, 0); //$NON-NLS-1$ //$NON-NLS-2$
179
		
170
		Composite commonComposite= createStyleTabContent(mainComp);
180
		Composite commonComposite= createStyleTabContent(mainComp);
171
		GridData gridData= new GridData(GridData.FILL, GridData.FILL, true, true);
181
		GridData gridData= new GridData(GridData.FILL, GridData.FILL, true, true);
172
		gridData.heightHint= fPixelConverter.convertHeightInCharsToPixels(20);
182
		gridData.heightHint= fPixelConverter.convertHeightInCharsToPixels(20);
173
		commonComposite.setLayoutData(gridData);
183
		commonComposite.setLayoutData(gridData);
184
185
		fControlsComposite = commonComposite;
174
		
186
		
175
		validateSettings(null, null, null);
187
		validateSettings(null, null, null);
176
	
188
	
Lines 489-495 Link Here
489
		}
501
		}
490
		
502
		
491
		if (changedKey != null) {
503
		if (changedKey != null) {
492
			if (PREF_PB_UNUSED_PARAMETER.equals(changedKey)  )
504
			if (PREF_PB_UNUSED_PARAMETER.equals(changedKey) || PREF_PB_ONLY_PARSE_ERRORS.equals(changedKey) )
493
//					PREF_PB_DEPRECATION.equals(changedKey) ||
505
//					PREF_PB_DEPRECATION.equals(changedKey) ||
494
//					PREF_PB_LOCAL_VARIABLE_HIDING.equals(changedKey) ||
506
//					PREF_PB_LOCAL_VARIABLE_HIDING.equals(changedKey) ||
495
//					PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION.equals(changedKey)) 
507
//					PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION.equals(changedKey)) 
Lines 508-526 Link Here
508
	}
520
	}
509
	
521
	
510
	private void updateEnableStates() {
522
	private void updateEnableStates() {
511
		boolean enableUnusedParams= !checkValue(PREF_PB_UNUSED_PARAMETER, IGNORE);
523
		boolean onlyParseErrors = checkValue(PREF_PB_ONLY_PARSE_ERRORS, "true"); //$NON-NLS-1$
512
//		getCheckBox(PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING).setEnabled(enableUnusedParams);
524
		enableConfigControls(!onlyParseErrors);
513
		getCheckBox(PREF_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE).setEnabled(enableUnusedParams);
514
		
515
		boolean enableDeprecation= !checkValue(PREF_PB_DEPRECATION, IGNORE);
516
		getCheckBox(PREF_PB_DEPRECATION_IN_DEPRECATED_CODE).setEnabled(enableDeprecation);
517
		getCheckBox(PREF_PB_DEPRECATION_WHEN_OVERRIDING).setEnabled(enableDeprecation);
518
		
525
		
519
//		boolean enableThrownExceptions= !checkValue(PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION, IGNORE);
526
		if (!onlyParseErrors) {
520
//		getCheckBox(PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING).setEnabled(enableThrownExceptions);
527
			boolean enableUnusedParams= !checkValue(PREF_PB_UNUSED_PARAMETER, IGNORE);
521
528
	//		getCheckBox(PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING).setEnabled(enableUnusedParams);
522
//		boolean enableHiding= !checkValue(PREF_PB_LOCAL_VARIABLE_HIDING, IGNORE);
529
			getCheckBox(PREF_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE).setEnabled(enableUnusedParams);
523
//		getCheckBox(PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD).setEnabled(enableHiding);
530
			
531
			boolean enableDeprecation= !checkValue(PREF_PB_DEPRECATION, IGNORE);
532
			getCheckBox(PREF_PB_DEPRECATION_IN_DEPRECATED_CODE).setEnabled(enableDeprecation);
533
			getCheckBox(PREF_PB_DEPRECATION_WHEN_OVERRIDING).setEnabled(enableDeprecation);
534
			
535
	//		boolean enableThrownExceptions= !checkValue(PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION, IGNORE);
536
	//		getCheckBox(PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING).setEnabled(enableThrownExceptions);
537
	
538
	//		boolean enableHiding= !checkValue(PREF_PB_LOCAL_VARIABLE_HIDING, IGNORE);
539
	//		getCheckBox(PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD).setEnabled(enableHiding);
540
		}
541
	}
542
	
543
	protected void enableConfigControls(boolean enable) {
544
		if (enable) {
545
			if (fBlockEnableState != null) {
546
				fBlockEnableState.restore();
547
				fBlockEnableState= null;
548
			}
549
		} else {
550
			if (fBlockEnableState == null) {
551
				fBlockEnableState= ControlEnableState.disable(fControlsComposite);
552
			}
553
		}	
524
	}
554
	}
525
555
526
	protected String[] getFullBuildDialogStrings(boolean workspaceSettings) {
556
	protected String[] getFullBuildDialogStrings(boolean workspaceSettings) {
(-)src/org/eclipse/wst/jsdt/internal/ui/preferences/PreferencesMessages.java (+1 lines)
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_onlySyntaxErrors;
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 475-480 Link Here
475
ProblemSeveritiesConfigurationBlock_pb_missing_deprecated_annotation_label=Missing '@Deprecated' annotation:
475
ProblemSeveritiesConfigurationBlock_pb_missing_deprecated_annotation_label=Missing '@Deprecated' annotation:
476
ProblemSeveritiesConfigurationBlock_pb_annotation_super_interface_label=Annotation is used as super interface:
476
ProblemSeveritiesConfigurationBlock_pb_annotation_super_interface_label=Annotation is used as super interface:
477
ProblemSeveritiesConfigurationBlock_ignore_documented_unused_parameters=Ignore parameters documented with '&@param' tag
477
ProblemSeveritiesConfigurationBlock_ignore_documented_unused_parameters=Ignore parameters documented with '&@param' tag
478
ProblemSeveritiesConfigurationBlock_onlySyntaxErrors=Disable JavaScript se&mantic alanyzer (only show parse errors)
478
ProblemSeveritiesConfigurationBlock_pb_type_parameter_hiding_label=Type parameter hides another type:
479
ProblemSeveritiesConfigurationBlock_pb_type_parameter_hiding_label=Type parameter hides another type:
479
ProblemSeveritiesConfigurationBlock_pb_unused_label_label=Unused 'break' or 'continue' label:
480
ProblemSeveritiesConfigurationBlock_pb_unused_label_label=Unused 'break' or 'continue' label:
480
JavadocProblemsPreferencePage_title=Jsdoc Comments
481
JavadocProblemsPreferencePage_title=Jsdoc Comments
(-)src/org/eclipse/wst/jsdt/internal/compiler/problem/ProblemReporter.java (+6 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.problem;
12
package org.eclipse.wst.jsdt.internal.compiler.problem;
12
13
Lines 1115-1121 Link Here
1115
 * to indicate that this problem is configurable through options
1116
 * to indicate that this problem is configurable through options
1116
 */
1117
 */
1117
public int computeSeverity(int problemID){
1118
public int computeSeverity(int problemID){
1119
 	
1118
1120
1121
	if (this.options.onlyReportSyntaxErrors && (problemID & (IProblem.Syntax | IProblem.Javadoc)) == 0) {
1122
		return ProblemSeverities.Ignore;
1123
	}
1124
	
1119
	switch (problemID) {
1125
	switch (problemID) {
1120
		case IProblem.Task :
1126
		case IProblem.Task :
1121
			return ProblemSeverities.Warning;
1127
			return ProblemSeverities.Warning;
(-)src/org/eclipse/wst/jsdt/internal/compiler/impl/CompilerOptions.java (+13 lines)
Lines 357-367 Link Here
357
	public InferOptions inferOptions=new InferOptions();
357
	public InferOptions inferOptions=new InferOptions();
358
358
359
359
360
    public boolean onlyReportSyntaxErrors=false;
361
	
362
360
	/**
363
	/**
361
	 * Initializing the compiler options with defaults
364
	 * Initializing the compiler options with defaults
362
	 */
365
	 */
363
	public CompilerOptions(){
366
	public CompilerOptions(){
364
		// use default options
367
		// use default options
368
		try {
369
			this.onlyReportSyntaxErrors=JavaScriptCore.getPlugin().getPluginPreferences().getBoolean("onlySyntaxErrors");
370
		} catch (Exception ex) 
371
		{this.onlyReportSyntaxErrors=false;}
372
365
	}
373
	}
366
374
367
	/**
375
	/**
Lines 685-690 Link Here
685
693
686
	public void set(Map optionsMap) {
694
	public void set(Map optionsMap) {
687
695
696
		try {
697
			this.onlyReportSyntaxErrors=JavaScriptCore.getPlugin().getPluginPreferences().getBoolean("onlySyntaxErrors");
698
		} catch (Exception ex) 
699
		{this.onlyReportSyntaxErrors=false;}
700
688
		Object optionValue;
701
		Object optionValue;
689
		if ((optionValue = optionsMap.get(OPTION_LocalVariableAttribute)) != null) {
702
		if ((optionValue = optionsMap.get(OPTION_LocalVariableAttribute)) != null) {
690
			if (GENERATE.equals(optionValue)) {
703
			if (GENERATE.equals(optionValue)) {
(-)src/org/eclipse/wst/jsdt/internal/compiler/Compiler.java (+7 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;
12
package org.eclipse.wst.jsdt.internal.compiler;
12
13
Lines 397-402 Link Here
397
		CompilationUnitDeclaration unit,
398
		CompilationUnitDeclaration unit,
398
		CompilationResult result) {
399
		CompilationResult result) {
399
400
401
		
402
		if (this.options.onlyReportSyntaxErrors)
403
			return;
400
		if ((result == null) && (unit != null)) {
404
		if ((result == null) && (unit != null)) {
401
			result = unit.compilationResult; // current unit being processed ?
405
			result = unit.compilationResult; // current unit being processed ?
402
		}
406
		}
Lines 461-466 Link Here
461
	protected void handleInternalException(
465
	protected void handleInternalException(
462
		AbortCompilation abortException,
466
		AbortCompilation abortException,
463
		CompilationUnitDeclaration unit) {
467
		CompilationUnitDeclaration unit) {
468
		
469
		if (this.options.onlyReportSyntaxErrors)
470
			return;
464
471
465
		/* special treatment for SilentAbort: silently cancelling the compilation process */
472
		/* special treatment for SilentAbort: silently cancelling the compilation process */
466
		if (abortException.isSilent) {
473
		if (abortException.isSilent) {

Return to bug 243886