Author: scabanovich
Date: 2009-12-10 11:37:38 -0500 (Thu, 10 Dec 2009)
New Revision: 19193
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBean.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/CDICoreBuilder.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIProject.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/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/definition/AbstractTypeDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationHelper.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/TypeDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/CDIBuilderDelegate.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-10
16:36:43 UTC (rev 19192)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java 2009-12-10
16:37:38 UTC (rev 19193)
@@ -30,6 +30,7 @@
public String ALTERNATIVE_ANNOTATION_TYPE_NAME =
"javax.enterprise.inject.Alternative";
public String INTERCEPTOR_BINDING_ANNOTATION_TYPE_NAME =
"javax.interceptor.InterceptorBinding";
+ public String INTERCEPTOR_ANNOTATION_TYPE_NAME =
"javax.interceptor.Interceptor";
public String APPLICATION_SCOPED_ANNOTATION_TYPE_NAME =
"javax.enterprise.context.ApplicationScoped";
public String CONVERSATION_SCOPED_ANNOTATION_TYPE_NAME =
"javax.enterprise.context.ConversationScoped";
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java 2009-12-10
16:36:43 UTC (rev 19192)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java 2009-12-10
16:37:38 UTC (rev 19193)
@@ -129,8 +129,10 @@
} catch (InstantiationException e2) {
CDICorePlugin.getDefault().logError(e2);
}
- }
+ }
+ n.getDefinitions().newWorkingCopy(kind == FULL_BUILD);
+
if(n.getClassPath().update()) {
List<String> newJars = n.getClassPath().process();
buildJars(newJars);
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java 2009-12-10
16:36:43 UTC (rev 19192)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java 2009-12-10
16:37:38 UTC (rev 19193)
@@ -39,11 +39,13 @@
boolean isBuilt = false;
- Map<IPath, Object> sourcePaths2 = new HashMap<IPath, Object>(); //TODO
+// Map<IPath, Object> sourcePaths2 = new HashMap<IPath, Object>(); //TODO
private boolean isStorageResolved = false;
- public CDICoreNature() {}
+ public CDICoreNature() {
+ definitions.setProject(this);
+ }
public void configure() throws CoreException {
addToBuildSpec(CDICoreBuilder.BUILDER_ID);
@@ -64,6 +66,7 @@
public void setCDIProject(ICDIProject cdiProject) {
this.cdiProjectDelegate = cdiProject;
+ cdiProject.setNature(this);
}
public DefinitionContext getDefinitions() {
@@ -138,10 +141,15 @@
isBuilt = false;
classPath.clean();
postponeFiring();
- IPath[] ps = sourcePaths2.keySet().toArray(new IPath[0]);
- for (int i = 0; i < ps.length; i++) {
- pathRemoved(ps[i]);
+
+ definitions.clean();
+ if(cdiProjectDelegate != null) {
+ cdiProjectDelegate.update();
}
+// IPath[] ps = sourcePaths2.keySet().toArray(new IPath[0]);
+// for (int i = 0; i < ps.length; i++) {
+// pathRemoved(ps[i]);
+// }
fireChanges();
}
@@ -249,8 +257,10 @@
public List<Long> statistics;
public void pathRemoved(IPath source) {
+// sourcePaths2.remove(source);
definitions.clean(source);
//TODO
}
+
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIProject.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIProject.java 2009-12-10
16:36:43 UTC (rev 19192)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIProject.java 2009-12-10
16:37:38 UTC (rev 19193)
@@ -15,4 +15,7 @@
*/
public interface ICDIProject extends IBeanManager {
+ public void setNature(CDICoreNature n);
+ public void update();
+
}
\ No newline at end of file
Modified:
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 2009-12-10
16:36:43 UTC (rev 19192)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2009-12-10
16:37:38 UTC (rev 19193)
@@ -27,11 +27,13 @@
*/
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 interceptor;
protected AnnotationDeclaration delegate;
public AbstractBeanElement() {}
@@ -56,6 +58,8 @@
decorator = d;
} else if(CDIConstants.DELEGATE_STEREOTYPE_TYPE_NAME.equals(typeName)) {
delegate = d;
+ } else if(CDIConstants.INTERCEPTOR_ANNOTATION_TYPE_NAME.equals(typeName)) {
+ interceptor = d;
}
}
}
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-10
16:36:43 UTC (rev 19192)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2009-12-10
16:37:38 UTC (rev 19193)
@@ -12,6 +12,7 @@
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -31,8 +32,11 @@
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.IProducer;
import org.jboss.tools.cdi.core.IStereotype;
+import org.jboss.tools.cdi.internal.core.impl.definition.AbstractTypeDefinition;
import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationDefinition;
+import org.jboss.tools.cdi.internal.core.impl.definition.TypeDefinition;
import org.jboss.tools.common.text.INodeReference;
/**
@@ -46,12 +50,20 @@
Map<String, StereotypeElement> stereotypes = new HashMap<String,
StereotypeElement>();
Map<String, InterceptorBindingElement> interceptorBindings = new
HashMap<String, InterceptorBindingElement>();
+ Map<IPath, Set<IBean>> beansByPath = new HashMap<IPath,
Set<IBean>>();
+ Map<String, Set<IBean>> beansByName = new HashMap<String,
Set<IBean>>();
+
+
public CDIProject() {}
public CDICoreNature getNature() {
return n;
}
+ public void setNature(CDICoreNature n) {
+ this.n = n;
+ }
+
public List<INodeReference> getAlternativeClasses() {
// TODO Auto-generated method stub
return null;
@@ -72,10 +84,22 @@
return null;
}
- public Set<IBean> getBeans(String name,
- boolean attemptToResolveAmbiguousNames) {
- // TODO Auto-generated method stub
- return null;
+ public Set<IBean> getBeans(String name, boolean attemptToResolveAmbiguousNames) {
+ Set<IBean> result = new HashSet<IBean>();
+ Set<IBean> beans = beansByName.get(name);
+ if(beans == null || beans.isEmpty()) {
+ return result;
+ }
+ result.addAll(beans);
+ if(result.size() == 1 || !attemptToResolveAmbiguousNames) {
+ return result;
+ }
+ Iterator<IBean> it = result.iterator();
+ while(it.hasNext()) {
+ IBean bean = it.next();
+ if(!bean.isAlternative()) it.remove();
+ }
+ return result;
}
public Set<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
@@ -85,13 +109,16 @@
}
public Set<IBean> getBeans(IInjectionPoint injectionPoints) {
- // TODO Auto-generated method stub
- return null;
+ Set<IBean> result = new HashSet<IBean>();
+ //TODO
+ return result;
}
public Set<IBean> getBeans(IPath path) {
- // TODO Auto-generated method stub
- return null;
+ Set<IBean> result = new HashSet<IBean>();
+ Set<IBean> beans = beansByPath.get(path);
+ if(beans != null && !beans.isEmpty()) result.addAll(beans);
+ return result;
}
public List<INodeReference> getDecoratorClasses() {
@@ -247,6 +274,11 @@
return interceptorBindings.get(qualifiedName);
}
+ public void update() {
+ rebuildAnnotationTypes();
+ rebuildBeans();
+ }
+
public void rebuildAnnotationTypes() {
stereotypes.clear();
interceptorBindings.clear();
@@ -273,4 +305,46 @@
}
}
}
+
+ public void rebuildBeans() {
+ beansByPath.clear();
+ beansByName.clear();
+ List<TypeDefinition> typeDefinitions = n.getDefinitions().getTypeDefinitions();
+ for (TypeDefinition typeDefinition : typeDefinitions) {
+ ClassBean bean = null;
+ if(typeDefinition.getInterceptorAnnotation() != null) {
+ bean = new InterceptorBean();
+ } else if(typeDefinition.getDecoratorAnnotation() != null) {
+ bean = new DecoratorBean();
+ } else {
+ bean = new ClassBean();
+ }
+ bean.setDefinition(typeDefinition);
+ addBean(bean);
+ Set<IProducer> ps = bean.getProducers();
+ for (IProducer producer: ps) {
+ addBean(producer);
+ }
+ }
+ }
+
+ void addBean(IBean bean) {
+ String name = bean.getName();
+ if(name != null && name.length() > 0) {
+ Set<IBean> bs = beansByName.get(name);
+ if(bs == null) {
+ bs = new HashSet<IBean>();
+ beansByName.put(name, bs);
+ }
+ bs.add(bean);
+ }
+ IPath path = bean.getSourcePath();
+ Set<IBean> bs = beansByPath.get(path);
+ if(bs == null) {
+ bs = new HashSet<IBean>();
+ beansByPath.put(path, bs);
+ }
+ bs.add(bean);
+ }
+
}
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-10
16:36:43 UTC (rev 19192)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java 2009-12-10
16:37:38 UTC (rev 19193)
@@ -51,6 +51,7 @@
public ClassBean() {}
public void setDefinition(TypeDefinition definition) {
+ setSourcePath(definition.getType().getPath());
super.setDefinition(definition);
setAnnotations(definition.getAnnotations());
List<MethodDefinition> ms = definition.getMethods();
@@ -63,6 +64,7 @@
bm = new BeanMethod();
}
bm.setDefinition(m);
+ bm.setParent(this);
methods.add(bm);
}
List<FieldDefinition> fs = definition.getFields();
@@ -77,6 +79,7 @@
bf = new BeanField();
}
bf.setDefinition(f);
+ bf.setParent(this);
fields.add(bf);
}
}
@@ -164,13 +167,14 @@
}
public String getName() {
- String name = ((TypeDefinition)definition).getQualifiedName();
+ AnnotationDeclaration named = findNamedAnnotation();
+ if(named == null) return null;
+
+ String name = ((TypeDefinition)definition).getType().getElementName();
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();
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBean.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBean.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBean.java 2009-12-10
16:37:38 UTC (rev 19193)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.internal.core.impl;
+
+import org.jboss.tools.cdi.core.IAnnotationDeclaration;
+import org.jboss.tools.cdi.core.IInterceptor;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class InterceptorBean extends ClassBean implements IInterceptor {
+
+ public InterceptorBean() {}
+
+ public IAnnotationDeclaration getInterceptorAnnotation() {
+ return interceptor;
+ }
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-10
16:36:43 UTC (rev 19192)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java 2009-12-10
16:37:38 UTC (rev 19193)
@@ -39,7 +39,7 @@
}
public void setType(IType type, DefinitionContext context) {
- super.setAnnotatable(type, type,context);
+ super.setAnnotatable(type, type, context);
}
@Override
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationHelper.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationHelper.java 2009-12-10
16:36:43 UTC (rev 19192)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationHelper.java 2009-12-10
16:37:38 UTC (rev 19193)
@@ -26,7 +26,7 @@
public static final Set<String> SCOPE_ANNOTATION_TYPES = new
HashSet<String>();
public static final Set<String> STEREOTYPE_ANNOTATION_TYPES = new
HashSet<String>();
- {
+ static {
BASIC_ANNOTATION_TYPES.add(INHERITED_ANNOTATION_TYPE_NAME);
BASIC_ANNOTATION_TYPES.add(TARGET_ANNOTATION_TYPE_NAME);
BASIC_ANNOTATION_TYPES.add(RETENTION_ANNOTATION_TYPE_NAME);
@@ -54,6 +54,7 @@
CDI_ANNOTATION_TYPES.add(INJECT_ANNOTATION_TYPE_NAME);
CDI_ANNOTATION_TYPES.add(ALTERNATIVE_ANNOTATION_TYPE_NAME);
CDI_ANNOTATION_TYPES.add(INTERCEPTOR_BINDING_ANNOTATION_TYPE_NAME);
+ CDI_ANNOTATION_TYPES.add(INTERCEPTOR_ANNOTATION_TYPE_NAME);
CDI_ANNOTATION_TYPES.addAll(SCOPE_ANNOTATION_TYPES);
CDI_ANNOTATION_TYPES.addAll(STEREOTYPE_ANNOTATION_TYPES);
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-10
16:36:43 UTC (rev 19192)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java 2009-12-10
16:37:38 UTC (rev 19193)
@@ -34,7 +34,7 @@
Set<String> types = new HashSet<String>();
Map<IPath, Set<String>> resources = new HashMap<IPath,
Set<String>>();
- Map<String, AbstractTypeDefinition> typeDefinitions = new HashMap<String,
AbstractTypeDefinition>();
+ Map<String, TypeDefinition> typeDefinitions = new HashMap<String,
TypeDefinition>();
Map<String, AnnotationDefinition> annotations = new HashMap<String,
AnnotationDefinition>();
DefinitionContext workingCopy;
@@ -42,12 +42,23 @@
public DefinitionContext() {}
- private DefinitionContext copy() {
+ private DefinitionContext copy(boolean clean) {
DefinitionContext copy = new DefinitionContext();
copy.project = project;
copy.javaProject = javaProject;
- copy.types.addAll(types);
- copy.typeDefinitions.putAll(typeDefinitions);
+ if(!clean) {
+ copy.types.addAll(types);
+ copy.typeDefinitions.putAll(typeDefinitions);
+ copy.annotations.putAll(annotations);
+ for (IPath p: resources.keySet()) {
+ Set<String> set = resources.get(p);
+ if(set != null) {
+ Set<String> s1 = new HashSet<String>();
+ s1.addAll(set);
+ copy.resources.put(p, s1);
+ }
+ }
+ }
return copy;
}
@@ -82,12 +93,23 @@
}
} else {
synchronized (typeDefinitions) {
- typeDefinitions.put(def.getQualifiedName(), def);
+ typeDefinitions.put(def.getQualifiedName(), (TypeDefinition)def);
}
}
}
}
+ public void clean() {
+ resources.clear();
+ types.clear();
+ synchronized (typeDefinitions) {
+ typeDefinitions.clear();
+ }
+ synchronized (annotations) {
+ annotations.clear();
+ }
+ }
+
public void clean(IPath path) {
Set<String> ts = resources.remove(path);
if(ts == null) return;
@@ -102,9 +124,11 @@
}
}
+ private Set<String> underConstruction = new HashSet<String>();
+
public int getAnnotationKind(IType annotationType) {
if(annotationType == null) return -1;
- AnnotationDefinition d = annotations.get(annotationType);
+ AnnotationDefinition d = getAnnotation(annotationType);
if(d != null) {
return d.getKind();
}
@@ -127,11 +151,15 @@
if(AnnotationHelper.CDI_ANNOTATION_TYPES.contains(name)) {
return AnnotationDefinition.CDI;
}
-
+ if(underConstruction.contains(name)) {
+ return AnnotationDefinition.BASIC;
+ }
+ System.out.println(name);
return createAnnotation(annotationType, name);
}
private int createAnnotation(IType annotationType, String name) {
+ underConstruction.add(name);
AnnotationDefinition d = new AnnotationDefinition();
d.setType(annotationType, this);
int kind = d.getKind();
@@ -139,9 +167,16 @@
d = null;
}
addType(annotationType.getPath(), name, d);
+ underConstruction.remove(name);
return kind;
}
+ public void newWorkingCopy(boolean forFullBuild) {
+ if(original != null) return;
+ workingCopy = copy(forFullBuild);
+ workingCopy.original = this;
+ }
+
public DefinitionContext getWorkingCopy() {
if(original != null) {
return this;
@@ -149,7 +184,7 @@
if(workingCopy != null) {
return workingCopy;
}
- workingCopy = copy();
+ workingCopy = copy(false);
workingCopy.original = this;
return workingCopy;
}
@@ -162,8 +197,14 @@
if(workingCopy == null) {
return;
}
- //TODO
-
+
+ types = workingCopy.types;
+ resources = workingCopy.resources;
+ typeDefinitions = workingCopy.typeDefinitions;
+ annotations = workingCopy.annotations;
+
+ project.getDelegate().update();
+
workingCopy = null;
}
@@ -178,9 +219,15 @@
result.addAll(annotations.values());
}
return result;
+ }
+ public List<TypeDefinition> getTypeDefinitions() {
+ List<TypeDefinition> result = new ArrayList<TypeDefinition>();
+ synchronized (typeDefinitions) {
+ result.addAll(typeDefinitions.values());
+ }
+ return result;
}
-
}
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-10
16:36:43 UTC (rev 19192)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java 2009-12-10
16:37:38 UTC (rev 19193)
@@ -14,9 +14,11 @@
import java.util.List;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IField;
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;
/**
@@ -25,8 +27,11 @@
*
*/
public class TypeDefinition extends AbstractTypeDefinition {
+ boolean isAbstract;
List<FieldDefinition> fields = new ArrayList<FieldDefinition>();
List<MethodDefinition> methods = new ArrayList<MethodDefinition>();
+ AnnotationDeclaration decoratorAnnotation;
+ AnnotationDeclaration interceptorAnnotation;
public TypeDefinition() {
}
@@ -34,9 +39,15 @@
@Override
protected void init(IType contextType, DefinitionContext context) throws CoreException
{
super.init(contextType, context);
- for (AnnotationDeclaration d: annotations) {
- int kind = context.getAnnotationKind(d.getType());
+ isAbstract = Flags.isAbstract(type.getFlags());
+ for (AnnotationDeclaration a: annotations) {
+ int kind = context.getAnnotationKind(a.getType());
//TODO do we need to create members for specific annotations?
+ if(CDIConstants.DECORATOR_STEREOTYPE_TYPE_NAME.equals(a.getTypeName())) {
+ decoratorAnnotation = a;
+ } else if(CDIConstants.INTERCEPTOR_ANNOTATION_TYPE_NAME.equals(a.getTypeName())) {
+ interceptorAnnotation = a;
+ }
}
IField[] fs = getType().getFields();
for (int i = 0; i < fs.length; i++) {
@@ -64,4 +75,16 @@
return methods;
}
+ public boolean isAbstract() {
+ return isAbstract;
+ }
+
+ public AnnotationDeclaration getDecoratorAnnotation() {
+ return decoratorAnnotation;
+ }
+
+ public AnnotationDeclaration getInterceptorAnnotation() {
+ return interceptorAnnotation;
+ }
+
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/CDIBuilderDelegate.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/CDIBuilderDelegate.java 2009-12-10
16:36:43 UTC (rev 19192)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/CDIBuilderDelegate.java 2009-12-10
16:37:38 UTC (rev 19193)
@@ -38,7 +38,6 @@
DefinitionContext context = projectNature.getDefinitions().getWorkingCopy();
Set<IPath> ps = fileSet.getAllPaths();
for (IPath p: ps) context.clean(p);
- context.setProject(projectNature);
Map<IPath, Set<IType>> as = fileSet.getAnnotations();
for (IPath f: as.keySet()) {
Set<IType> ts = as.get(f);