Author: akazakov
Date: 2007-07-10 13:41:53 -0400 (Tue, 10 Jul 2007)
New Revision: 2377
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.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/EXIN-327 Saving problem markers between eclipse
sessions.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-07-10 17:22:42 UTC (rev
2376)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-07-10 17:41:53 UTC (rev
2377)
@@ -38,6 +38,15 @@
</persistent>
</extension>
<extension
+ id="seamProblem"
+ name="Seam Problem"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.wst.validation.problemmarker"/>
+ <persistent
+ value="true">
+ </persistent>
+ </extension>
+ <extension
point="org.eclipse.wst.common.project.facet.core.facets">
<project-facet
id="jst.seam">
@@ -127,7 +136,7 @@
objectClass="org.eclipse.core.resources.IFile"
nameFilter="*.java"/>
<markerId
- markerIdValue="SeamAnnatationValidatorMarker">
+ markerIdValue="seamProblem">
</markerId>
<helper
class="org.jboss.tools.seam.internal.core.validation.SeamJavaHelper">
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java 2007-07-10
17:22:42 UTC (rev 2376)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java 2007-07-10
17:41:53 UTC (rev 2377)
@@ -21,6 +21,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.wst.validation.internal.core.ValidationException;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -68,12 +69,12 @@
continue;
}
if (currentFile != null && currentFile.exists()) {
- String oldComponentNameOfChangedFile =
validationContext.getNonuniqueNameOfComponent(currentFile.getLocation());
+ String oldComponentNameOfChangedFile =
validationContext.getNonuniqueNameOfComponent(currentFile.getFullPath());
if(oldComponentNameOfChangedFile!=null) {
Set<IPath> resources = new HashSet<IPath>(); // Resources which we have
to validate.
// Check if component name was changed in java file
- String newComponentNameOfChangedFile =
getComponentNameByResource(currentFile.getLocation(), project);
+ String newComponentNameOfChangedFile =
getComponentNameByResource(currentFile.getFullPath(), project);
if(newComponentNameOfChangedFile!=null &&
!oldComponentNameOfChangedFile.equals(newComponentNameOfChangedFile)) {
// Name was changed.
// Collect resources with new component name.
@@ -81,6 +82,9 @@
if(linkedResources!=null) {
resources.addAll(linkedResources);
}
+ // Check if changed file is not component anymore.
+ } else if(newComponentNameOfChangedFile == null) {
+ resources.add(currentFile.getFullPath());
}
// Collect resources with old component name.
@@ -102,7 +106,7 @@
}
} else {
// Validate new (unmarked) Java file.
- validateUniqueComponentName(project, currentFile.getLocation(), checkedComponents,
helper, reporter);
+ validateUniqueComponentName(project, currentFile.getFullPath(), checkedComponents,
helper, reporter);
}
// TODO
}
@@ -134,9 +138,12 @@
}
public void cleanup(IReporter reporter) {
+ super.cleanup(reporter);
}
private IStatus validateAll(ISeamProject project, IValidationContext helper, IReporter
reporter) {
+ reporter.removeAllMessages(this);
+ validationContext.clear();
Set<ISeamComponent> components = project.getComponents();
for (ISeamComponent component : components) {
validateUniqueComponentName(project, component, helper, reporter);
@@ -173,11 +180,11 @@
ISeamTextSourceReference location =
((SeamComponentDeclaration)checkedDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_NAME);
addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, location,
checkedDeclarationResource, NONUNIQUE_NAME_MESSAGE_GROUP);
markedDeclarations.add(checkedDeclaration);
- validationContext.addLinkedResource(checkedDeclaration.getName(),
checkedDeclarationResource.getLocation());
+ validationContext.addLinkedResource(checkedDeclaration.getName(),
checkedDeclarationResource.getFullPath());
}
// Mark next wrong declaration with that name
markedDeclarations.add(javaDeclaration);
- validationContext.addLinkedResource(javaDeclaration.getName(),
javaDeclaration.getResource().getLocation());
+ validationContext.addLinkedResource(javaDeclaration.getName(),
javaDeclarationResource.getFullPath());
ISeamTextSourceReference location =
((SeamComponentDeclaration)javaDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_NAME);
addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, location, javaDeclarationResource,
NONUNIQUE_NAME_MESSAGE_GROUP);
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2007-07-10
17:22:42 UTC (rev 2376)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2007-07-10
17:41:53 UTC (rev 2377)
@@ -53,4 +53,9 @@
public String getNonuniqueNameOfComponent(IPath sourcePath) {
return nonuniqueNames.get(sourcePath);
}
+
+ public void clear() {
+ markedNonuniqueNamedResources.clear();
+ nonuniqueNames.clear();
+ }
}
\ No newline at end of file
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-07-10
17:22:42 UTC (rev 2376)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2007-07-10
17:41:53 UTC (rev 2377)
@@ -12,6 +12,7 @@
import java.util.Set;
+import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.wst.validation.internal.core.Message;
@@ -57,6 +58,9 @@
IMessage message = new Message(getBaseName(), IMessage.HIGH_SEVERITY, messageId,
messageArguments, target, messageGroup);
message.setLength(location.getLength());
message.setOffset(location.getStartPosition());
+ message.setSeverity(IMessage.HIGH_SEVERITY);
+// message.setAttribute(IMarker.TRANSIENT, Boolean.TRUE);
+// message.setMarkerId("org.jboss.tools.seam.core.seamProblem");
reporter.addMessage(this, message);
}