Author: scabanovich
Date: 2009-12-09 13:04:47 -0500 (Wed, 09 Dec 2009)
New Revision: 19160
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/DecoratorBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointField.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingDeclaration.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingElement.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
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/AnnotationDeclaration.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanField.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMember.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMethod.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/ClassBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerField.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeDeclaration.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.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/impl/definition/AbstractTypeDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4943
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java 2009-12-09
17:38:11 UTC (rev 19159)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -39,4 +39,6 @@
public String SPECIALIZES_ANNOTATION_TYPE_NAME =
"javax.enterprise.inject.Specializes";
+ public String DELEGATE_STEREOTYPE_TYPE_NAME = "javax.decorator.Delegate";
+
}
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/DecoratorBean.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/DecoratorBean.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/DecoratorBean.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -0,0 +1,20 @@
+package org.jboss.tools.cdi.core;
+
+import java.util.Set;
+import org.eclipse.jdt.core.IType;
+import org.jboss.tools.cdi.internal.core.impl.ClassBean;
+import org.jboss.tools.cdi.internal.core.impl.definition.TypeDefinition;
+
+public class DecoratorBean extends ClassBean implements IDecorator {
+
+ public DecoratorBean() {}
+
+ public Set<IType> getDecoratedTypes() {
+ return ((TypeDefinition)definition).getInheritedTypes();
+ }
+
+ public IAnnotationDeclaration getDecoratorAnnotation() {
+ return decorator;
+ }
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/DecoratorBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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 2009-12-09
17:38:11 UTC (rev 19159)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -15,6 +15,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IType;
+import org.jboss.tools.cdi.internal.core.impl.InterceptorBindingElement;
import org.jboss.tools.common.text.INodeReference;
/**
@@ -100,6 +101,23 @@
Set<IType> getStereotypes();
/**
+ * 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
+ */
+ public IStereotype getStereotype(String qualifiedName);
+
+ /**
+ * 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
+ */
+ public InterceptorBindingElement getInterceptorBinding(String qualifiedName);
+
+ /**
* Returns the set of observers for an event which is injected by given
* injection point.
*
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -0,0 +1,82 @@
+package org.jboss.tools.cdi.internal.core.impl;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.tools.cdi.core.CDIConstants;
+import org.jboss.tools.cdi.core.IAnnotationDeclaration;
+import org.jboss.tools.cdi.core.IStereotypeDeclaration;
+import org.jboss.tools.cdi.internal.core.impl.definition.AbstractMemberDefinition;
+import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationDefinition;
+
+public class AbstractBeanElement extends CDIElement {
+ protected AbstractMemberDefinition definition;
+ protected AnnotationDeclaration named;
+ protected AnnotationDeclaration alternative;
+ protected AnnotationDeclaration specializes;
+ protected AnnotationDeclaration typed;
+ protected AnnotationDeclaration decorator;
+ protected AnnotationDeclaration delegate;
+
+ public AbstractBeanElement() {}
+
+ public void setDefinition(AbstractMemberDefinition definition) {
+ this.definition = definition;
+ setAnnotations(definition.getAnnotations());
+ }
+
+ protected void setAnnotations(List<AnnotationDeclaration> ds) {
+ for (AnnotationDeclaration d: ds) {
+ String typeName = d.getTypeName();
+ if(CDIConstants.NAMED_QUALIFIER_TYPE_NAME.equals(typeName)) {
+ named = d;
+ } else if(CDIConstants.ALTERNATIVE_ANNOTATION_TYPE_NAME.equals(typeName)) {
+ alternative = d;
+ } else if(CDIConstants.SPECIALIZES_ANNOTATION_TYPE_NAME.equals(typeName)) {
+ specializes = d;
+ } else if(CDIConstants.TYPED_ANNOTATION_TYPE_NAME.equals(typeName)) {
+ typed = d;
+ } else if(CDIConstants.DECORATOR_STEREOTYPE_TYPE_NAME.equals(typeName)) {
+ decorator = d;
+ } else if(CDIConstants.DELEGATE_STEREOTYPE_TYPE_NAME.equals(typeName)) {
+ delegate = d;
+ }
+ }
+ }
+
+ protected AnnotationDeclaration findNamedAnnotation() {
+ if(named != null) return named;
+ Set<IStereotypeDeclaration> ds = getStereotypeDeclarations();
+ for (IStereotypeDeclaration d: ds) {
+ StereotypeElement s = (StereotypeElement)d.getStereotype();
+ if(s == null) continue;
+ if(s.getNameDeclaration() != null) return s.getNameDeclaration();
+ }
+ return null;
+ }
+
+ public Set<IStereotypeDeclaration> getStereotypeDeclarations() {
+ Set<IStereotypeDeclaration> result = new
HashSet<IStereotypeDeclaration>();
+ for (AnnotationDeclaration d: definition.getAnnotations()) {
+ if(d instanceof IStereotypeDeclaration) {
+ if(d instanceof IStereotypeDeclaration) {
+ result.add((IStereotypeDeclaration)d);
+ }
+ }
+ }
+ return result;
+ }
+
+ public Set<IAnnotationDeclaration> getQualifierDeclarations() {
+ Set<IAnnotationDeclaration> result = new
HashSet<IAnnotationDeclaration>();
+ for(AnnotationDeclaration a: definition.getAnnotations()) {
+ int k = getCDIProject().getNature().getDefinitions().getAnnotationKind(a.getType());
+ if(k == AnnotationDefinition.QUALIFIER) {
+ result.add(a);
+ }
+ }
+ return result;
+ }
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotationDeclaration.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotationDeclaration.java 2009-12-09
17:38:11 UTC (rev 19159)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotationDeclaration.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -5,11 +5,13 @@
import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
+import org.jboss.tools.cdi.core.CDICoreNature;
import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
public class AnnotationDeclaration implements IAnnotationDeclaration {
+ protected CDICoreNature project;
protected IAnnotation annotation;
protected int startPosition = -1;
protected int length = 0;
@@ -18,6 +20,19 @@
public AnnotationDeclaration() {}
+ protected void copyTo(AnnotationDeclaration other) {
+ other.project = project;
+ other.annotation = annotation;
+ other.startPosition = startPosition;
+ other.length = length;
+ other.annotationTypeName = annotationTypeName;
+ other.type = type;
+ }
+
+ public void setProject(CDICoreNature project) {
+ this.project = project;
+ }
+
public void setDeclaration(IAnnotation annotation, IType declaringType) {
this.annotation = annotation;
try {
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanField.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanField.java 2009-12-09
17:38:11 UTC (rev 19159)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanField.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -6,15 +6,13 @@
import org.jboss.tools.cdi.internal.core.impl.definition.FieldDefinition;
public class BeanField extends BeanMember implements IBeanField {
- protected FieldDefinition definition;
protected IField field;
public BeanField() {}
public void setDefinition(FieldDefinition definition) {
- this.definition = definition;
+ super.setDefinition(definition);
setField(definition.getField());
- setAnnotations(definition.getAnnotations());
}
public IField getField() {
@@ -30,4 +28,7 @@
return getField();
}
+ public FieldDefinition getDefinition() {
+ return (FieldDefinition)definition;
+ }
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMember.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMember.java 2009-12-09
17:38:11 UTC (rev 19159)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMember.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -1,25 +1,18 @@
package org.jboss.tools.cdi.internal.core.impl;
-import java.util.List;
-
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
-import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.IBeanMember;
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.ITypeDeclaration;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
-public abstract class BeanMember extends CDIElement implements IBeanMember {
+public abstract class BeanMember extends AbstractBeanElement implements IBeanMember {
protected IClassBean classBean;
protected ITypeDeclaration typeDeclaration;
- protected AnnotationDeclaration named;
- protected AnnotationDeclaration alternative;
- protected AnnotationDeclaration specializes;
- protected AnnotationDeclaration typed;
public BeanMember() {}
@@ -37,21 +30,6 @@
}
}
- protected void setAnnotations(List<AnnotationDeclaration> ds) {
- for (AnnotationDeclaration d: ds) {
- String typeName = d.getTypeName();
- if(CDIConstants.NAMED_QUALIFIER_TYPE_NAME.equals(typeName)) {
- named = d;
- } else if(CDIConstants.ALTERNATIVE_ANNOTATION_TYPE_NAME.equals(typeName)) {
- alternative = d;
- } else if(CDIConstants.SPECIALIZES_ANNOTATION_TYPE_NAME.equals(typeName)) {
- specializes = d;
- } else if(CDIConstants.TYPED_ANNOTATION_TYPE_NAME.equals(typeName)) {
- typed = d;
- }
- }
- }
-
public IClassBean getClassBean() {
return classBean;
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMethod.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMethod.java 2009-12-09
17:38:11 UTC (rev 19159)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMethod.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -10,15 +10,15 @@
import org.jboss.tools.cdi.internal.core.impl.definition.MethodDefinition;
public class BeanMethod extends BeanMember implements IBeanMethod {
- protected MethodDefinition definition;
protected IMethod method;
+ protected AnnotationDeclaration inject;
public BeanMethod() {}
public void setDefinition(MethodDefinition definition) {
- this.definition = definition;
+ super.setDefinition(definition);
setMethod(definition.getMethod());
- setAnnotations(definition.getAnnotations());
+ inject = definition.getInjectAnnotation();
}
public IMethod getMethod() {
@@ -39,4 +39,7 @@
return new ArrayList<IParameter>();
}
+ public MethodDefinition getDefinition() {
+ return (MethodDefinition)definition;
+ }
}
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 2009-12-09
17:38:11 UTC (rev 19159)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -17,11 +17,11 @@
import org.jboss.tools.cdi.core.CDICoreNature;
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.cdi.core.IBean;
-import org.jboss.tools.cdi.core.ICDIElement;
import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IObserverMethod;
+import org.jboss.tools.cdi.core.IStereotype;
import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationDefinition;
import org.jboss.tools.common.text.INodeReference;
@@ -29,6 +29,7 @@
CDICoreNature n;
Map<String, StereotypeElement> stereotypes = new HashMap<String,
StereotypeElement>();
+ Map<String, InterceptorBindingElement> interceptorBindings = new
HashMap<String, InterceptorBindingElement>();
public CDIProject() {}
@@ -112,11 +113,8 @@
public Set<IType> getStereotypes() {
Set<IType> result = new HashSet<IType>();
- List<AnnotationDefinition> ds = n.getDefinitions().getAllAnnotations();
- for (AnnotationDefinition d: ds) {
- if(d.getKind() == AnnotationDefinition.STEREOTYPE) {
- result.add(d.getType());
- }
+ for (IStereotype d: stereotypes.values()) {
+ result.add(d.getSourceType());
}
return result;
}
@@ -230,19 +228,33 @@
return stereotypes.get(qualifiedName);
}
- public void rebuildStereotypes() {
+ public InterceptorBindingElement getInterceptorBinding(String qualifiedName) {
+ return interceptorBindings.get(qualifiedName);
+ }
+
+ public void rebuildAnnotationTypes() {
stereotypes.clear();
+ interceptorBindings.clear();
List<AnnotationDefinition> ds = n.getDefinitions().getAllAnnotations();
for (AnnotationDefinition d: ds) {
if(d.getKind() == AnnotationDefinition.STEREOTYPE) {
StereotypeElement s = new StereotypeElement();
s.setDefinition(d);
s.setParent(this);
- IResource r = d.getType().getResource();
+ IPath r = d.getType().getPath();
if(r != null) {
- s.setSourcePath(r.getFullPath());
+ s.setSourcePath(r);
}
stereotypes.put(d.getQualifiedName(), s);
+ } else if(d.getKind() == AnnotationDefinition.INTERCEPTOR_BINDING) {
+ InterceptorBindingElement s = new InterceptorBindingElement();
+ s.setDefinition(d);
+ s.setParent(this);
+ IPath r = d.getType().getPath();
+ if(r != null) {
+ s.setSourcePath(r);
+ }
+ interceptorBindings.put(d.getQualifiedName(), s);
}
}
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java 2009-12-09
17:38:11 UTC (rev 19159)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -1,50 +1,119 @@
package org.jboss.tools.cdi.internal.core.impl;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
import java.util.Set;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IMemberValuePair;
import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.jboss.tools.cdi.core.CDIConstants;
+import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IBeanMethod;
-import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IInterceptorBindingDeclaration;
import org.jboss.tools.cdi.core.IObserverMethod;
import org.jboss.tools.cdi.core.IProducer;
+import org.jboss.tools.cdi.core.IStereotype;
import org.jboss.tools.cdi.core.IStereotypeDeclaration;
import org.jboss.tools.cdi.core.ITypeDeclaration;
+import org.jboss.tools.cdi.internal.core.impl.definition.FieldDefinition;
+import org.jboss.tools.cdi.internal.core.impl.definition.MethodDefinition;
+import org.jboss.tools.cdi.internal.core.impl.definition.TypeDefinition;
+import org.jboss.tools.common.model.project.ext.impl.ValueInfo;
import org.jboss.tools.common.text.ITextSourceReference;
-public class ClassBean extends CDIElement implements IClassBean {
+public class ClassBean extends AbstractBeanElement implements IClassBean {
+ protected List<BeanField> fields = new ArrayList<BeanField>();
+ protected List<BeanMethod> methods = new ArrayList<BeanMethod>();
public ClassBean() {}
+ public void setDefinition(TypeDefinition definition) {
+ super.setDefinition(definition);
+ setAnnotations(definition.getAnnotations());
+ List<MethodDefinition> ms = definition.getMethods();
+ for (MethodDefinition m: ms) {
+ BeanMethod bm = null;
+ if(m.getProducesAnnotation() != null) {
+ bm = new ProducerMethod();
+ } else {
+ //add observer case
+ bm = new BeanMethod();
+ }
+ bm.setDefinition(m);
+ methods.add(bm);
+ }
+ List<FieldDefinition> fs = definition.getFields();
+ for (FieldDefinition f: fs) {
+ BeanField bf = null;
+ if(f.getProducesAnnotation() != null) {
+ bf = new ProducerField();
+ } else if(f.getInjectAnnotation() != null) {
+ bf = new InjectionPointField();
+ } else {
+ //add observer case
+ bf = new BeanField();
+ }
+ bf.setDefinition(f);
+ fields.add(bf);
+ }
+ }
+
public Set<IBeanMethod> getBeanConstructor() {
- // TODO Auto-generated method stub
- return null;
+ Set<IBeanMethod> result = new HashSet<IBeanMethod>();
+ for (BeanMethod m: methods) {
+ if(m.getDefinition().isConstructor()) {
+ result.add(m);
+ }
+ }
+ return result;
}
public Set<IBeanMethod> getDisposers() {
- // TODO Auto-generated method stub
- return null;
+ // TODO
+ return new HashSet<IBeanMethod>();
}
public Set<IInterceptorBindingDeclaration> getInterceptorBindings() {
- // TODO Auto-generated method stub
- return null;
+ Set<IInterceptorBindingDeclaration> result = new
HashSet<IInterceptorBindingDeclaration>();
+ List<AnnotationDeclaration> as = definition.getAnnotations();
+ for (AnnotationDeclaration a: as) {
+ if(a instanceof InterceptorBindingDeclaration) {
+ result.add((InterceptorBindingDeclaration)a);
+ }
+ }
+ return result;
}
public Set<IObserverMethod> getObserverMethods() {
- // TODO Auto-generated method stub
- return null;
+ Set<IObserverMethod> result = new HashSet<IObserverMethod>();
+ for (BeanMethod m: methods) {
+ if(m instanceof IObserverMethod) {
+ result.add((IObserverMethod)m);
+ }
+ }
+ return result;
}
public Set<IProducer> getProducers() {
- // TODO Auto-generated method stub
- return null;
+ Set<IProducer> result = new HashSet<IProducer>();
+ for (BeanMethod m: methods) {
+ if(m instanceof IProducer) {
+ result.add((IProducer)m);
+ }
+ }
+ for (BeanField f: fields) {
+ if(f instanceof IProducer) {
+ result.add((IProducer)f);
+ }
+ }
+ return result;
}
public Set<ITypeDeclaration> getAllTypeDeclarations() {
@@ -53,18 +122,24 @@
}
public IAnnotationDeclaration getAlternativeDeclaration() {
- // TODO Auto-generated method stub
- return null;
+ return alternative;
}
public IType getBeanClass() {
- // TODO Auto-generated method stub
- return null;
+ return ((TypeDefinition)definition).getType();
}
public Set<IInjectionPoint> getInjectionPoints() {
- // TODO Auto-generated method stub
- return null;
+ Set<IInjectionPoint> result = new HashSet<IInjectionPoint>();
+ for (BeanField f: fields) {
+ if(f instanceof IInjectionPoint) {
+ result.add((IInjectionPoint)f);
+ }
+ }
+ for (BeanMethod m: methods) {
+ //get parameters that are injection points
+ }
+ return result;
}
public Set<IType> getLegalTypes() {
@@ -73,20 +148,35 @@
}
public String getName() {
- // TODO Auto-generated method stub
- return null;
+ String name = ((TypeDefinition)definition).getQualifiedName();
+ if(name.length() > 0) {
+ name = name.substring(0, 1).toLowerCase() + name.substring(1);
+ }
+ if(named == null) {
+ return name;
+ }
+ IAnnotation a = named.getDeclaration();
+ try {
+ IMemberValuePair[] vs = a.getMemberValuePairs();
+ if(vs != null && vs.length > 0) {
+ Object value = vs[0].getValue();
+ if(value != null && value.toString().trim().length() > 0) {
+ return value.toString().trim();
+ }
+ }
+ } catch (JavaModelException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
+ return name;
}
public ITextSourceReference getNameLocation() {
- // TODO Auto-generated method stub
+ if(named != null) {
+ return ValueInfo.getValueInfo(named.getDeclaration(), null);
+ }
return null;
}
- public Set<IAnnotationDeclaration> getQualifierDeclarations() {
- // TODO Auto-generated method stub
- return null;
- }
-
public Set<ITypeDeclaration> getRestrictedTypeDeclaratios() {
// TODO Auto-generated method stub
return null;
@@ -102,29 +192,28 @@
return null;
}
- public Set<IStereotypeDeclaration> getStereotypeDeclarations() {
- // TODO Auto-generated method stub
- return null;
- }
-
public boolean isAlternative() {
- // TODO Auto-generated method stub
+ if(alternative != null) return true;
+ Set<IStereotypeDeclaration> ds = getStereotypeDeclarations();
+ for (IStereotypeDeclaration d: ds) {
+ IStereotype s = d.getStereotype();
+ if(s != null && s.isAlternative()) return true;
+ }
return false;
}
public boolean isDependent() {
- // TODO Auto-generated method stub
- return false;
+ IType scope = getScope();
+ return scope != null &&
CDIConstants.DEPENDENT_ANNOTATION_TYPE_NAME.equals(scope.getFullyQualifiedName());
}
public boolean isEnabled() {
- // TODO Auto-generated method stub
+ // TODO
return false;
}
public boolean isSpecializing() {
- // TODO Auto-generated method stub
- return false;
+ return specializes != null;
}
public IType getScope() {
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointField.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointField.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointField.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -0,0 +1,23 @@
+package org.jboss.tools.cdi.internal.core.impl;
+
+import org.eclipse.jdt.core.IType;
+import org.jboss.tools.cdi.core.IAnnotationDeclaration;
+import org.jboss.tools.cdi.core.IInjectionPointField;
+
+public class InjectionPointField extends BeanField implements IInjectionPointField {
+
+ public InjectionPointField() {}
+
+ public IAnnotationDeclaration getDecoratorAnnotation() {
+ return decorator;
+ }
+
+ public IType getType() {
+ return typeDeclaration == null ? null : typeDeclaration.getType();
+ }
+
+ public boolean isDelegate() {
+ return delegate != null;
+ }
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointField.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingDeclaration.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingDeclaration.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingDeclaration.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -0,0 +1,17 @@
+package org.jboss.tools.cdi.internal.core.impl;
+
+import org.jboss.tools.cdi.core.IInterceptorBinding;
+import org.jboss.tools.cdi.core.IInterceptorBindingDeclaration;
+
+public class InterceptorBindingDeclaration extends AnnotationDeclaration
+ implements IInterceptorBindingDeclaration {
+
+ public InterceptorBindingDeclaration(AnnotationDeclaration d) {
+ d.copyTo(this);
+ }
+
+ public IInterceptorBinding getInterceptorBinding() {
+ return project.getDelegate().getInterceptorBinding(getTypeName());
+ }
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingDeclaration.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingElement.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingElement.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingElement.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -0,0 +1,37 @@
+package org.jboss.tools.cdi.internal.core.impl;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jdt.core.IType;
+import org.jboss.tools.cdi.core.IInterceptorBinding;
+import org.jboss.tools.cdi.core.IInterceptorBindingDeclaration;
+import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationDefinition;
+
+public class InterceptorBindingElement extends CDIElement implements IInterceptorBinding
{
+ AnnotationDefinition definition;
+
+ public InterceptorBindingElement() {}
+
+ public void setDefinition(AnnotationDefinition definition) {
+ this.definition = definition;
+// setAnnotations(definition.getAnnotations());
+ }
+
+ public Set<IInterceptorBindingDeclaration> getInterceptorBindingDeclarations() {
+ Set<IInterceptorBindingDeclaration> result = new
HashSet<IInterceptorBindingDeclaration>();
+ List<AnnotationDeclaration> as = definition.getAnnotations();
+ for (AnnotationDeclaration a: as) {
+ if(a instanceof InterceptorBindingDeclaration) {
+ result.add((InterceptorBindingDeclaration)a);
+ }
+ }
+ return result;
+ }
+
+ public IType getSourceType() {
+ return definition.getType();
+ }
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingElement.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerField.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerField.java 2009-12-09
17:38:11 UTC (rev 19159)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerField.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -5,10 +5,7 @@
import java.util.Set;
import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMemberValuePair;
-import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.cdi.core.CDIConstants;
@@ -18,10 +15,11 @@
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IProducerField;
+import org.jboss.tools.cdi.core.IStereotype;
import org.jboss.tools.cdi.core.IStereotypeDeclaration;
import org.jboss.tools.cdi.core.ITypeDeclaration;
import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationDefinition;
-import org.jboss.tools.common.java.IJavaSourceReference;
+import org.jboss.tools.common.model.project.ext.impl.ValueInfo;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
import org.jboss.tools.common.text.ITextSourceReference;
@@ -77,44 +75,11 @@
}
public ITextSourceReference getNameLocation() {
- final IField f = getField();
- return new IJavaSourceReference(){
-
- public int getStartPosition() {
- try {
- ISourceRange r = f.getSourceRange();
- return r == null ? -1 : r.getOffset();
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
- return -1;
- }
- }
-
- public int getLength() {
- try {
- ISourceRange r = f.getSourceRange();
- return r == null ? 0 : r.getLength();
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
- return 0;
- }
- }
-
- public IMember getSourceMember() {
- return f;
- }
- };
- }
-
- public Set<IAnnotationDeclaration> getQualifierDeclarations() {
- Set<IAnnotationDeclaration> result = new
HashSet<IAnnotationDeclaration>();
- for(AnnotationDeclaration a: definition.getAnnotations()) {
- int k = getCDIProject().getNature().getDefinitions().getAnnotationKind(a.getType());
- if(k == AnnotationDefinition.QUALIFIER) {
- result.add(a);
- }
+ AnnotationDeclaration named = findNamedAnnotation();
+ if(named != null) {
+ return ValueInfo.getValueInfo(named.getDeclaration(), null);
}
- return result;
+ return null;
}
public Set<ITypeDeclaration> getRestrictedTypeDeclaratios() {
@@ -156,21 +121,14 @@
return null;
}
- public Set<IStereotypeDeclaration> getStereotypeDeclarations() {
- Set<IStereotypeDeclaration> result = new
HashSet<IStereotypeDeclaration>();
- for (AnnotationDeclaration d: definition.getAnnotations()) {
- if(d instanceof IStereotypeDeclaration) {
- StereotypeDeclaration sd = (StereotypeDeclaration)d;
- StereotypeElement s = getCDIProject().getStereotype(d.getTypeName());
- sd.setStereotype(s);
- result.add(sd);
- }
- }
- return result;
- }
-
public boolean isAlternative() {
- return alternative != null;
+ if(alternative != null) return true;
+ Set<IStereotypeDeclaration> ds = getStereotypeDeclarations();
+ for (IStereotypeDeclaration d: ds) {
+ IStereotype s = d.getStereotype();
+ if(s != null && s.isAlternative()) return true;
+ }
+ return false;
}
public boolean isDependent() {
@@ -225,15 +183,4 @@
return result;
}
- public static Set<IAnnotationDeclaration> getStereotypeDeclarations(CDICoreNature
n, List<? extends IAnnotationDeclaration> ds) {
- Set<IAnnotationDeclaration> result = new
HashSet<IAnnotationDeclaration>();
- for (IAnnotationDeclaration d: ds) {
- int k = n.getDefinitions().getAnnotationKind(d.getType());
- if(k == AnnotationDefinition.STEREOTYPE) {
- result.add(d);
- }
- }
- return result;
- }
-
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java 2009-12-09
17:38:11 UTC (rev 19159)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -5,10 +5,7 @@
import java.util.Set;
import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMemberValuePair;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.cdi.core.CDIConstants;
@@ -21,14 +18,21 @@
import org.jboss.tools.cdi.core.IStereotypeDeclaration;
import org.jboss.tools.cdi.core.ITypeDeclaration;
import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationDefinition;
-import org.jboss.tools.common.java.IJavaSourceReference;
+import org.jboss.tools.cdi.internal.core.impl.definition.MethodDefinition;
+import org.jboss.tools.common.model.project.ext.impl.ValueInfo;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
import org.jboss.tools.common.text.ITextSourceReference;
public class ProducerMethod extends BeanMethod implements IProducerMethod {
+ protected AnnotationDeclaration produces;
public ProducerMethod() {}
+ public void setDefinition(MethodDefinition definition) {
+ super.setDefinition(definition);
+ produces = definition.getProducesAnnotation();
+ }
+
public Set<ITypeDeclaration> getAllTypeDeclarations() {
Set<ITypeDeclaration> result = new HashSet<ITypeDeclaration>();
if(typeDeclaration != null) {
@@ -56,6 +60,7 @@
public String getName() {
String name = getMethod().getElementName();
+ AnnotationDeclaration named = findNamedAnnotation();
if(named == null) {
return name;
}
@@ -81,44 +86,11 @@
}
public ITextSourceReference getNameLocation() {
- final IMethod f = getMethod();
- return new IJavaSourceReference(){
-
- public int getStartPosition() {
- try {
- ISourceRange r = f.getSourceRange();
- return r == null ? -1 : r.getOffset();
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
- return -1;
- }
- }
-
- public int getLength() {
- try {
- ISourceRange r = f.getSourceRange();
- return r == null ? 0 : r.getLength();
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
- return 0;
- }
- }
-
- public IMember getSourceMember() {
- return f;
- }
- };
- }
-
- public Set<IAnnotationDeclaration> getQualifierDeclarations() {
- Set<IAnnotationDeclaration> result = new
HashSet<IAnnotationDeclaration>();
- for(AnnotationDeclaration a: definition.getAnnotations()) {
- int k = getCDIProject().getNature().getDefinitions().getAnnotationKind(a.getType());
- if(k == AnnotationDefinition.QUALIFIER) {
- result.add(a);
- }
+ AnnotationDeclaration named = findNamedAnnotation();
+ if(named != null) {
+ return ValueInfo.getValueInfo(named.getDeclaration(), null);
}
- return result;
+ return null;
}
//similar to ProducerField.getRestrictedTypeDeclaratios
@@ -166,21 +138,14 @@
return specializes;
}
- public Set<IStereotypeDeclaration> getStereotypeDeclarations() {
- Set<IStereotypeDeclaration> result = new
HashSet<IStereotypeDeclaration>();
- for (AnnotationDeclaration d: definition.getAnnotations()) {
- if(d instanceof IStereotypeDeclaration) {
- StereotypeDeclaration sd = (StereotypeDeclaration)d;
- StereotypeElement s = getCDIProject().getStereotype(d.getTypeName());
- sd.setStereotype(s);
- result.add(sd);
- }
- }
- return result;
- }
-
public boolean isAlternative() {
- return alternative != null;
+ if(alternative != null) return true;
+ Set<IStereotypeDeclaration> ds = getStereotypeDeclarations();
+ for (IStereotypeDeclaration d: ds) {
+ IStereotype s = d.getStereotype();
+ if(s != null && s.isAlternative()) return true;
+ }
+ return false;
}
public boolean isDependent() {
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeDeclaration.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeDeclaration.java 2009-12-09
17:38:11 UTC (rev 19159)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeDeclaration.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -4,22 +4,15 @@
import org.jboss.tools.cdi.core.IStereotypeDeclaration;
public class StereotypeDeclaration extends AnnotationDeclaration implements
IStereotypeDeclaration {
- protected StereotypeElement stereotype;
+ public StereotypeDeclaration() {}
+
public StereotypeDeclaration(AnnotationDeclaration d) {
- annotation = d.annotation;
- startPosition = d.startPosition;
- length = d.length;
- annotationTypeName = d.annotationTypeName;
- type = d.type;
+ d.copyTo(this);
}
public IStereotype getStereotype() {
- return stereotype;
+ return project.getDelegate().getStereotype(getTypeName());
}
- public void setStereotype(StereotypeElement stereotype) {
- this.stereotype = stereotype;
- }
-
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java 2009-12-09
17:38:11 UTC (rev 19159)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -36,13 +36,23 @@
}
}
- public IAnnotationDeclaration getAlternativeDeclaration() {
+ public AnnotationDeclaration getAlternativeDeclaration() {
return alternative;
}
+ public AnnotationDeclaration getNameDeclaration() {
+ return named;
+ }
+
public Set<IInterceptorBindingDeclaration> getInterceptorBindingDeclarations() {
- // TODO
- return new HashSet<IInterceptorBindingDeclaration>();
+ Set<IInterceptorBindingDeclaration> result = new
HashSet<IInterceptorBindingDeclaration>();
+ List<AnnotationDeclaration> as = definition.getAnnotations();
+ for (AnnotationDeclaration a: as) {
+ if(a instanceof InterceptorBindingDeclaration) {
+ result.add((InterceptorBindingDeclaration)a);
+ }
+ }
+ return result;
}
public IAnnotation getNameLocation() {
@@ -65,7 +75,12 @@
public boolean isAlternative() {
if(alternative != null) return true;
- return alternative != null;
+ Set<IStereotypeDeclaration> ds = getStereotypeDeclarations();
+ for (IStereotypeDeclaration d: ds) {
+ IStereotype s = d.getStereotype();
+ if(s != null && s.isAlternative()) return true;
+ }
+ return false;
}
public IType getScope() {
@@ -75,7 +90,7 @@
}
Set<IStereotypeDeclaration> ds = getStereotypeDeclarations();
for (IStereotypeDeclaration d: ds) {
-
+ //TODO
}
return null;
}
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 2009-12-09
17:38:11 UTC (rev 19159)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -10,6 +10,7 @@
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.internal.core.impl.AnnotationDeclaration;
+import org.jboss.tools.cdi.internal.core.impl.InterceptorBindingDeclaration;
import org.jboss.tools.cdi.internal.core.impl.StereotypeDeclaration;
public abstract class AbstractMemberDefinition {
@@ -33,9 +34,12 @@
IAnnotation[] ts = member.getAnnotations();
for (int i = 0; i < ts.length; i++) {
AnnotationDeclaration a = new AnnotationDeclaration();
+ a.setProject(context.getProject());
a.setDeclaration(ts[i], contextType);
if(context.getAnnotationKind(a.getType()) == AnnotationDefinition.STEREOTYPE) {
a = new StereotypeDeclaration(a);
+ } else if(context.getAnnotationKind(a.getType()) ==
AnnotationDefinition.INTERCEPTOR_BINDING) {
+ a = new InterceptorBindingDeclaration(a);
}
annotations.add(a);
if(CDIConstants.INJECT_ANNOTATION_TYPE_NAME.equals(a.getTypeName())) {
@@ -54,4 +58,12 @@
return injectAnnotation != null || producesAnnotation != null;
}
+ public AnnotationDeclaration getProducesAnnotation() {
+ return producesAnnotation;
+ }
+
+ public AnnotationDeclaration getInjectAnnotation() {
+ return injectAnnotation;
+ }
+
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java 2009-12-09
17:38:11 UTC (rev 19159)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -1,11 +1,16 @@
package org.jboss.tools.cdi.internal.core.impl.definition;
+import java.util.HashSet;
+import java.util.Set;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IType;
+import org.jboss.tools.common.model.util.EclipseJavaUtil;
public class AbstractTypeDefinition extends AbstractMemberDefinition {
protected String qualifiedName;
- IType type;
+ protected IType type;
+ protected Set<IType> inheritedTypes = new HashSet<IType>();
public AbstractTypeDefinition() {}
@@ -26,6 +31,26 @@
this.type = contextType;
super.init(contextType, context);
qualifiedName = getType().getFullyQualifiedName();
+ String sc = type.getSuperclassTypeSignature();
+ if(sc != null) {
+ sc = EclipseJavaUtil.resolveType(contextType, sc);
+ if(sc != null && sc.length() > 0) {
+ IType t = EclipseJavaUtil.findType(contextType.getJavaProject(), sc);
+ if(t != null) inheritedTypes.add(t);
+ }
+ }
+ String[] is = type.getSuperInterfaceTypeSignatures();
+ if(is != null) for (int i = 0; i < is.length; i++) {
+ String c = EclipseJavaUtil.resolveType(contextType, is[i]);
+ if(c != null && c.length() > 0) {
+ IType t = EclipseJavaUtil.findType(contextType.getJavaProject(), c);
+ if(t != null) inheritedTypes.add(t);
+ }
+ }
}
+ public Set<IType> getInheritedTypes() {
+ return inheritedTypes;
+ }
+
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java 2009-12-09
17:38:11 UTC (rev 19159)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -46,6 +46,10 @@
return project;
}
+ public IJavaProject getJavaProject() {
+ return javaProject;
+ }
+
public void addType(IPath file, String typeName, AbstractTypeDefinition def) {
if(file != null) {
Set<String> ts = resources.get(file);
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java 2009-12-09
17:38:11 UTC (rev 19159)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -3,6 +3,8 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
+import org.jboss.tools.cdi.core.CDIConstants;
+import org.jboss.tools.cdi.internal.core.impl.AnnotationDeclaration;
public class MethodDefinition extends AbstractMemberDefinition {
IMethod method;
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java 2009-12-09
17:38:11 UTC (rev 19159)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java 2009-12-09
18:04:47 UTC (rev 19160)
@@ -41,4 +41,12 @@
}
}
+ public List<FieldDefinition> getFields() {
+ return fields;
+ }
+
+ public List<MethodDefinition> getMethods() {
+ return methods;
+ }
+
}