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) { |