Author: akazakov
Date: 2010-10-11 14:49:12 -0400 (Mon, 11 Oct 2010)
New Revision: 25735
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java
Log:
https://jira.jboss.org/browse/JBIDE-7147
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-11
18:46:03 UTC (rev 25734)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java 2010-10-11
18:49:12 UTC (rev 25735)
@@ -254,11 +254,14 @@
return true;
}
+ private int markers;
+
private void validateFile(IFile file) {
if(!shouldFileBeValidated(file)) {
return;
}
removeAllMessagesFromResource(file);
+ markers = 0;
displaySubtask(JSFValidationMessages.VALIDATING_EL_FILE, new
String[]{file.getProject().getName(), file.getName()});
ELContext context = PageContextFactory.createPageContext(file);
if(context!=null) {
@@ -266,12 +269,15 @@
for (int i = 0; i < references.length; i++) {
if(!references[i].getSyntaxErrors().isEmpty()) {
for (SyntaxError error: references[i].getSyntaxErrors()) {
+ markers++;
addError(JSFValidationMessages.EL_SYNTAX_ERROR,
JSFSeverityPreferences.EL_SYNTAX_ERROR, new String[]{"" + error.getProblem()},
references[i].getLineNumber(), 1, references[i].getStartPosition() + error.getPosition(),
context.getResource());
// IMarker marker = addError(JSFValidationMessages.EL_SYNTAX_ERROR,
JSFSeverityPreferences.EL_SYNTAX_ERROR, new String[]{"" + error.getProblem()},
1, references[i].getStartPosition() + error.getPosition(), context.getResource());
// references[i].addMarker(marker);
}
}
- validateEL(references[i]);
+ if(markers<MAX_NUMBER_OF_MARKERS_PER_RESOURCE) {
+ validateEL(references[i]);
+ }
}
}
}
@@ -376,6 +382,7 @@
length = propertyName.length();
}
// addError(JSFValidationMessages.UNPAIRED_GETTER_OR_SETTER,
JSFSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName,
existedMethodName, missingMethodName}, length, startPosition, file);
+ markers++;
IMarker marker = addError(JSFValidationMessages.UNPAIRED_GETTER_OR_SETTER,
JSFSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName,
existedMethodName, missingMethodName}, elReference.getLineNumber(), length, startPosition,
file);
elReference.addMarker(marker);
}
@@ -408,6 +415,7 @@
unresolvedTokenIsVariable = true;
}
}
+ markers++;
// Mark invalid EL
if(unresolvedTokenIsVariable) {
// addError(JSFValidationMessages.UNKNOWN_EL_VARIABLE_NAME,
JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, new String[]{varName}, lengthOfVarName,
offsetOfVarName, 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-11
18:46:03 UTC (rev 25734)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java 2010-10-11
18:49:12 UTC (rev 25735)
@@ -40,6 +40,8 @@
*/
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$
@@ -262,10 +264,10 @@
}
int severity = getSeverity(markerType);
-// int existingMarkers = resource.findMarkers(VALIDATION_MARKER, true,
IResource.DEPTH_ZERO).length;
-// if(existingMarkers>1) {
-// return null;
-// }
+ int existingMarkers = resource.findMarkers(VALIDATION_MARKER, true,
IResource.DEPTH_ZERO).length;
+ if(existingMarkers>MAX_NUMBER_OF_MARKERS_PER_RESOURCE) {
+ return null;
+ }
IMarker item = resource.createMarker(VALIDATION_MARKER); // add a validation marker