Author: akazakov
Date: 2010-01-22 08:56:23 -0500 (Fri, 22 Jan 2010)
New Revision: 19881
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2708
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java 2010-01-22
13:19:30 UTC (rev 19880)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java 2010-01-22
13:56:23 UTC (rev 19881)
@@ -125,21 +125,32 @@
IStereotype[] getStereotypes();
/**
- * Returns stereotype model element for fully qualified name
- * of stereotype annotation type
+ * Returns stereotype model element for fully qualified name of stereotype
+ * annotation type
+ *
* @param qualifiedName
- * @return stereotype model element for fully qualified name of stereotype annotation
type
+ * @return stereotype model element for fully qualified name of stereotype
+ * annotation type
*/
- public IStereotype getStereotype(String qualifiedName);
+ IStereotype getStereotype(String qualifiedName);
/**
- * Returns interceptor binding model element for fully qualified name
- * of interceptor binding annotation type
+ * Returns the stereotype by resource path.
+ *
+ * @param resource path
+ * @return the stereotype by resource path
+ */
+ IStereotype getStereotype(IPath path);
+
+ /**
+ * Returns interceptor binding model element for fully qualified name of
+ * interceptor binding annotation type
+ *
* @param qualifiedName
- * @return Returns interceptor binding model element for fully qualified name
- * of interceptor binding annotation type
+ * @return interceptor binding model element for fully qualified name of
+ * interceptor binding annotation type
*/
- public InterceptorBindingElement getInterceptorBinding(String qualifiedName);
+ InterceptorBindingElement getInterceptorBinding(String qualifiedName);
/**
* Returns qualifier model element for fully qualified name
@@ -148,16 +159,18 @@
* @return Returns qualifier model element for fully qualified name
* of qualifier annotation type
*/
- public QualifierElement getQualifier(String qualifiedName);
+ QualifierElement getQualifier(String qualifiedName);
/**
- * Returns scope model element for fully qualified name
- * of scope annotation type
+ * Returns scope model element for fully qualified name of scope annotation
+ * type
+ *
* @param qualifiedName
- * @return Returns scope model element for fully qualified name
- * of scope annotation type
+ * @return the scope model element for fully qualified name of scope
+ * annotation type
*/
- public ScopeElement getScope(String qualifiedName);
+ ScopeElement getScope(String qualifiedName);
+
/**
* Returns the set of observers for an event which is injected by given
* injection point.
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2010-01-22
13:19:30 UTC (rev 19880)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2010-01-22
13:56:23 UTC (rev 19881)
@@ -49,6 +49,7 @@
CDICoreNature n;
private Map<String, StereotypeElement> stereotypes = new HashMap<String,
StereotypeElement>();
+ private Map<IPath, StereotypeElement> stereotypesByPath = new HashMap<IPath,
StereotypeElement>();
private Map<String, InterceptorBindingElement> interceptorBindings = new
HashMap<String, InterceptorBindingElement>();
private Map<String, QualifierElement> qualifiers = new HashMap<String,
QualifierElement>();
private Map<String, ScopeElement> scopes = new HashMap<String,
ScopeElement>();
@@ -373,6 +374,10 @@
return stereotypes.get(qualifiedName);
}
+ public StereotypeElement getStereotype(IPath path) {
+ return stereotypesByPath.get(path);
+ }
+
public InterceptorBindingElement getInterceptorBinding(String qualifiedName) {
return interceptorBindings.get(qualifiedName);
}
@@ -393,6 +398,7 @@
void rebuildAnnotationTypes() {
stereotypes.clear();
+ stereotypesByPath.clear();
interceptorBindings.clear();
qualifiers.clear();
scopes.clear();
@@ -402,6 +408,7 @@
StereotypeElement s = new StereotypeElement();
initAnnotationElement(s, d);
stereotypes.put(d.getQualifiedName(), s);
+ stereotypesByPath.put(d.getResource().getFullPath(), s);
} else if(d.getKind() == AnnotationDefinition.INTERCEPTOR_BINDING) {
InterceptorBindingElement s = new InterceptorBindingElement();
initAnnotationElement(s, d);
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java 2010-01-22
13:19:30 UTC (rev 19880)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java 2010-01-22
13:56:23 UTC (rev 19881)
@@ -15,6 +15,7 @@
import java.util.List;
import java.util.Map;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IAnnotatable;
import org.eclipse.jdt.core.IAnnotation;
@@ -36,6 +37,7 @@
protected List<AnnotationDeclaration> annotations = new
ArrayList<AnnotationDeclaration>();
protected IAnnotatable member;
protected Map<String, AnnotationDeclaration> annotationsByType = new
HashMap<String, AnnotationDeclaration>();
+ protected IResource resource;
public AbstractMemberDefinition() {}
@@ -53,6 +55,7 @@
}
protected void init(IType contextType, DefinitionContext context) throws CoreException
{
+ resource = contextType.getResource();
IAnnotation[] ts = member.getAnnotations();
for (int i = 0; i < ts.length; i++) {
AnnotationDeclaration a = new AnnotationDeclaration();
@@ -99,4 +102,7 @@
return annotationsByType.get(CDIConstants.SPECIALIZES_ANNOTATION_TYPE_NAME);
}
-}
+ public IResource getResource() {
+ return resource;
+ }
+}
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-01-22
13:19:30 UTC (rev 19880)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-01-22
13:56:23 UTC (rev 19881)
@@ -217,6 +217,10 @@
for (IBean bean : beans) {
validateBean(bean);
}
+ IStereotype stereotype = cdiProject.getStereotype(file.getFullPath());
+ validateStereotype(stereotype);
+
+ // TODO
}
/**
@@ -232,6 +236,7 @@
if(name!=null) {
validationContext.addVariableNameForELValidation(name);
}
+ // TODO
}
/**