Author: akazakov
Date: 2010-10-05 14:34:13 -0400 (Tue, 05 Oct 2010)
New Revision: 25500
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELReference.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/ITextSourceReference.java
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/PageContextFactory.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidatorContext.java
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/validation/IValidationErrorManager.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractSeamDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.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/SeamProjectPropertyValidator.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/ELValidatorWrapper.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamCoreValidatorWrapper.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java
Log:
https://jira.jboss.org/browse/JBIDE-7264 Increase EL validation performance for big
projects.
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/ITextSourceReference.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/ITextSourceReference.java 2010-10-05
18:30:44 UTC (rev 25499)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/ITextSourceReference.java 2010-10-05
18:34:13 UTC (rev 25500)
@@ -19,10 +19,10 @@
/**
* @return start position of element in text
*/
- public int getStartPosition();
+ int getStartPosition();
/**
* @return number of characters of element in text
*/
- public int getLength();
+ int getLength();
}
\ No newline at end of file
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELReference.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELReference.java 2010-10-05
18:30:44 UTC (rev 25499)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELReference.java 2010-10-05
18:34:13 UTC (rev 25500)
@@ -41,6 +41,7 @@
private IFile resource;
private IPath path;
private int length;
+ private int lineNumber;
private int startPosition;
private ELExpression[] el;
private Set<IMarker> markers;
@@ -49,6 +50,20 @@
private List<SyntaxError> syntaxErrors;
private String source;
+ /**
+ * @return
+ */
+ public int getLineNumber() {
+ return lineNumber;
+ }
+
+ /**
+ * @param lineNumber the lineNumber to set
+ */
+ public void setLineNumber(int lineNumber) {
+ this.lineNumber = lineNumber;
+ }
+
/* (non-Javadoc)
* @see org.jboss.tools.seam.core.ISeamTextSourceReference#getLength()
*/
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-05
18:30:44 UTC (rev 25499)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java 2010-10-05
18:34:13 UTC (rev 25500)
@@ -151,8 +151,13 @@
}
}
if(revalidateUnresolvedELs) {
+ int i=0;
for (ELReference el : elsToValidate) {
+ // Don't re-validate more than 1000 ELs.
if(!filesToValidate.contains(el.getResource())) {
+ if(i++>1000) {
+ break;
+ }
validateEL(el);
}
}
@@ -261,7 +266,7 @@
for (int i = 0; i < references.length; i++) {
if(!references[i].getSyntaxErrors().isEmpty()) {
for (SyntaxError error: references[i].getSyntaxErrors()) {
- addError(JSFValidationMessages.EL_SYNTAX_ERROR,
JSFSeverityPreferences.EL_SYNTAX_ERROR, new String[]{"" + error.getProblem()},
1, references[i].getStartPosition() + error.getPosition(), context.getResource());
+ 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);
}
@@ -371,7 +376,7 @@
length = propertyName.length();
}
// addError(JSFValidationMessages.UNPAIRED_GETTER_OR_SETTER,
JSFSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName,
existedMethodName, missingMethodName}, length, startPosition, file);
- IMarker marker = addError(JSFValidationMessages.UNPAIRED_GETTER_OR_SETTER,
JSFSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName,
existedMethodName, missingMethodName}, length, startPosition, file);
+ 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);
}
}
@@ -407,11 +412,11 @@
// Mark invalid EL
if(unresolvedTokenIsVariable) {
// addError(JSFValidationMessages.UNKNOWN_EL_VARIABLE_NAME,
JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, new String[]{varName}, lengthOfVarName,
offsetOfVarName, file);
- IMarker marker = addError(JSFValidationMessages.UNKNOWN_EL_VARIABLE_NAME,
JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, new String[]{varName}, lengthOfVarName,
offsetOfVarName, file);
+ IMarker marker = addError(JSFValidationMessages.UNKNOWN_EL_VARIABLE_NAME,
JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, new String[]{varName},
elReference.getLineNumber(), lengthOfVarName, offsetOfVarName, file);
elReference.addMarker(marker);
} else {
// addError(JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, new String[]{varName},
lengthOfVarName, offsetOfVarName, file);
- IMarker marker = addError(JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, new String[]{varName},
lengthOfVarName, offsetOfVarName, file);
+ IMarker marker = addError(JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, new String[]{varName},
elReference.getLineNumber(), lengthOfVarName, offsetOfVarName, file);
elReference.addMarker(marker);
}
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2010-10-05
18:30:44 UTC (rev 25499)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2010-10-05
18:34:13 UTC (rev 25500)
@@ -41,6 +41,7 @@
import org.eclipse.jdt.ui.text.IJavaPartitions;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.rules.IToken;
@@ -303,6 +304,11 @@
List<ELInstance> is = model.getInstances();
ELReference elReference = new KbELReference();
+ try {
+ elReference.setLineNumber(document.getLineOfOffset(startEl));
+ } catch (BadLocationException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
elReference.setResource(file);
elReference.setEl(is);
elReference.setLength(value.length());
@@ -418,7 +424,7 @@
// The subsequently called functions may use the file and document
// already stored in context for their needs
- fillContextForChildNodes(document, context, parents);
+ fillContextForChildNodes(model.getStructuredDocument(), document, context,
parents);
}
} catch (CoreException e) {
WebKbPlugin.getDefault().logError(e);
@@ -478,18 +484,18 @@
}
}
- private void fillContextForChildNodes(IDOMNode parent, ELContext context,
List<String> parents) {
+ private void fillContextForChildNodes(IDocument document, IDOMNode parent, ELContext
context, List<String> parents) {
NodeList children = parent.getChildNodes();
for(int i = 0; children != null && i < children.getLength(); i++) {
Node child = children.item(i);
if (child instanceof IDOMNode) {
- fillContextForNode((IDOMNode)child, context, parents);
- fillContextForChildNodes((IDOMNode)child, context, parents);
+ fillContextForNode(document, (IDOMNode)child, context, parents);
+ fillContextForChildNodes(document, (IDOMNode)child, context, parents);
}
}
}
- private void fillContextForNode(IDOMNode node, ELContext context, List<String>
parents) {
+ private void fillContextForNode(IDocument document, IDOMNode node, ELContext context,
List<String> parents) {
if (!(context instanceof FaceletPageContextImpl) && !(node instanceof
IDOMElement)) {
// There is no any useful info for JSP in text nodes
return;
@@ -497,7 +503,7 @@
if (context instanceof XmlContextImpl) {
XmlContextImpl xmlContext = (XmlContextImpl)context;
- fillElReferencesForNode(node, xmlContext);
+ fillElReferencesForNode(document, node, xmlContext);
if (node instanceof IDOMElement) {
fillXMLNamespacesForNode((IDOMElement)node, xmlContext);
}
@@ -541,7 +547,7 @@
}
}
- private void fillElReferencesForNode(IDOMNode node, XmlContextImpl context) {
+ private void fillElReferencesForNode(IDocument document, IDOMNode node, XmlContextImpl
context) {
if(Node.ELEMENT_NODE == node.getNodeType() || Node.TEXT_NODE == node.getNodeType()) {
IStructuredDocumentRegion regionNode = node.getFirstStructuredDocumentRegion();
if (regionNode == null)
@@ -567,6 +573,11 @@
elReference.setEl(is);
elReference.setLength(text.length());
elReference.setStartPosition(offset);
+ try {
+ elReference.setLineNumber(document.getLineOfOffset(offset) + 1);
+ } catch (BadLocationException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
elReference.setSyntaxErrors(model.getSyntaxErrors());
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidatorContext.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidatorContext.java 2010-10-05
18:30:44 UTC (rev 25499)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidatorContext.java 2010-10-05
18:34:13 UTC (rev 25500)
@@ -44,15 +44,17 @@
elsByVariableName.put(variableName, linkedEls);
}
// save linked ELs.
- linkedEls.add(el);
-
- // Save link between EL and variable names.
- Set<String> variableNames = variableNamesByEl.get(el);
- if(variableNames==null) {
- variableNames = new HashSet<String>();
- variableNamesByEl.put(el, variableNames);
+ // don't save links if there are more than 500 ELs for the var name.
+ if(linkedEls.size()<500) {
+ linkedEls.add(el);
+ // Save link between EL and variable names.
+ Set<String> variableNames = variableNamesByEl.get(el);
+ if(variableNames==null) {
+ variableNames = new HashSet<String>();
+ variableNamesByEl.put(el, variableNames);
+ }
+ variableNames.add(variableName);
}
- variableNames.add(variableName);
// Save link between EL and resource.
Set<ELReference> els = elsByResource.get(el.getPath());
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-05
18:30:44 UTC (rev 25499)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java 2010-10-05
18:34:13 UTC (rev 25500)
@@ -123,7 +123,7 @@
public IMarker addError(String message, String preferenceKey,
String[] messageArguments, ITextSourceReference location,
IResource target) {
- return addError(message, preferenceKey, messageArguments, location
+ return addError(message, preferenceKey, messageArguments, 0, location
.getLength(), location.getStartPosition(), target);
}
@@ -145,7 +145,7 @@
*/
public IMarker addError(String message, String preferenceKey,
String[] messageArguments, IResource target) {
- return addError(message, preferenceKey, messageArguments, 0, 0, target);
+ return addError(message, preferenceKey, messageArguments, 0, 0, 0, target);
}
private String getMarkerId() {
@@ -164,7 +164,7 @@
* @see
org.jboss.tools.seam.internal.core.validation.IValidationErrorManager#addError(java.lang.String,
java.lang.String, java.lang.String[], int, int, org.eclipse.core.resources.IResource)
*/
public IMarker addError(String message, String preferenceKey,
- String[] messageArguments, int length, int offset, IResource target) {
+ String[] messageArguments, int lineNumber, int length, int offset, IResource target)
{
String preferenceValue = getPreference(target.getProject(), preferenceKey);
IMarker marker = null;
if (!SeverityPreferences.IGNORE.equals(preferenceValue)) {
@@ -172,11 +172,16 @@
if (SeverityPreferences.WARNING.equals(preferenceValue)) {
severity = IMessage.NORMAL_SEVERITY;
}
- marker = addError(message, severity, messageArguments, length, offset, target,
getDocumentProvider(), getMarkerId(), getMarkerOwner());
+ marker = addError(message, severity, messageArguments, lineNumber, length, offset,
target, getDocumentProvider(), getMarkerId(), getMarkerOwner());
}
return marker;
}
+ public IMarker addError(String message, String preferenceKey,
+ String[] messageArguments, int length, int offset, IResource target) {
+ return addError(message, preferenceKey, messageArguments, 0, length, offset, target);
+ }
+
protected TextFileDocumentProvider getDocumentProvider() {
if(documentProvider==null) {
if(coreHelper!=null) {
@@ -200,8 +205,8 @@
* (non-Javadoc)
* @see
org.jboss.tools.seam.internal.core.validation.IValidationErrorManager#addError(java.lang.String,
int, java.lang.String[], int, int, org.eclipse.core.resources.IResource)
*/
- public IMarker addError(String message, int severity, String[] messageArguments, int
length, int offset, IResource target) {
- return addError(message, severity, messageArguments, length, offset, target,
getDocumentProvider(), getMarkerId(), getMarkerOwner());
+ public IMarker addError(String message, int severity, String[] messageArguments, int
lineNumber, int length, int offset, IResource target) {
+ return addError(message, severity, messageArguments, lineNumber, length, offset,
target, getDocumentProvider(), getMarkerId(), getMarkerOwner());
}
/**
@@ -217,22 +222,25 @@
* @param markerOwner
* @return
*/
- public static IMarker addError(String message, int severity, Object[] messageArguments,
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) {
IMarker marker = null;
- int lineNumber = 1;
try {
- if (documentProvider != null) {
- documentProvider.connect(target);
- IDocument doc = documentProvider.getDocument(target);
- if(doc != null){
- lineNumber = doc.getLineOfOffset(offset) + 1;
+ if(lineNumber<1) {
+ if (documentProvider != null) {
+ documentProvider.connect(target);
+ IDocument doc = documentProvider.getDocument(target);
+ if(doc != null){
+ try {
+ lineNumber = doc.getLineOfOffset(offset) + 1;
+ } catch (BadLocationException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ }
}
}
- marker = addTask(markerOwner.getName().intern(), target, lineNumber,
MessageFormat.format(message, messageArguments),
+ marker = addTask(markerOwner.getName().intern(), target, lineNumber,
+ MessageFormat.format(message, messageArguments),
severity, null, markerId, offset, length);
- } catch (BadLocationException e) {
- WebKbPlugin.getDefault().logError(
- NLS.bind(KbMessages.EXCEPTION_DURING_CREATING_MARKER, target.getFullPath()), e);
} catch (CoreException e) {
WebKbPlugin.getDefault().logError(
NLS.bind(KbMessages.EXCEPTION_DURING_CREATING_MARKER, target.getFullPath()), e);
@@ -254,6 +262,11 @@
}
int severity = getSeverity(markerType);
+ int existingMarkers = resource.findMarkers(VALIDATION_MARKER, true,
IResource.DEPTH_ZERO).length;
+ if(existingMarkers>1) {
+ return null;
+ }
+
IMarker item = resource.createMarker(VALIDATION_MARKER); // add a validation marker
boolean offsetSet = ((offset != IMessage.OFFSET_UNSET) && (length !=
IMessage.OFFSET_UNSET));
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationErrorManager.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationErrorManager.java 2010-10-05
18:30:44 UTC (rev 25499)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationErrorManager.java 2010-10-05
18:34:13 UTC (rev 25500)
@@ -77,6 +77,18 @@
* @param target
*/
IMarker addError(String message, String preferenceKey,
+ String[] messageArguments, int lineNumber, int length, int offset, IResource target);
+
+ /**
+ * Adds a marker to the resource
+ * @param message
+ * @param preferenceKey
+ * @param messageArguments
+ * @param length
+ * @param offset
+ * @param target
+ */
+ IMarker addError(String message, String preferenceKey,
String[] messageArguments, int length, int offset, IResource target);
/**
@@ -88,7 +100,7 @@
* @param offset
* @param target
*/
- IMarker addError(String message, int severity, String[] messageArguments, int length,
int offset, IResource target);
+ IMarker addError(String message, int severity, String[] messageArguments, int
lineNumber, int length, int offset, IResource target);
/**
* Displays a subtask in the progress view.
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractSeamDeclaration.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractSeamDeclaration.java 2010-10-05
18:30:44 UTC (rev 25499)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractSeamDeclaration.java 2010-10-05
18:34:13 UTC (rev 25500)
@@ -37,7 +37,7 @@
protected String name;
protected Map<String,IValueInfo> attributes = new HashMap<String,
IValueInfo>();
-
+
public AbstractSeamDeclaration() {}
public String getName() {
@@ -47,7 +47,7 @@
public void setName(String name) {
this.name = name;
}
-
+
public void open() {}
public int getLength() {
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2010-10-05
18:30:44 UTC (rev 25499)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2010-10-05
18:34:13 UTC (rev 25500)
@@ -142,6 +142,7 @@
ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, false);
if(seamProject!=null) {
rootContext = seamProject.getValidationContext();
+ war = project;
}
}
@@ -152,7 +153,7 @@
projects.add(array[i]);
}
}
- return new ValidatingProjectSet(project, projects, rootContext);
+ return new ValidatingProjectSet(war, projects, rootContext);
}
/*
@@ -1045,7 +1046,9 @@
IResource target, int messageId) {
IMarker marker = addError(message, preferenceKey, messageArguments, location, target);
try{
- marker.setAttribute(MESSAGE_ID_ATTRIBUTE_NAME, new Integer(messageId));
+ if(marker!=null) {
+ marker.setAttribute(MESSAGE_ID_ATTRIBUTE_NAME, new Integer(messageId));
+ }
}catch(CoreException ex){
SeamCorePlugin.getDefault().logError(ex);
}
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-05
18:30:44 UTC (rev 25499)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java 2010-10-05
18:34:13 UTC (rev 25500)
@@ -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}, 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());
break;
}
if(jarName.startsWith(JARS[jarIndex])) {
- ValidationErrorManager.addError(SeamValidationMessages.INVALID_JAR_MODULE_IN_APPLICATION_XML,
IMessage.NORMAL_SEVERITY, new String[]{jarName}, 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());
break;
}
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java 2010-10-05
18:30:44 UTC (rev 25499)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java 2010-10-05
18:34:13 UTC (rev 25500)
@@ -334,13 +334,15 @@
public void validate(IValidationContext helper, IReporter reporter) throws
ValidationException {
validateInJob(helper, reporter);
}
-
+
public IMarker addError(String message, String preferenceKey,
String[] messageArguments, IResource target, int messageId) {
IMarker marker = errorManager.addError(message, preferenceKey, messageArguments,
target);
- try{
- marker.setAttribute(MESSAGE_ID_ATTRIBUTE_NAME, new Integer(messageId));
- }catch(CoreException ex){
+ try {
+ if(marker!=null) {
+ marker.setAttribute(MESSAGE_ID_ATTRIBUTE_NAME, new Integer(messageId));
+ }
+ } catch(CoreException ex) {
SeamCorePlugin.getDefault().logError(ex);
}
return marker;
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/ELValidatorWrapper.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/ELValidatorWrapper.java 2010-10-05
18:30:44 UTC (rev 25499)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/ELValidatorWrapper.java 2010-10-05
18:34:13 UTC (rev 25500)
@@ -20,10 +20,10 @@
}
@Override
public IMarker addError(String message, int severity,
- String[] messageArguments, int length, int offset,
+ String[] messageArguments, int lineNumber, int length, int offset,
IResource target) {
- IMarker marker= super.addError(message, severity, messageArguments, length, offset,
+ IMarker marker= super.addError(message, severity, messageArguments, lineNumber,
length, offset,
target);
validatorSupport.add(marker);
return marker;
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamCoreValidatorWrapper.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamCoreValidatorWrapper.java 2010-10-05
18:30:44 UTC (rev 25499)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamCoreValidatorWrapper.java 2010-10-05
18:34:13 UTC (rev 25500)
@@ -1,7 +1,5 @@
package org.jboss.tools.seam.core.test.validation;
-import java.text.MessageFormat;
-import java.util.HashSet;
import java.util.List;
import org.eclipse.core.resources.IFile;
@@ -10,10 +8,6 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.wst.validation.internal.core.ValidationException;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-import org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper;
-import org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager;
import org.jboss.tools.seam.internal.core.validation.SeamCoreValidator;
public class SeamCoreValidatorWrapper extends SeamCoreValidator implements
IValidatorSupport{
@@ -25,9 +19,9 @@
}
@Override
public IMarker addError(String message, int severity,
- String[] messageArguments, int length, int offset,
+ String[] messageArguments, int lineNumber, int length, int offset,
IResource target) {
- IMarker marker = super.addError(message, severity, messageArguments, length, offset,
+ IMarker marker = super.addError(message, severity, messageArguments, lineNumber,
length, offset,
target);
validatorSupport.add(marker);
return marker;
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java 2010-10-05
18:30:44 UTC (rev 25499)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java 2010-10-05
18:34:13 UTC (rev 25500)
@@ -12,7 +12,6 @@
import org.eclipse.wst.validation.internal.core.ValidationException;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
import org.jboss.tools.common.text.ITextSourceReference;
import org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper;
import org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager;
@@ -163,8 +162,8 @@
}
public IMarker addError(String message, int severity,
- String[] messageArguments, int length, int offset, IResource target) {
- IMarker marker = errorManager.addError(message, severity, messageArguments, length,
offset, target);
+ String[] messageArguments, int lineNumber, int length, int offset, IResource target)
{
+ IMarker marker = errorManager.addError(message, severity, messageArguments, lineNumber,
length, offset, target);
support.add(marker);
return marker;
}
@@ -184,4 +183,12 @@
public void removeAllMessagesFromResource(IResource resource) {
errorManager.removeAllMessagesFromResource(resource);
}
-}
+
+ public IMarker addError(String message, String preferenceKey,
+ String[] messageArguments, int lineNumber, int length, int offset,
+ IResource target) {
+ IMarker marker = errorManager.addError(message, preferenceKey, messageArguments,
lineNumber, length, offset, target);
+ support.add(marker);
+ return marker;
+ }
+}
\ No newline at end of file