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

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Jul 6 11:26:33 EDT 2012


Author: vrubezhny
Date: 2012-07-06 11:26:33 -0400 (Fri, 06 Jul 2012)
New Revision: 42441

Modified:
   trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java
Log:
JBIDE-10611
As-you-type CDI validation 

CDI-like validators are re-enabled.

Modified: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java	2012-07-06 13:32:45 UTC (rev 42440)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java	2012-07-06 15:26:33 UTC (rev 42441)
@@ -31,6 +31,7 @@
 import org.eclipse.jface.text.ITextViewer;
 import org.eclipse.jface.text.ITypedRegion;
 import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.TypedRegion;
 import org.eclipse.jface.text.reconciler.DirtyRegion;
 import org.eclipse.jface.text.source.Annotation;
 import org.eclipse.jface.text.source.IAnnotationModel;
@@ -77,6 +78,7 @@
 	private boolean fInRewriteSession = false;
 	private IDocumentRewriteSessionListener fDocumentRewriteSessionListener = new DocumentRewriteSessionListener();
 	private Set<ITypedRegion> fPartitionsToProcess = new HashSet<ITypedRegion>();
+	private boolean fDoJavaElementProcessing = false;
 	private int fStartPartitionsToProcess = -1;
 	private int fEndPartitionsToProcess = -1;
 
@@ -235,6 +237,7 @@
 			this.problem = problem;
 		}
 		
+		@SuppressWarnings("rawtypes")
 		public Map getAttributes() {
 			return problem.getAttributes();
 		}
@@ -380,6 +383,7 @@
 			return MARKER_TYPE;
 		}
 		
+		@SuppressWarnings("rawtypes")
 		public Map getAttributes(){
 			return vMessage.getAttributes();
 		}
@@ -477,6 +481,7 @@
 		fPartitionsToProcess.clear();
 		fStartPartitionsToProcess = -1;
 		fEndPartitionsToProcess = -1;
+		fDoJavaElementProcessing = false;
 	}
 
 	protected void process(DirtyRegion dirtyRegion) {
@@ -528,8 +533,12 @@
 			fReporter.clearAnnotations(start, end);
 		}
 		for (ITypedRegion partition : partitions) {
-			if (partition != null && !fIsCanceled && IJavaPartitions.JAVA_STRING.equals(partition.getType()) && !fPartitionsToProcess.contains(partition)) {
-				fPartitionsToProcess.add(partition);
+			if (partition != null && !fIsCanceled) {
+				if (IJavaPartitions.JAVA_STRING.equals(partition.getType()) && !fPartitionsToProcess.contains(partition)) {
+					fPartitionsToProcess.add(partition);
+				}
+				
+				fDoJavaElementProcessing |= isJavaElementPartition(partition);
 			}
 		}
 	}
@@ -543,7 +552,17 @@
 			fReporter.clearAnnotations(fStartPartitionsToProcess, fEndPartitionsToProcess);
 		}
 		for (ITypedRegion partition : fPartitionsToProcess) {
-			fValidatorManager.validate(partition, fHelper, fReporter);
+			fValidatorManager.validateString(partition, fHelper, fReporter);
 		}
+		
+		if (fDoJavaElementProcessing) {
+			ITypedRegion partition = new TypedRegion(fStartPartitionsToProcess, fEndPartitionsToProcess - fStartPartitionsToProcess, IJavaPartitions.JAVA_PARTITIONING);
+			fValidatorManager.validateJavaElement(partition, fHelper, fReporter);			
+		}
 	}
+	
+	private boolean isJavaElementPartition(ITypedRegion partition) {
+		return true;
+	}
+	
 }
\ No newline at end of file



More information about the jbosstools-commits mailing list