[jbosstools-commits] JBoss Tools SVN: r42490 - trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Jul 10 15:08:28 EDT 2012


Author: akazakov
Date: 2012-07-10 15:08:27 -0400 (Tue, 10 Jul 2012)
New Revision: 42490

Modified:
   trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/TempMarkerManager.java
   trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java
Log:
https://issues.jboss.org/browse/JBIDE-10611 As-you-type CDI validation

Modified: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/TempMarkerManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/TempMarkerManager.java	2012-07-10 18:14:58 UTC (rev 42489)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/TempMarkerManager.java	2012-07-10 19:08:27 UTC (rev 42490)
@@ -18,6 +18,7 @@
 import java.util.Set;
 
 import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -48,9 +49,20 @@
 abstract public class TempMarkerManager extends ValidationErrorManager {
 
 	protected boolean asYouTypeValidation;
+	protected int messageCounter;
 
 	protected abstract String getMessageBundleName();
 
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.common.validation.ValidationErrorManager#init(org.eclipse.core.resources.IProject, org.jboss.tools.common.validation.ContextValidationHelper, org.jboss.tools.common.validation.IProjectValidationContext, org.eclipse.wst.validation.internal.provisional.core.IValidator, org.eclipse.wst.validation.internal.provisional.core.IReporter, boolean)
+	 */
+	@Override
+	public void init(IProject project, ContextValidationHelper validationHelper, IProjectValidationContext validationContext, IValidator manager, IReporter reporter, boolean asYouTypeValidation) {
+		super.init(project, validationHelper, validationContext, manager, reporter, asYouTypeValidation);
+		messageCounter = 0;
+	}
+
 	/**
 	 * @return the asYouTypeValidation
 	 */
@@ -154,21 +166,23 @@
 	}
 
 	private IMessage addMesssage(IResource target, int lineNumber, int offset, int length, int severity, String preferenceKey, String textMessage, String[] messageArguments) {
-		if(lineNumber<0) {
-			try {
-				lineNumber = document.getLineOfOffset(offset) + 1;
-			} catch (BadLocationException e) {
-				CommonPlugin.getDefault().logError(e);
+		IMessage message = null;
+		if(messageCounter<=getMaxNumberOfMarkersPerFile(target.getProject())) {
+			if(lineNumber<0) {
+				try {
+					lineNumber = document.getLineOfOffset(offset) + 1;
+				} catch (BadLocationException e) {
+					CommonPlugin.getDefault().logError(e);
+				}
 			}
+			message = addMesssage(validationManager, shouldCleanAllAnnotations(), this.reporter, offset, length, target, lineNumber, severity, textMessage, messageArguments, getMessageBundleName());
+			messageCounter++;
+			String preferencePageId = getPreferencePageId();
+			if(preferencePageId != null && preferenceKey != null){
+				message.setAttribute(PREFERENCE_KEY_ATTRIBUTE_NAME, preferenceKey);
+				message.setAttribute(PREFERENCE_PAGE_ID_NAME, preferencePageId);
+			}
 		}
-		IMessage message = addMesssage(validationManager, shouldCleanAllAnnotations(), this.reporter, offset, length, target, lineNumber, severity, textMessage, messageArguments, getMessageBundleName());
-		
-		String preferencePageId = getPreferencePageId();
-		if(preferencePageId != null && preferenceKey != null){
-			message.setAttribute(PREFERENCE_KEY_ATTRIBUTE_NAME, preferenceKey);
-			message.setAttribute(PREFERENCE_PAGE_ID_NAME, preferencePageId);
-		}
-		
 		return message;
 	}
 

Modified: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java	2012-07-10 18:14:58 UTC (rev 42489)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java	2012-07-10 19:08:27 UTC (rev 42490)
@@ -54,8 +54,7 @@
 	public static final String SUPPRESS_WARNINGS_ENABLED_ATTRIBUTE = "sup_warn_ena"; //$NON-NLS-1$
 	public static final String MESSAGE_ID_ATTRIBUTE_NAME = "Message_id"; //$NON-NLS-1$
 
-	protected IStatus OK_STATUS = new Status(IStatus.OK,
-			"org.eclipse.wst.validation", 0, "OK", null); //$NON-NLS-1$ //$NON-NLS-2$
+	protected IStatus OK_STATUS = new Status(IStatus.OK, "org.eclipse.wst.validation", 0, "OK", null); //$NON-NLS-1$ //$NON-NLS-2$
 
 	protected IValidator validationManager;
 	protected ContextValidationHelper coreHelper;
@@ -67,8 +66,6 @@
 	protected IDocument document;
 	protected Set<IFile> dirtyFiles;
 
-	
-
 	/**
 	 * Constructor
 	 */



More information about the jbosstools-commits mailing list