Author: akazakov
Date: 2010-10-14 07:48:49 -0400 (Thu, 14 Oct 2010)
New Revision: 25820
Added:
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/WebContent/pages/maxNumberOfMarkers.jsp
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityConfigurationBlock.java
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityPreferencesMessages.java
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityPreferencesMessages.properties
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/preferences/SeverityPreferences.java
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferenceInitializer.java
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferences.java
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidationErrorManager.java
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBConfigurationBlock.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorConfigurationBlock.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFPreferenceInitializer.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFSeverityPreferences.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/ELValidatorTest.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationErrorManager.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java
Log:
https://jira.jboss.org/browse/JBIDE-7147 Limited the number of problem markers per file.
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -47,5 +47,6 @@
defaultPreferences.put(CDIPreferences.ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING,
CDIPreferences.WARNING);
defaultPreferences.put(CDIPreferences.MISSING_NONBINDING_IN_INTERCEPTOR_BINDING_TYPE_MEMBER,
CDIPreferences.WARNING);
defaultPreferences.put(CDIPreferences.ILLEGAL_CONDITIONAL_OBSERVER,
CDIPreferences.WARNING);
+ defaultPreferences.putInt(SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME,
SeverityPreferences.DEFAULT_MAX_NUMBER_OF_MARKERS_PER_FILE);
}
}
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -279,4 +279,8 @@
public static boolean isValidationEnabled(IProject project) {
return INSTANCE.isEnabled(project);
}
+
+ public static int getMaxNumberOfProblemMarkersPerFile(IProject project) {
+ return INSTANCE.getMaxNumberOfProblemMarkersPerResource(project);
+ }
}
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -24,4 +24,13 @@
protected String getPreference(IProject project, String preferenceKey) {
return CDIPreferences.getInstance().getProjectPreference(project, preferenceKey);
}
+
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#getMaxNumberOfMarkersPerFile(org.eclipse.core.resources.IProject)
+ */
+ @Override
+ public int getMaxNumberOfMarkersPerFile(IProject project) {
+ return CDIPreferences.getMaxNumberOfProblemMarkersPerFile(project);
+ }
}
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -18,6 +18,7 @@
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.preferences.CDIPreferences;
+import org.jboss.tools.common.preferences.SeverityPreferences;
import org.jboss.tools.common.ui.preferences.SeverityConfigurationBlock;
/**
@@ -171,9 +172,17 @@
keys.add(ALL_SECTIONS[i].options[j].key);
}
}
+ keys.add(MAX_NUMBER_OF_PROBLEMS_KEY);
return keys.toArray(new Key[0]);
}
+ private static final Key MAX_NUMBER_OF_PROBLEMS_KEY = getKey(CDICorePlugin.PLUGIN_ID,
SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME);
+
+ @Override
+ protected Key getMaxNumberOfProblemsKey() {
+ return MAX_NUMBER_OF_PROBLEMS_KEY;
+ }
+
public CDIConfigurationBlock(IStatusChangeListener context,
IProject project, IWorkbenchPreferenceContainer container) {
super(context, project, getKeys(), container);
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/preferences/SeverityPreferences.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/preferences/SeverityPreferences.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/preferences/SeverityPreferences.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -18,6 +18,7 @@
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jdt.core.JavaCore;
+import org.jboss.tools.common.CommonPlugin;
/**
* Constants for names of seam preferences.
@@ -44,7 +45,9 @@
*/
public abstract class SeverityPreferences {
- public static String ENABLE_BLOCK_PREFERENCE_NAME = "enableBlock";
+ public static final String ENABLE_BLOCK_PREFERENCE_NAME = "enableBlock";
//$NON-NLS-1$
+ public static final String MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME =
CommonPlugin.PLUGIN_ID + ".validator.problem.markersBlock"; //$NON-NLS-1$
+ public static final int DEFAULT_MAX_NUMBER_OF_MARKERS_PER_FILE = 20;
public static final String ERROR = "error"; //$NON-NLS-1$
public static final String WARNING = "warning"; //$NON-NLS-1$
@@ -80,6 +83,24 @@
return value != null ? value : getInstancePreference(key);
}
+ public int getMaxNumberOfProblemMarkersPerResource(IProject project) {
+ IEclipsePreferences p = getProjectPreferences(project);
+ if(p == null) {
+ return 0;
+ }
+ String value = p.get(MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME, null);
+ if(value!=null) {
+ return p.getInt(MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME, 0);
+ }
+ p = getInstancePreferences();
+ value = p == null ? null : p.get(MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME, null);
+ if(value!=null) {
+ return p.getInt(MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME, 0);
+ }
+ p = getDefaultPreferences();
+ return p.getInt(MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME, 0);
+ }
+
public boolean isEnabled(IProject project) {
IEclipsePreferences p = getProjectPreferences(project);
if(p == null) {
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityConfigurationBlock.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityConfigurationBlock.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityConfigurationBlock.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -12,13 +12,17 @@
package org.jboss.tools.common.ui.preferences;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.corext.util.Messages;
import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
import org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock;
+import org.eclipse.jdt.internal.ui.preferences.PreferencesMessages;
import org.eclipse.jdt.internal.ui.preferences.ScrolledPageContent;
import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.layout.PixelConverter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontMetrics;
@@ -28,12 +32,13 @@
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.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
import org.jboss.tools.common.preferences.SeverityPreferences;
/**
- * Find in SeverirtyPreferences the instruction to Framework for Severity preferences
+ * See more info in SeverityPreferences.
* To modify section descriptions:
* 1) If new option is to be added to existing description,
* add array of two String objects, where first is the preference name
@@ -70,6 +75,8 @@
SeverityPreferencesMessages.VALIDATOR_CONFIGURATION_BLOCK_IGNORE
};
+ protected PixelConverter fPixelConverter;
+
public SeverityConfigurationBlock(IStatusChangeListener context,
IProject project, Key[] allKeys,
IWorkbenchPreferenceContainer container) {
@@ -88,6 +95,9 @@
final ScrolledPageContent sc1 = new ScrolledPageContent(folder);
Composite composite = sc1.getBody();
+
+ addMaxNumberOfMarkersField(composite);
+
GridLayout layout= new GridLayout(nColumns, false);
layout.marginHeight= 0;
layout.marginWidth= 0;
@@ -124,8 +134,37 @@
return sc1;
}
+ protected void addMaxNumberOfMarkersField(Composite composite) {
+ Text text = addTextField(composite, SeverityPreferencesMessages.MAX_NUMBER_OF_MARKERS,
getMaxNumberOfProblemsKey(), 0, 0);
+ GridData gd = (GridData) text.getLayoutData();
+ gd.widthHint = fPixelConverter.convertWidthInCharsToPixels(8);
+ gd.horizontalAlignment = GridData.BEGINNING;
+ text.setTextLimit(6);
+ }
+
+ private IStatus validateMaxNumberProblems() {
+ String number = getValue(getMaxNumberOfProblemsKey());
+ StatusInfo status= new StatusInfo();
+ if (number == null || 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;
+ }
+
+ abstract protected Key getMaxNumberOfProblemsKey();
+
@Override
protected Control createContents(Composite parent) {
+ fPixelConverter = new PixelConverter(parent);
setShell(parent.getShell());
Composite mainComp = new Composite(parent, SWT.NONE);
@@ -173,7 +212,15 @@
return;
}
- fContext.statusChanged(new StatusInfo());
+ if (changedKey != null) {
+ if (getMaxNumberOfProblemsKey().equals(changedKey)) {
+ fContext.statusChanged(validateMaxNumberProblems());
+ return;
+ } else {
+ return;
+ }
+ }
+ fContext.statusChanged(validateMaxNumberProblems());
}
public static class SectionDescription {
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityPreferencesMessages.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityPreferencesMessages.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityPreferencesMessages.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -28,6 +28,7 @@
public static String VALIDATOR_CONFIGURATION_BLOCK_IGNORE;
public static String VALIDATOR_CONFIGURATION_BLOCK_WARNING;
public static String ENABLE_VALIDATION;
+ public static String MAX_NUMBER_OF_MARKERS;
static {
NLS.initializeMessages(BUNDLE_NAME, SeverityPreferencesMessages.class);
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityPreferencesMessages.properties
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityPreferencesMessages.properties 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityPreferencesMessages.properties 2010-10-14
11:48:49 UTC (rev 25820)
@@ -18,4 +18,6 @@
VALIDATOR_CONFIGURATION_BLOCK_WARNING=Warning
VALIDATOR_CONFIGURATION_BLOCK_IGNORE=Ignore
-ENABLE_VALIDATION=Enable validation
\ No newline at end of file
+ENABLE_VALIDATION=Enable validation
+
+MAX_NUMBER_OF_MARKERS=Maximum number of problems reported per file:
\ No newline at end of file
Modified:
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferenceInitializer.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferenceInitializer.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferenceInitializer.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -31,6 +31,6 @@
for (String name : ESBPreferences.SEVERITY_OPTION_NAMES) {
defaultPreferences.put(name, SeverityPreferences.ERROR);
}
-// defaultPreferences.put(CDIPreferences.DECORATOR_HAS_NAME, CDIPreferences.WARNING);
+ defaultPreferences.putInt(SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME,
SeverityPreferences.DEFAULT_MAX_NUMBER_OF_MARKERS_PER_FILE);
}
}
\ No newline at end of file
Modified:
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferences.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferences.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferences.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -75,4 +75,7 @@
return INSTANCE.isEnabled(project);
}
+ public static int getMaxNumberOfProblemMarkersPerFile(IProject project) {
+ return INSTANCE.getMaxNumberOfProblemMarkersPerResource(project);
+ }
}
\ No newline at end of file
Modified:
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidationErrorManager.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidationErrorManager.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidationErrorManager.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -23,4 +23,13 @@
protected String getPreference(IProject project, String preferenceKey) {
return ESBPreferences.getInstance().getProjectPreference(project, preferenceKey);
}
+
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#getMaxNumberOfMarkersPerFile(org.eclipse.core.resources.IProject)
+ */
+ @Override
+ public int getMaxNumberOfMarkersPerFile(IProject project) {
+ return ESBPreferences.getMaxNumberOfProblemMarkersPerFile(project);
+ }
}
\ No newline at end of file
Modified:
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBConfigurationBlock.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBConfigurationBlock.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBConfigurationBlock.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -16,6 +16,7 @@
import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import org.jboss.tools.common.preferences.SeverityPreferences;
import org.jboss.tools.common.ui.preferences.SeverityConfigurationBlock;
import org.jboss.tools.esb.validator.ESBPreferences;
import org.jboss.tools.esb.validator.ESBValidatorPlugin;
@@ -56,9 +57,17 @@
keys.add(ALL_SECTIONS[i].options[j].key);
}
}
+ keys.add(MAX_NUMBER_OF_PROBLEMS_KEY);
return keys.toArray(new Key[0]);
}
+ private static final Key MAX_NUMBER_OF_PROBLEMS_KEY =
getKey(ESBValidatorPlugin.PLUGIN_ID,
SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME);
+
+ @Override
+ protected Key getMaxNumberOfProblemsKey() {
+ return MAX_NUMBER_OF_PROBLEMS_KEY;
+ }
+
public ESBConfigurationBlock(IStatusChangeListener context,
IProject project, IWorkbenchPreferenceContainer container) {
super(context, project, getKeys(), container);
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFPreferenceInitializer.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFPreferenceInitializer.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFPreferenceInitializer.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -38,5 +38,6 @@
defaultPreferences.put(JSFSeverityPreferences.EL_SYNTAX_ERROR,
JSFSeverityPreferences.WARNING);
defaultPreferences.put(JSFSeverityPreferences.CHECK_VARS,
JSFSeverityPreferences.ENABLE);
defaultPreferences.put(JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL,
JSFSeverityPreferences.ENABLE);
+ defaultPreferences.putInt(SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME,
SeverityPreferences.DEFAULT_MAX_NUMBER_OF_MARKERS_PER_FILE);
}
}
\ No newline at end of file
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFSeverityPreferences.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFSeverityPreferences.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFSeverityPreferences.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -81,6 +81,10 @@
return INSTANCE.isEnabled(project);
}
+ public static int getMaxNumberOfProblemMarkersPerFile(IProject project) {
+ return INSTANCE.getMaxNumberOfProblemMarkersPerResource(project);
+ }
+
public static boolean shouldValidateEL(IProject project) {
return !(SeverityPreferences.IGNORE.equals(INSTANCE.getProjectPreference(project,
UNKNOWN_EL_VARIABLE_NAME)) &&
SeverityPreferences.IGNORE.equals(INSTANCE.getProjectPreference(project,
UNKNOWN_EL_VARIABLE_PROPERTY_NAME)) &&
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -100,6 +100,15 @@
/*
* (non-Javadoc)
+ * @see
org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#getMaxNumberOfMarkersPerFile(org.eclipse.core.resources.IProject)
+ */
+ @Override
+ public int getMaxNumberOfMarkersPerFile(IProject project) {
+ return JSFSeverityPreferences.getMaxNumberOfProblemMarkersPerFile(project);
+ }
+
+ /*
+ * (non-Javadoc)
* @see
org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#init(org.eclipse.core.resources.IProject,
org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper,
org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager,
org.eclipse.wst.validation.internal.provisional.core.IReporter,
org.jboss.tools.jst.web.kb.validation.IValidationContext)
*/
@Override
@@ -275,7 +284,7 @@
// references[i].addMarker(marker);
}
}
- if(markers<MAX_NUMBER_OF_MARKERS_PER_RESOURCE) {
+ if(markers<getMaxNumberOfMarkersPerFile(file.getProject())) {
validateEL(references[i]);
}
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorConfigurationBlock.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorConfigurationBlock.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorConfigurationBlock.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -28,6 +28,7 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import org.jboss.tools.common.preferences.SeverityPreferences;
import org.jboss.tools.common.ui.preferences.SeverityConfigurationBlock;
import org.jboss.tools.jsf.JSFModelPlugin;
import org.jboss.tools.jsf.preferences.JSFSeverityPreferences;
@@ -69,9 +70,17 @@
}
keys.add(getKey(JSFModelPlugin.PLUGIN_ID, JSFSeverityPreferences.CHECK_VARS));
keys.add(getKey(JSFModelPlugin.PLUGIN_ID,
JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL));
+ keys.add(MAX_NUMBER_OF_PROBLEMS_KEY);
return keys.toArray(new Key[0]);
}
+ private static final Key MAX_NUMBER_OF_PROBLEMS_KEY = getKey(JSFModelPlugin.PLUGIN_ID,
SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME);
+
+ @Override
+ protected Key getMaxNumberOfProblemsKey() {
+ return MAX_NUMBER_OF_PROBLEMS_KEY;
+ }
+
public JSFValidatorConfigurationBlock(IStatusChangeListener context,
IProject project,
IWorkbenchPreferenceContainer container) {
@@ -85,6 +94,9 @@
final ScrolledPageContent sc1 = new ScrolledPageContent(folder);
Composite composite = sc1.getBody();
+
+ addMaxNumberOfMarkersField(composite);
+
GridLayout layout= new GridLayout(nColumns, false);
layout.marginHeight= 0;
layout.marginWidth= 0;
Added:
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/WebContent/pages/maxNumberOfMarkers.jsp
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/WebContent/pages/maxNumberOfMarkers.jsp
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/WebContent/pages/maxNumberOfMarkers.jsp 2010-10-14
11:48:49 UTC (rev 25820)
@@ -0,0 +1,4 @@
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
+
+<h:inputText id="userName" value="#{wrongUserName}"
required="true"/>
+<h:inputText id="userName" value="#{wrongUserName2}"
required="true"/>
\ No newline at end of file
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/WebContent/pages/maxNumberOfMarkers.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/ELValidatorTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/ELValidatorTest.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/ELValidatorTest.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -1,6 +1,5 @@
package org.jboss.tools.jsf.test.validation;
-import java.io.IOException;
import java.text.MessageFormat;
import org.eclipse.core.resources.IFile;
@@ -13,6 +12,7 @@
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.wst.validation.ValidationFramework;
import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.jboss.tools.common.preferences.SeverityPreferences;
import org.jboss.tools.jsf.JSFModelPlugin;
import org.jboss.tools.jsf.preferences.JSFSeverityPreferences;
import org.jboss.tools.jsf.web.validation.JSFValidationMessages;
@@ -34,7 +34,6 @@
}
public void testUnknownELVariable() throws CoreException, ValidationException {
-
IPreferenceStore store = JSFModelPlugin.getDefault().getPreferenceStore();
store.setValue(JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL,
JSFSeverityPreferences.ENABLE);
store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME,
JSFSeverityPreferences.ERROR);
@@ -85,7 +84,44 @@
store.setValue(JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL,
JSFSeverityPreferences.ENABLE);
store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME,
JSFSeverityPreferences.IGNORE);
}
+
+ public void testMaxNumberOfMarkersPerFile() throws CoreException {
+ IPreferenceStore store = JSFModelPlugin.getDefault().getPreferenceStore();
+ int max = store.getInt(SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME);
+ store.setValue(SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME, 1);
+ String errorSeverity =
store.getString(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME);
+ store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME,
JSFSeverityPreferences.ERROR);
+
+ try {
+ assertMarkerIsCreatedForLine(
+ "WebContent/pages/maxNumberOfMarkers.jsp",
+ JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
+ new Object[] {"wrongUserName"},
+ 3);
+ assertMarkerIsNotCreatedForLine(
+ "WebContent/pages/maxNumberOfMarkers.jsp",
+ JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
+ new Object[] {"wrongUserName2"},
+ 4);
+ store.setValue(SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME, max);
+
+ assertMarkerIsCreatedForLine(
+ "WebContent/pages/maxNumberOfMarkers.jsp",
+ JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
+ new Object[] {"wrongUserName"},
+ 3);
+ assertMarkerIsCreatedForLine(
+ "WebContent/pages/maxNumberOfMarkers.jsp",
+ JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
+ new Object[] {"wrongUserName2"},
+ 4);
+ } finally {
+ store.setValue(SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME, max);
+ store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, errorSeverity);
+ }
+ }
+
private void assertMarkerIsCreatedForLine(String fileName, String template, Object[]
parameters, int lineNumber) throws CoreException{
String messagePattern = MessageFormat.format(template, parameters);
IFile file = project.getFile(fileName);
@@ -116,7 +152,5 @@
fail("Marker "+messagePattern+" for line - "+lineNumber+"
has been found");
}
}
-
}
-
-}
+}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -40,8 +40,6 @@
*/
public abstract class ValidationErrorManager implements IValidationErrorManager {
- public static final int MAX_NUMBER_OF_MARKERS_PER_RESOURCE = 20;
-
static String VALIDATION_MARKER = ValidationPlugin.PLUGIN_ID +
".problemmarker"; //$NON-NLS-1$
static String VALIDATION_MARKER_OWNER = "owner"; //$NON-NLS-1$
static String VALIDATION_MARKER_GROUP = "groupName"; //$NON-NLS-1$
@@ -211,20 +209,7 @@
return addError(message, severity, messageArguments, lineNumber, length, offset,
target, getDocumentProvider(), getMarkerId(), getMarkerOwner());
}
- /**
- *
- * @param message
- * @param severity
- * @param messageArguments
- * @param length
- * @param offset
- * @param target
- * @param documentProvider
- * @param markerId
- * @param markerOwner
- * @return
- */
- public static IMarker addError(String message, int severity, Object[] messageArguments,
int lineNumber, int length, int offset, IResource target, TextFileDocumentProvider
documentProvider, String markerId, Class markerOwner) {
+ public static IMarker addError(String message, int severity, Object[] messageArguments,
int lineNumber, int length, int offset, IResource target, TextFileDocumentProvider
documentProvider, String markerId, Class markerOwner, int maxNumberOfMarkersPerFile) {
IMarker marker = null;
try {
if(lineNumber<1) {
@@ -242,7 +227,7 @@
}
marker = addTask(markerOwner.getName().intern(), target, lineNumber,
MessageFormat.format(message, messageArguments),
- severity, null, markerId, offset, length);
+ severity, null, markerId, offset, length, maxNumberOfMarkersPerFile);
} catch (CoreException e) {
WebKbPlugin.getDefault().logError(
NLS.bind(KbMessages.EXCEPTION_DURING_CREATING_MARKER, target.getFullPath()), e);
@@ -255,18 +240,39 @@
return marker;
}
+ /**
+ *
+ * @param message
+ * @param severity
+ * @param messageArguments
+ * @param length
+ * @param offset
+ * @param target
+ * @param documentProvider
+ * @param markerId
+ * @param markerOwner
+ * @return
+ */
+ public IMarker addError(String message, int severity, Object[] messageArguments, int
lineNumber, int length, int offset, IResource target, TextFileDocumentProvider
documentProvider, String markerId, Class markerOwner) {
+ return addError(message, severity, messageArguments, lineNumber, length, offset,
target, documentProvider, markerId, markerOwner,
getMaxNumberOfMarkersPerFile(target.getProject()));
+ }
+
+ abstract public int getMaxNumberOfMarkersPerFile(IProject project);
+
private static IMarker addTask(String pluginId, IResource resource, int location,
- String message, int markerType, String targetObjectName,
- String groupName, int offset, int length) throws CoreException {
+ String message, int markerType, String targetObjectName,
+ String groupName, int offset, int length, int maxNumberOfMarkersPerFile) throws
CoreException {
if ((message == null) || (resource == null) || (!resource.exists())) {
return null;
}
int severity = getSeverity(markerType);
- int existingMarkers = resource.findMarkers(VALIDATION_MARKER, true,
IResource.DEPTH_ZERO).length;
- if(existingMarkers>MAX_NUMBER_OF_MARKERS_PER_RESOURCE) {
- return null;
+ if(maxNumberOfMarkersPerFile>0) {
+ int existingMarkers = resource.findMarkers(VALIDATION_MARKER, true,
IResource.DEPTH_ZERO).length;
+ if(existingMarkers>maxNumberOfMarkersPerFile) {
+ return null;
+ }
}
IMarker item = resource.createMarker(VALIDATION_MARKER); // add a validation marker
@@ -301,6 +307,12 @@
return item;
}
+ private IMarker addTask(String pluginId, IResource resource, int location,
+ String message, int markerType, String targetObjectName,
+ String groupName, int offset, int length) throws CoreException {
+ return addTask(pluginId, resource, location, message, markerType, targetObjectName,
groupName, offset, length, getMaxNumberOfMarkersPerFile(resource.getProject()));
+ }
+
private static int getSeverity(int severityEnumValue) {
switch (severityEnumValue) {
case (IMessage.HIGH_SEVERITY) : {
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -178,4 +178,8 @@
public static boolean isValidationEnabled(IProject project) {
return INSTANCE.isEnabled(project);
}
+
+ public static int getMaxNumberOfProblemMarkersPerFile(IProject project) {
+ return INSTANCE.getMaxNumberOfProblemMarkersPerResource(project);
+ }
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -41,5 +41,6 @@
//JBIDE-2958 temporary until JBIDE-2957 solved //TODO solve JBIDE-2957
defaultPreferences.put(SeamPreferences.UNKNOWN_COMPONENT_CLASS_NAME_GUESS,
SeamPreferences.WARNING);
+ defaultPreferences.putInt(SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME,
SeverityPreferences.DEFAULT_MAX_NUMBER_OF_MARKERS_PER_FILE);
}
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -188,11 +188,11 @@
int position = offset + text.indexOf(jarName);
int length = jarName.length();
if(SEAM_JAR_NAME.equals(jarName)) {
- ValidationErrorManager.addError(SeamValidationMessages.INVALID_JAR_MODULE_IN_APPLICATION_XML,
IMessage.HIGH_SEVERITY, new String[]{jarName}, 0, length, position, file,
documentProvider, SeamValidationErrorManager.MARKED_SEAM_PROJECT_MESSAGE_GROUP,
this.getClass());
+ ValidationErrorManager.addError(SeamValidationMessages.INVALID_JAR_MODULE_IN_APPLICATION_XML,
IMessage.HIGH_SEVERITY, new String[]{jarName}, 0, length, position, file,
documentProvider, SeamValidationErrorManager.MARKED_SEAM_PROJECT_MESSAGE_GROUP,
this.getClass(), 0);
break;
}
if(jarName.startsWith(JARS[jarIndex])) {
- ValidationErrorManager.addError(SeamValidationMessages.INVALID_JAR_MODULE_IN_APPLICATION_XML,
IMessage.NORMAL_SEVERITY, new String[]{jarName}, 0, length, position, file,
documentProvider, SeamValidationErrorManager.MARKED_SEAM_PROJECT_MESSAGE_GROUP,
this.getClass());
+ ValidationErrorManager.addError(SeamValidationMessages.INVALID_JAR_MODULE_IN_APPLICATION_XML,
IMessage.NORMAL_SEVERITY, new String[]{jarName}, 0, length, position, file,
documentProvider, SeamValidationErrorManager.MARKED_SEAM_PROJECT_MESSAGE_GROUP,
this.getClass(), 0);
break;
}
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationErrorManager.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationErrorManager.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationErrorManager.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -28,4 +28,13 @@
protected String getPreference(IProject project, String preferenceKey) {
return SeamPreferences.getInstance().getProjectPreference(project, preferenceKey);
}
+
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#getMaxNumberOfMarkersPerFile(org.eclipse.core.resources.IProject)
+ */
+ @Override
+ public int getMaxNumberOfMarkersPerFile(IProject project) {
+ return SeamPreferences.getMaxNumberOfProblemMarkersPerFile(project);
+ }
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java 2010-10-14
11:33:19 UTC (rev 25819)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java 2010-10-14
11:48:49 UTC (rev 25820)
@@ -17,6 +17,7 @@
import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import org.jboss.tools.common.preferences.SeverityPreferences;
import org.jboss.tools.common.ui.preferences.SeverityConfigurationBlock;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.SeamPreferences;
@@ -134,8 +135,6 @@
SECTION_SETTINGS
};
- //private PixelConverter fPixelConverter;
-
private static Key[] getKeys() {
ArrayList<Key> keys = new ArrayList<Key>();
for (int i = 0; i < ALL_SECTIONS.length; i++) {
@@ -143,9 +142,17 @@
keys.add(ALL_SECTIONS[i].options[j].key);
}
}
+ keys.add(MAX_NUMBER_OF_PROBLEMS_KEY);
return keys.toArray(new Key[0]);
}
+ private static final Key MAX_NUMBER_OF_PROBLEMS_KEY = getKey(SeamCorePlugin.PLUGIN_ID,
SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME);
+
+ @Override
+ protected Key getMaxNumberOfProblemsKey() {
+ return MAX_NUMBER_OF_PROBLEMS_KEY;
+ }
+
public SeamValidatorConfigurationBlock(IStatusChangeListener context,
IProject project,
IWorkbenchPreferenceContainer container) {