Author: akazakov
Date: 2008-10-31 14:58:50 -0400 (Fri, 31 Oct 2008)
New Revision: 11460
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
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/SeamEarProjectValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java
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/ValidationErrorManager.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3082
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java 2008-10-31
18:17:36 UTC (rev 11459)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java 2008-10-31
18:58:50 UTC (rev 11460)
@@ -13,6 +13,7 @@
import java.util.HashSet;
import java.util.Set;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
@@ -140,8 +141,8 @@
allOptionNames.addAll(severityOptionNames);
}
- public static IEclipsePreferences getProjectPreferences(ISeamProject project) {
- return new ProjectScope(project.getProject()).getNode(SeamCorePlugin.PLUGIN_ID);
+ public static IEclipsePreferences getProjectPreferences(IProject project) {
+ return new ProjectScope(project).getNode(SeamCorePlugin.PLUGIN_ID);
}
public static IEclipsePreferences getDefaultPreferences() {
@@ -152,7 +153,7 @@
return new InstanceScope().getNode(SeamCorePlugin.PLUGIN_ID);
}
- public static String getProjectPreference(ISeamProject project, String key) {
+ public static String getProjectPreference(IProject project, String key) {
IEclipsePreferences p = getProjectPreferences(project);
if(p == null) return null;
String value = p.get(key, null);
@@ -171,7 +172,7 @@
return p.get(key, null);
}
- public static boolean shouldValidateCore(ISeamProject project) {
+ public static boolean shouldValidateCore(IProject project) {
return !(SeamPreferences.IGNORE.equals(getProjectPreference(project,
NONUNIQUE_COMPONENT_NAME)) &&
SeamPreferences.IGNORE.equals(getProjectPreference(project,
STATEFUL_COMPONENT_DOES_NOT_CONTENT_REMOVE)) &&
SeamPreferences.IGNORE.equals(getProjectPreference(project,
STATEFUL_COMPONENT_DOES_NOT_CONTENT_DESTROY)) &&
@@ -194,14 +195,14 @@
SeamPreferences.IGNORE.equals(getProjectPreference(project, UNKNOWN_VARIABLE_NAME)));
}
- public static boolean shouldValidateEL(ISeamProject project) {
+ public static boolean shouldValidateEL(IProject project) {
return !(SeamPreferences.IGNORE.equals(getProjectPreference(project,
UNKNOWN_EL_VARIABLE_NAME)) &&
SeamPreferences.IGNORE.equals(getProjectPreference(project,
UNKNOWN_EL_VARIABLE_PROPERTY_NAME)) &&
SeamPreferences.IGNORE.equals(getProjectPreference(project, EL_SYNTAX_ERROR))
&&
SeamPreferences.IGNORE.equals(getProjectPreference(project,
UNPAIRED_GETTER_OR_SETTER)));
}
- public static boolean shouldValidateSettings(ISeamProject project) {
+ public static boolean shouldValidateSettings(IProject project) {
return !SeamPreferences.IGNORE.equals(getProjectPreference(project,
INVALID_PROJECT_SETTINGS));
}
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java 2008-10-31
18:17:36 UTC (rev 11459)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java 2008-10-31
18:58:50 UTC (rev 11460)
@@ -34,6 +34,7 @@
defaultPreferences.put(SeamPreferences.UNKNOWN_EL_VARIABLE_NAME,
SeamPreferences.IGNORE);
defaultPreferences.put(SeamPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
SeamPreferences.WARNING);
defaultPreferences.put(SeamPreferences.UNKNOWN_VARIABLE_NAME,
SeamPreferences.WARNING);
+ defaultPreferences.put(SeamPreferences.STATEFUL_COMPONENT_DOES_NOT_CONTENT_DESTROY,
SeamPreferences.WARNING);
defaultPreferences.put(SeamPreferences.UNPAIRED_GETTER_OR_SETTER,
SeamPreferences.IGNORE);
defaultPreferences.put(SeamPreferences.EL_SYNTAX_ERROR, SeamPreferences.WARNING);
defaultPreferences.put(SeamPreferences.CHECK_VARS, SeamPreferences.ENABLE);
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2008-10-31
18:17:36 UTC (rev 11459)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2008-10-31
18:58:50 UTC (rev 11460)
@@ -74,7 +74,7 @@
/**
* Create the array of suggestions.
- * @param project Seam project
+ * @param seamProject Seam project
* @param file File
* @param documentContent
* @param prefix the prefix to search for
@@ -211,7 +211,7 @@
/**
* Returns MemberInfo for last segment of EL. Null if El is not resolved.
- * @param project
+ * @param seamProject
* @param file
* @param operand EL without #{}
* @return MemberInfo for last segment of EL. Null if El is not resolved.
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 2008-10-31
18:17:36 UTC (rev 11459)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2008-10-31
18:58:50 UTC (rev 11460)
@@ -173,7 +173,7 @@
newResources.addAll(unnamedResources);
for (IPath path : newResources) {
displaySubtask(VALIDATING_RESOURCE_MESSAGE_ID, new String[]{projectName,
path.toString()});
- Set<SeamJavaComponentDeclaration> declarations =
((SeamProject)project).findJavaDeclarations(path);
+ Set<SeamJavaComponentDeclaration> declarations =
((SeamProject)seamProject).findJavaDeclarations(path);
for (SeamJavaComponentDeclaration d : declarations) {
validateMethodsOfUnknownComponent(d);
}
@@ -187,14 +187,14 @@
* @see org.jboss.tools.seam.internal.core.validation.ISeamValidator#validateAll()
*/
public IStatus validateAll() throws ValidationException {
- Set<ISeamComponent> components =
Collections.unmodifiableSet(project.getComponents());
+ Set<ISeamComponent> components =
Collections.unmodifiableSet(seamProject.getComponents());
for (ISeamComponent component : components) {
if(reporter.isCancelled()) {
return OK_STATUS;
}
validateComponent(component);
}
- Set<ISeamFactory> factories =
Collections.unmodifiableSet(project.getFactories());
+ Set<ISeamFactory> factories =
Collections.unmodifiableSet(seamProject.getFactories());
Set<String> markedDuplicateFactoryNames = new HashSet<String>();
for (ISeamFactory factory : factories) {
if(reporter.isCancelled()) {
@@ -203,7 +203,7 @@
validateFactory(factory, markedDuplicateFactoryNames);
}
- Map<String,SeamJavaComponentDeclaration> declarations =
((SeamProject)project).getAllJavaComponentDeclarations();
+ Map<String,SeamJavaComponentDeclaration> declarations =
((SeamProject)seamProject).getAllJavaComponentDeclarations();
Collection<SeamJavaComponentDeclaration> values = declarations.values();
for (SeamJavaComponentDeclaration d : values) {
if(reporter.isCancelled()) {
@@ -217,7 +217,7 @@
}
private void validateFactory(IPath sourceFilePath, Set<String>
markedDuplicateFactoryNames) {
- Set<ISeamFactory> factories = project.getFactoriesByPath(sourceFilePath);
+ Set<ISeamFactory> factories = seamProject.getFactoriesByPath(sourceFilePath);
for (ISeamFactory factory : factories) {
validateFactory(factory, markedDuplicateFactoryNames);
}
@@ -274,7 +274,7 @@
private void validateFactoryName(ISeamFactory factory, String factoryName,
Set<String> markedDuplicateFactoryNames, boolean validateUnknownName) {
ScopeType factoryScope = factory.getScope();
- Set<ISeamContextVariable> variables = project.getVariablesByName(factoryName);
+ Set<ISeamContextVariable> variables =
seamProject.getVariablesByName(factoryName);
boolean unknownVariable = true;
boolean firstDuplicateVariableWasMarked = false;
for (ISeamContextVariable variable : variables) {
@@ -316,7 +316,7 @@
}
private void validateComponent(IPath sourceFilePath, Set<ISeamComponent>
checkedComponents, Set<IPath> unnamedResources) {
- Set<ISeamComponent> components = project.getComponentsByPath(sourceFilePath);
+ Set<ISeamComponent> components =
seamProject.getComponentsByPath(sourceFilePath);
if(components.size()==0) {
unnamedResources.add(sourceFilePath);
return;
@@ -334,7 +334,7 @@
* Returns set of variables which are linked with this resource
*/
private Set<String> getVariablesNameByResource(IPath resourcePath) {
- Set<ISeamContextVariable> variables = project.getVariablesByPath(resourcePath);
+ Set<ISeamContextVariable> variables =
seamProject.getVariablesByPath(resourcePath);
Set<String> result = new HashSet<String>();
if(variables!=null) {
for (ISeamContextVariable variable : variables) {
@@ -350,7 +350,7 @@
*/
private Set<IPath> getAllResourceOfComponent(IPath sourceComponentFilePath) {
Set<IPath> result = new HashSet<IPath>();
- Set<ISeamComponent> components =
project.getComponentsByPath(sourceComponentFilePath);
+ Set<ISeamComponent> components =
seamProject.getComponentsByPath(sourceComponentFilePath);
for (ISeamComponent component : components) {
Set<ISeamComponentDeclaration> declarations = component.getAllDeclarations();
for (ISeamComponentDeclaration seamComponentDeclaration : declarations) {
@@ -380,7 +380,7 @@
ISeamJavaComponentDeclaration jd = (ISeamJavaComponentDeclaration)declaration;
//do not check files declared in another project
- if(jd.getSeamProject() != project) continue;
+ if(jd.getSeamProject() != seamProject) continue;
IType type = (IType)jd.getSourceMember();
boolean sourceJavaDeclaration = !type.isBinary();
@@ -454,7 +454,7 @@
IType type = null;
// validate class name
try {
- IProject p = project.getProject();
+ IProject p = seamProject.getProject();
// type = EclipseJavaUtil.findType(EclipseResourceUtil.getJavaProject(p),
className);
type = EclipseResourceUtil.getJavaProject(p).findType(className);
if(type==null) {
@@ -614,9 +614,9 @@
// Validate @In
if(bijection.isOfType(BijectedAttributeType.IN)) {
- Set<ISeamContextVariable> variables = project.getVariablesByName(name);
+ Set<ISeamContextVariable> variables = seamProject.getVariablesByName(name);
if(variables==null || variables.size()<1) {
- ISeamProject parentProject = project.getParentProject();
+ ISeamProject parentProject = seamProject.getParentProject();
if(parentProject != null) {
variables = parentProject.getVariablesByName(name);
}
@@ -661,7 +661,7 @@
* Validates methods of java classes. They must belong components.
*/
private void validateMethodsOfUnknownComponent(ISeamJavaComponentDeclaration
declaration) {
- if(project.getComponentsByPath(declaration.getSourcePath()).isEmpty()) {
+ if(seamProject.getComponentsByPath(declaration.getSourcePath()).isEmpty()) {
IMember member = declaration.getSourceMember();
try {
if(member!=null && !Flags.isAbstract(member.getFlags())) {
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 2008-10-31
18:17:36 UTC (rev 11459)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2008-10-31
18:58:50 UTC (rev 11460)
@@ -35,7 +35,6 @@
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
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.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
@@ -46,10 +45,8 @@
import org.jboss.tools.common.el.core.model.ELInvocationExpression;
import org.jboss.tools.common.el.core.model.ELModel;
import org.jboss.tools.common.el.core.parser.ELParser;
-import org.jboss.tools.common.el.core.parser.ELParserFactory;
import org.jboss.tools.common.el.core.parser.ELParserUtil;
import org.jboss.tools.common.el.core.parser.SyntaxError;
-import org.jboss.tools.common.el.core.resolver.ELOperandResolveStatus;
import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
import org.jboss.tools.common.el.core.resolver.TypeInfoCollector;
import org.jboss.tools.common.el.core.resolver.Var;
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java 2008-10-31
18:17:36 UTC (rev 11459)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java 2008-10-31
18:58:50 UTC (rev 11460)
@@ -73,7 +73,7 @@
if(!project.isAccessible()) {
return OK_STATUS;
}
- errorManager = new ValidationErrorManager(this, null, reporter, null,
ISeamValidator.MARKED_SEAM_PROJECT_MESSAGE_GROUP);
+ errorManager = new ValidationErrorManager(this, null, reporter, null, project,
ISeamValidator.MARKED_SEAM_PROJECT_MESSAGE_GROUP);
errorManager.removeAllMessagesFromResource(project);
IVirtualComponent component = ComponentCore.createComponent(project);
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java 2008-10-31
18:17:36 UTC (rev 11459)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java 2008-10-31
18:58:50 UTC (rev 11460)
@@ -78,7 +78,7 @@
return OK_STATUS;
}
ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, false);
- errorManager = new ValidationErrorManager(this, null, reporter, null,
ISeamValidator.MARKED_SEAM_PROJECT_MESSAGE_GROUP);
+ errorManager = new ValidationErrorManager(this, null, reporter, seamProject,
seamProject.getProject(), ISeamValidator.MARKED_SEAM_PROJECT_MESSAGE_GROUP);
if(seamProject!=null) {
validateSeamProject(seamProject);
}
@@ -230,7 +230,7 @@
return;
}
errorManager.removeAllMessagesFromResource(project);
- if(!SeamPreferences.shouldValidateSettings(seamProject)) {
+ if(!SeamPreferences.shouldValidateSettings(project)) {
return;
}
errorManager.displaySubtask(VALIDATING_PROJECT, new String[]{project.getName()});
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 2008-10-31
18:17:36 UTC (rev 11459)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2008-10-31
18:58:50 UTC (rev 11460)
@@ -35,7 +35,7 @@
public SeamValidator(IValidator validatorManager,
SeamContextValidationHelper coreHelper, IReporter reporter,
SeamValidationContext validationContext, ISeamProject project) {
- super(validatorManager, coreHelper, reporter, project,
ISeamValidator.MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ super(validatorManager, coreHelper, reporter, project, coreHelper.getProject(),
ISeamValidator.MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
this.validationContext = validationContext;
this.projectName = project.getProject().getName();
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/ValidationErrorManager.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/ValidationErrorManager.java 2008-10-31
18:17:36 UTC (rev 11459)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/ValidationErrorManager.java 2008-10-31
18:58:50 UTC (rev 11460)
@@ -12,6 +12,7 @@
import java.util.Set;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
@@ -39,7 +40,8 @@
protected IValidator validationManager;
protected SeamContextValidationHelper coreHelper;
protected IReporter reporter;
- protected ISeamProject project;
+ protected ISeamProject seamProject;
+ protected IProject project;
protected String markerId;
/**
@@ -51,9 +53,10 @@
*/
public ValidationErrorManager(IValidator validatorManager,
SeamContextValidationHelper coreHelper, IReporter reporter,
- ISeamProject project, String markerId) {
+ ISeamProject seamProject, IProject project, String markerId) {
this.validationManager = validatorManager;
this.coreHelper = coreHelper;
+ this.seamProject = seamProject;
this.project = project;
this.reporter = reporter;
this.markerId = markerId;
@@ -112,8 +115,10 @@
*/
public void addError(String messageId, String preferenceKey,
String[] messageArguments, int length, int offset, IResource target) {
- String preferenceValue = SeamPreferences.getProjectPreference(project,
- preferenceKey);
+ String preferenceValue = SeamPreferences.getProjectPreference(project, preferenceKey);
+ if(preferenceValue==null && seamProject!=null) {
+ preferenceValue = SeamPreferences.getProjectPreference(seamProject.getProject(),
preferenceKey);
+ }
boolean ignore = false;
int messageSeverity = IMessage.HIGH_SEVERITY;
if (SeamPreferences.WARNING.equals(preferenceValue)) {
@@ -231,6 +236,6 @@
* @see
org.jboss.tools.seam.internal.core.validation.IValidationErrorManager#setProject(org.jboss.tools.seam.core.ISeamProject)
*/
public void setProject(ISeamProject project) {
- this.project = project;
+ this.seamProject = project;
}
}
\ No newline at end of file