Author: akazakov
Date: 2007-10-05 09:55:33 -0400 (Fri, 05 Oct 2007)
New Revision: 4026
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/SeamELValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1026 Added messages into Progress Monitor about
current work of validator
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 2007-10-05
11:57:10 UTC (rev 4025)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2007-10-05
13:55:33 UTC (rev 4026)
@@ -28,6 +28,7 @@
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
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.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.core.BijectedAttributeType;
@@ -80,6 +81,12 @@
protected static final String UNKNOWN_COMPONENT_CLASS_NAME_MESSAGE_ID =
"UNKNOWN_COMPONENT_CLASS_NAME"; //$NON-NLS-1$
protected static final String UNKNOWN_COMPONENT_PROPERTY_MESSAGE_ID =
"UNKNOWN_COMPONENT_PROPERTY"; //$NON-NLS-1$
+ protected static final String SEARCHING_RESOURCES_MESSAGE_ID =
"SEARCHING_RESOURCES";
+ protected static final String VALIDATING_COMPONENT_MESSAGE_ID =
"VALIDATING_COMPONENT";
+ protected static final String VALIDATING_FACTORY_MESSAGE_ID =
"VALIDATING_FACTORY";
+ protected static final String VALIDATING_RESOURCE_MESSAGE_ID =
"VALIDATING_RESOURCE";
+ protected static final String VALIDATING_CLASS_MESSAGE_ID =
"VALIDATING_CLASS";
+
public SeamCoreValidator(SeamValidatorManager validatorManager,
SeamValidationHelper coreHelper, IReporter reporter,
SeamValidationContext validationContext, ISeamProject project) {
@@ -98,6 +105,8 @@
* @see
org.jboss.tools.seam.internal.core.validation.ISeamValidator#validate(java.util.Set)
*/
public IStatus validate(Set<IFile> changedFiles) throws ValidationException {
+ displaySubtask(SEARCHING_RESOURCES_MESSAGE_ID);
+
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
Set<ISeamComponent> checkedComponents = new HashSet<ISeamComponent>();
Set<String> markedDuplicateFactoryNames = new HashSet<String>();
@@ -157,6 +166,7 @@
Set<IPath> unnamedResources = validationContext.getUnnamedCoreResources();
newResources.addAll(unnamedResources);
for (IPath path : newResources) {
+ displaySubtask(VALIDATING_RESOURCE_MESSAGE_ID, new String[]{projectName,
path.toString()});
Set<SeamJavaComponentDeclaration> declarations =
((SeamProject)project).findJavaDeclarations(path);
for (SeamJavaComponentDeclaration d : declarations) {
validateMethodsOfUnknownComponent(d);
@@ -193,6 +203,7 @@
if(reporter.isCancelled()) {
return OK_STATUS;
}
+ displaySubtask(VALIDATING_CLASS_MESSAGE_ID, new String[]{projectName,
d.getClassName()});
validateMethodsOfUnknownComponent(d);
}
@@ -210,6 +221,10 @@
if(coreHelper.isJar(factory.getSourcePath())) {
return;
}
+ String factoryName = factory.getName();
+ if(factoryName!=null) {
+ displaySubtask(VALIDATING_FACTORY_MESSAGE_ID, new String[]{projectName,
factoryName});
+ }
if(factory instanceof ISeamAnnotatedFactory) {
validateAnnotatedFactory((ISeamAnnotatedFactory)factory,
markedDuplicateFactoryNames);
} else {
@@ -330,6 +345,10 @@
private void validateComponent(ISeamComponent component) {
ISeamJavaComponentDeclaration firstJavaDeclaration = component.getJavaDeclaration();
if(firstJavaDeclaration!=null) {
+ String componentName = component.getName();
+ if(componentName!=null) {
+ displaySubtask(VALIDATING_COMPONENT_MESSAGE_ID, new String[]{projectName,
componentName});
+ }
HashMap<Integer, ISeamJavaComponentDeclaration> usedPrecedences = new
HashMap<Integer, ISeamJavaComponentDeclaration>();
Set<ISeamJavaComponentDeclaration> markedDeclarations = new
HashSet<ISeamJavaComponentDeclaration>();
int firstJavaDeclarationPrecedence = firstJavaDeclaration.getPrecedence();
@@ -341,7 +360,7 @@
boolean sourceJavaDeclaration = !((IType)jd.getSourceMember()).isBinary();
if(sourceJavaDeclaration) {
// Save link between component name and java source file.
- validationContext.addLinkedCoreResource(component.getName(),
declaration.getSourcePath());
+ validationContext.addLinkedCoreResource(componentName,
declaration.getSourcePath());
}
if(declaration!=firstJavaDeclaration) {
// Validate @Name
@@ -360,7 +379,7 @@
IResource checkedDeclarationResource = checkedDeclaration.getResource();
ISeamTextSourceReference location =
((SeamComponentDeclaration)checkedDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_NAME);
if(location!=null) {
- addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID,
SeamPreferences.NONUNIQUE_COMPONENT_NAME, new String[]{component.getName()}, location,
checkedDeclarationResource);
+ addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID,
SeamPreferences.NONUNIQUE_COMPONENT_NAME, new String[]{componentName}, location,
checkedDeclarationResource);
}
markedDeclarations.add(checkedDeclaration);
}
@@ -368,7 +387,7 @@
markedDeclarations.add(javaDeclaration);
ISeamTextSourceReference location =
((SeamComponentDeclaration)javaDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_NAME);
if(location!=null) {
- addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID,
SeamPreferences.NONUNIQUE_COMPONENT_NAME, new String[]{component.getName()}, location,
javaDeclarationResource);
+ addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID,
SeamPreferences.NONUNIQUE_COMPONENT_NAME, new String[]{componentName}, location,
javaDeclarationResource);
}
}
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2007-10-05
11:57:10 UTC (rev 4025)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2007-10-05
13:55:33 UTC (rev 4026)
@@ -59,6 +59,8 @@
protected static final String INVALID_EXPRESSION_MESSAGE_ID =
"INVALID_EXPRESSION"; //$NON-NLS-1$
protected static final String UNPAIRED_GETTER_OR_SETTER_MESSAGE_ID =
"UNPAIRED_GETTER_OR_SETTER"; //$NON-NLS-1$
+ protected static final String VALIDATING_EL_FILE_MESSAGE_ID =
"VALIDATING_EL_FILE";
+
private SeamELCompletionEngine engine= new SeamELCompletionEngine();
private IJavaProject javaProject;
@@ -114,6 +116,7 @@
}
private void validateFile(IFile file) {
+ displaySubtask(VALIDATING_EL_FILE_MESSAGE_ID, new String[]{projectName,
file.getName()});
String ext = file.getFileExtension();
String content = null;
try {
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2007-10-05
11:57:10 UTC (rev 4025)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2007-10-05
13:55:33 UTC (rev 4026)
@@ -35,6 +35,7 @@
protected IReporter reporter;
protected SeamValidationContext validationContext;
protected ISeamProject project;
+ protected String projectName;
public SeamValidator(SeamValidatorManager validatorManager, SeamValidationHelper
coreHelper, IReporter reporter, SeamValidationContext validationContext, ISeamProject
project) {
this.validationManager = validatorManager;
@@ -42,6 +43,7 @@
this.project = project;
this.reporter = reporter;
this.validationContext = validationContext;
+ this.projectName = project.getProject().getName();
}
protected String getBaseName() {
@@ -74,6 +76,15 @@
}
}
+ protected void displaySubtask(String messageId) {
+ displaySubtask(messageId, null);
+ }
+
+ protected void displaySubtask(String messageId, String[] messageArguments) {
+ IMessage message = new Message(getBaseName(), IMessage.NORMAL_SEVERITY, messageId,
messageArguments);
+ reporter.displaySubtask(validationManager, message);
+ }
+
protected void removeMessagesFromResources(Set<IResource> resources, String
messageGroup) {
for (IResource r : resources) {
reporter.removeMessageSubset(validationManager, r, messageGroup);