Author: akazakov
Date: 2010-12-02 13:37:50 -0500 (Thu, 02 Dec 2010)
New Revision: 27124
Modified:
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-7674
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-12-02
18:37:16 UTC (rev 27123)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java 2010-12-02
18:37:50 UTC (rev 27124)
@@ -55,12 +55,22 @@
protected IValidationContext validationContext;
protected TextFileDocumentProvider documentProvider;
+ private String messageIdQuickFixAttributeName;
+
/**
* Constructor
*/
public ValidationErrorManager() {
}
+ /**
+ * @param messageIdQuickFixAttributeName the messageIdQuickFixAttributeName to set
+ */
+ public void setMessageIdQuickFixAttributeName(
+ String messageIdQuickFixAttributeName) {
+ this.messageIdQuickFixAttributeName = messageIdQuickFixAttributeName;
+ }
+
public void init(IProject project, ContextValidationHelper validationHelper, IValidator
manager, IReporter reporter) {
setProject(project);
setCoreHelper(validationHelper);
@@ -70,6 +80,11 @@
setMarkerId(org.jboss.tools.jst.web.kb.validation.IValidator.MARKED_RESOURCE_MESSAGE_GROUP);
}
+ public void init(IProject project, ContextValidationHelper validationHelper, IValidator
manager, IReporter reporter, String messageIdQuickFixAttributeName) {
+ init(project, validationHelper, manager, reporter);
+ setMessageIdQuickFixAttributeName(messageIdQuickFixAttributeName);
+ }
+
/**
* @param validationManager the validationManager to set
*/
@@ -243,8 +258,31 @@
}
/**
+ * Create a problem marker and add to the marker an attribute with the message ID for
QuickFix.
*
* @param message
+ * @param preferenceKey
+ * @param location
+ * @param target
+ * @param messageId
+ * @return
+ */
+ public IMarker addError(String message, String preferenceKey,
+ ITextSourceReference location, IResource target, int messageId) {
+ IMarker marker = addError(message, preferenceKey, location, target);
+ try {
+ if(marker!=null) {
+ marker.setAttribute(messageIdQuickFixAttributeName, new Integer(messageId));
+ }
+ } catch(CoreException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ return marker;
+ }
+
+ /**
+ *
+ * @param message
* @param severity
* @param messageArguments
* @param length