summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor V Rubezhny2013-10-21 10:16:41 (EDT)
committerChris2013-10-23 10:27:32 (EDT)
commit050e9bb3430b167792c1fdbca0b718af97a925b7 (patch)
tree4d133f6d3893dfbdfe20b69b4d2056549a536a20
parent7602621ae83877d908e5c725d57f72d2ce897d7d (diff)
downloadwebtools.jsdt.core-050e9bb3430b167792c1fdbca0b718af97a925b7.zip
webtools.jsdt.core-050e9bb3430b167792c1fdbca0b718af97a925b7.tar.gz
webtools.jsdt.core-050e9bb3430b167792c1fdbca0b718af97a925b7.tar.bz2
[417465] - JavaScript Validation reports max 100 problems per .js file
-rw-r--r--bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/JavaCorePreferenceInitializer.java6
-rw-r--r--bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/JavaModelManager.java1
-rw-r--r--bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/preferences/ProblemSeveritiesConfigurationBlock.java52
3 files changed, 53 insertions, 6 deletions
diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/JavaCorePreferenceInitializer.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/JavaCorePreferenceInitializer.java
index 206f97d..82952c0 100644
--- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/JavaCorePreferenceInitializer.java
+++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/JavaCorePreferenceInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2011, 2013 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
@@ -109,6 +109,10 @@ public class JavaCorePreferenceInitializer extends AbstractPreferenceInitializer
defaultOptionsMap.put(JavaScriptCore.COMPILER_PB_UNINITIALIZED_LOCAL_VARIABLE, JavaScriptCore.WARNING);
/* END -------------------------------- Bug 197884 Loosly defined var (for statement) and optional semi-colon --------------------- */
+ /* START -------------------------------- Bug 417465 - JavaScript Validation reports max 100 problems per .js file --------------------- */
+ defaultOptionsMap.put(JavaScriptCore.COMPILER_PB_MAX_PER_UNIT, String.valueOf(100));
+ /* END -------------------------------- Bug 417465 - JavaScript Validation reports max 100 problems per .js file --------------------- */
+
// Time out for parameter names
defaultOptionsMap.put(JavaScriptCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC, "50"); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/JavaModelManager.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/JavaModelManager.java
index 1a1f429..6acd3c9 100644
--- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/JavaModelManager.java
+++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/JavaModelManager.java
@@ -1729,6 +1729,7 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis
defaultOptionsMap.put(JavaScriptCore.COMPILER_DOC_COMMENT_SUPPORT, JavaScriptCore.ENABLED);
defaultOptionsMap.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR);
defaultOptionsMap.put(JavaScriptCore.COMPILER_SEMANTIC_VALIDATION, JavaScriptCore.ENABLED);
+ defaultOptionsMap.put(JavaScriptCore.COMPILER_PB_MAX_PER_UNIT, String.valueOf(100));
// Builder settings
defaultOptionsMap.put(JavaScriptCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, ""); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/preferences/ProblemSeveritiesConfigurationBlock.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/preferences/ProblemSeveritiesConfigurationBlock.java
index e489c18..067942a 100644
--- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/preferences/ProblemSeveritiesConfigurationBlock.java
+++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/preferences/ProblemSeveritiesConfigurationBlock.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2011, 2013 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
@@ -11,6 +11,7 @@
package org.eclipse.wst.jsdt.internal.ui.preferences;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.ControlEnableState;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.layout.GridDataFactory;
@@ -21,10 +22,12 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
import org.eclipse.wst.jsdt.core.JavaScriptCore;
+import org.eclipse.wst.jsdt.internal.corext.util.Messages;
import org.eclipse.wst.jsdt.internal.ui.JavaScriptPlugin;
import org.eclipse.wst.jsdt.internal.ui.dialogs.StatusInfo;
import org.eclipse.wst.jsdt.internal.ui.util.PixelConverter;
@@ -115,6 +118,10 @@ public class ProblemSeveritiesConfigurationBlock extends OptionsConfigurationBlo
/* END -------------------------------- Bug 197884 Loosly defined var (for statement) and optional semi-colon --------------------- */
+ /* START -------------------------------- Bug 417465 - JavaScript Validation reports max 100 problems per .js file --------------------- */
+ private static final Key PREF_PB_MAX_PER_UNIT= getJDTCoreKey(JavaScriptCore.COMPILER_PB_MAX_PER_UNIT);
+ /* END -------------------------------- Bug 417465 - JavaScript Validation reports max 100 problems per .js file --------------------- */
+
// values
private static final String ERROR= JavaScriptCore.ERROR;
private static final String WARNING= JavaScriptCore.WARNING;
@@ -141,6 +148,7 @@ public class ProblemSeveritiesConfigurationBlock extends OptionsConfigurationBlo
private static Key[] getKeys() {
return new Key[] {
+ PREF_PB_MAX_PER_UNIT,
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,
@@ -174,14 +182,24 @@ public class ProblemSeveritiesConfigurationBlock extends OptionsConfigurationBlo
fPixelConverter= new PixelConverter(parent);
setShell(parent.getShell());
+ int nColumns= 3;
+
Composite mainComp= new Composite(parent, SWT.NONE);
mainComp.setFont(parent.getFont());
GridLayout layout= new GridLayout();
+ layout.numColumns= nColumns;
layout.marginHeight= 0;
layout.marginWidth= 0;
mainComp.setLayout(layout);
- String label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_enableSemanticValidation;
+ String label= PreferencesMessages.JavaBuildConfigurationBlock_pb_max_per_unit_label;
+ Text text= addTextField(mainComp, label, PREF_PB_MAX_PER_UNIT, 0, 0);
+ GridData gd= (GridData) text.getLayoutData();
+ gd.widthHint= fPixelConverter.convertWidthInCharsToPixels(8);
+ gd.horizontalAlignment= GridData.END;
+ text.setTextLimit(6);
+
+ label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_enableSemanticValidation;
semanticCheckBox = addCheckBox(mainComp, label, PREF_PB_SEMANTIC_VALIDATION_ENABLEMENT, new String[]{ENABLED, DISABLED}, 0);
Label horizontalLine= new Label(mainComp, SWT.SEPARATOR | SWT.HORIZONTAL);
horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
@@ -519,12 +537,17 @@ public class ProblemSeveritiesConfigurationBlock extends OptionsConfigurationBlo
return;
}
+ IStatus maxNumberProblemsStatus = new StatusInfo();
if (changedKey != null) {
- if (PREF_PB_UNUSED_PARAMETER.equals(changedKey) || PREF_PB_SEMANTIC_VALIDATION_ENABLEMENT.equals(changedKey) )
+ if ( PREF_PB_MAX_PER_UNIT.equals(changedKey) ||
+ 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))
{
+ if (PREF_PB_MAX_PER_UNIT.equals(changedKey)) {
+ maxNumberProblemsStatus= validateMaxNumberProblems();
+ }
updateEnableStates();
// } else if (PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING.equals(changedKey)) {
// // merging the two options
@@ -533,9 +556,10 @@ public class ProblemSeveritiesConfigurationBlock extends OptionsConfigurationBlo
return;
}
} else {
+ maxNumberProblemsStatus= validateMaxNumberProblems();
updateEnableStates();
- }
- fContext.statusChanged(new StatusInfo());
+ }
+ fContext.statusChanged(maxNumberProblemsStatus);
}
private void updateEnableStates() {
@@ -583,6 +607,24 @@ public class ProblemSeveritiesConfigurationBlock extends OptionsConfigurationBlo
return new String[] { title, message };
}
+ private IStatus validateMaxNumberProblems() {
+ String number= getValue(PREF_PB_MAX_PER_UNIT);
+ StatusInfo status= new StatusInfo();
+ if (number.length() == 0) {
+ status.setError(PreferencesMessages.JavaBuildConfigurationBlock_empty_input);
+ } else {
+ try {
+ int value= Integer.parseInt(number);
+ if (value <= 0) {
+ status.setError(Messages.format(PreferencesMessages.JavaBuildConfigurationBlock_invalid_input, number));
+ }
+ } catch (NumberFormatException e) {
+ status.setError(Messages.format(PreferencesMessages.JavaBuildConfigurationBlock_invalid_input, number));
+ }
+ }
+ return status;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.wst.jsdt.internal.ui.preferences.OptionsConfigurationBlock#dispose()
*/