Author: vrubezhny
Date: 2012-08-14 11:05:48 -0400 (Tue, 14 Aug 2012)
New Revision: 43026
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
Annotations creation is moved to the end of validation/problem reporting.
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-08-14
14:14:28 UTC (rev 43025)
+++
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java 2012-08-14
15:05:48 UTC (rev 43026)
@@ -233,23 +233,30 @@
@Override
public void addMessage(IValidator origin, IMessage message) {
messages.add(message);
- if (isCancelled()) {
+ }
+
+ public void finishReporting() {
+ if (isCancelled() || messages.isEmpty() || getAnnotationModel() == null ||
fCompilationUnit == null)
return;
- }
- if (message instanceof ValidationMessage && getAnnotationModel() != null) {
+
+ IEditorInput editorInput= fEditor.getEditorInput();
+ if (editorInput == null)
+ return;
+
+ String editorInputName = editorInput.getName();
+ for (IMessage message : messages) {
+ if (!(message instanceof ValidationMessage))
+ continue;
+
ValidationMessage valMessage = (ValidationMessage)message;
- IEditorInput editorInput= fEditor.getEditorInput();
- if (editorInput != null) {
- boolean cleanAllAnnotations =
Boolean.TRUE.equals(message.getAttribute(TempMarkerManager.CLEAN_ALL_ANNOTATIONS_ATTRIBUTE));
- Position position = new Position(valMessage.getOffset(), valMessage.getLength());
- TempJavaProblem problem = new TempJavaProblem(valMessage,
- editorInput.getName());
- if (fCompilationUnit != null) {
- TempJavaProblemAnnotation problemAnnotation = new
TempJavaProblemAnnotation(problem, fCompilationUnit);
- addAnnotation(problemAnnotation, position, cleanAllAnnotations);
- }
- }
+ boolean cleanAllAnnotations =
Boolean.TRUE.equals(message.getAttribute(TempMarkerManager.CLEAN_ALL_ANNOTATIONS_ATTRIBUTE));
+ Position position = new Position(valMessage.getOffset(), valMessage.getLength());
+ TempJavaProblem problem = new TempJavaProblem(valMessage, editorInputName);
+ TempJavaProblemAnnotation problemAnnotation = new TempJavaProblemAnnotation(problem,
fCompilationUnit);
+ addAnnotation(problemAnnotation, position, cleanAllAnnotations);
}
+
+ removeAllMessages();
}
}
@@ -446,7 +453,7 @@
}),
fHelper, fReporter);
}
- fReporter.removeAllMessages();
+ fReporter.finishReporting();
}
private boolean isJavaElementValidationRequired() {
Show replies by date