Author: scabanovich
Date: 2009-12-17 08:47:34 -0500 (Thu, 17 Dec 2009)
New Revision: 19420
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIAnnotation.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifier.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifierDeclaration.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScope.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScopeDeclaration.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIAnnotationElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierDeclaration.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeDeclaration.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeElement.java
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/IInterceptorBinding.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/InterceptorBindingElement.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/AnnotationDefinition.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
Log:
https://jira.jboss.org/jira/browse/JBIDE-4943
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-17
13:17:08 UTC (rev 19419)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java 2009-12-17
13:47:34 UTC (rev 19420)
@@ -16,6 +16,8 @@
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.cdi.internal.core.impl.QualifierElement;
+import org.jboss.tools.cdi.internal.core.impl.ScopeElement;
import org.jboss.tools.common.text.INodeReference;
/**
@@ -125,6 +127,23 @@
public InterceptorBindingElement getInterceptorBinding(String qualifiedName);
/**
+ * Returns qualifier model element for fully qualified name
+ * of qualifier annotation type
+ * @param qualifiedName
+ * @return Returns qualifier model element for fully qualified name
+ * of qualifier annotation type
+ */
+ public QualifierElement getQualifier(String qualifiedName);
+
+ /**
+ * 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
+ */
+ public ScopeElement getScope(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/core/ICDIAnnotation.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIAnnotation.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIAnnotation.java 2009-12-17
13:47:34 UTC (rev 19420)
@@ -0,0 +1,17 @@
+package org.jboss.tools.cdi.core;
+
+import org.eclipse.jdt.core.IType;
+
+/**
+ * Common interface for qualifier, stereotype, intercepror binding and scope objects.
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public interface ICDIAnnotation extends ICDIElement {
+
+ public IType getSourceType();
+
+ public IAnnotationDeclaration getInheritedDeclaration();
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIAnnotation.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInterceptorBinding.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInterceptorBinding.java 2009-12-17
13:17:08 UTC (rev 19419)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInterceptorBinding.java 2009-12-17
13:47:34 UTC (rev 19420)
@@ -19,7 +19,7 @@
*
* @author Alexey Kazakov
*/
-public interface IInterceptorBinding extends ICDIElement {
+public interface IInterceptorBinding extends ICDIAnnotation {
/**
* Returns the corresponding IType of the interceptor binding.
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifier.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifier.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifier.java 2009-12-17
13:47:34 UTC (rev 19420)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.core;
+
+/**
+ * Represents an interceptor binding type.
+ *
+ * @author Viacheslav Kabanovich
+ */
+public interface IQualifier extends ICDIAnnotation {
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifier.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifierDeclaration.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifierDeclaration.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifierDeclaration.java 2009-12-17
13:47:34 UTC (rev 19420)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.core;
+
+/**
+ * Represents a qualifier declaration.
+ *
+ * @author Viacheslav Kabanovich
+ */
+public interface IQualifierDeclaration extends IAnnotationDeclaration {
+
+ /**
+ * Returns the corresponding stereotype.
+ *
+ * @return the corresponding stereotype.
+ */
+ IQualifier getQualifier();
+}
\ No newline at end of file
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifierDeclaration.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScope.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScope.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScope.java 2009-12-17
13:47:34 UTC (rev 19420)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.core;
+
+/**
+ * Represents an interceptor binding type.
+ *
+ * @author Viacheslav Kabanovich
+ */
+public interface IScope extends ICDIAnnotation {
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScope.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScopeDeclaration.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScopeDeclaration.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScopeDeclaration.java 2009-12-17
13:47:34 UTC (rev 19420)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.core;
+
+/**
+ * Represents a qualifier declaration.
+ *
+ * @author Viacheslav Kabanovich
+ */
+public interface IScopeDeclaration extends IAnnotationDeclaration {
+
+ /**
+ * Returns the corresponding stereotype.
+ *
+ * @return the corresponding stereotype.
+ */
+ IScope getScope();
+}
\ No newline at end of file
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScopeDeclaration.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIAnnotationElement.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIAnnotationElement.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIAnnotationElement.java 2009-12-17
13:47:34 UTC (rev 19420)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * 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.eclipse.jdt.core.IType;
+import org.jboss.tools.cdi.core.IAnnotationDeclaration;
+import org.jboss.tools.cdi.core.ICDIAnnotation;
+import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationDefinition;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class CDIAnnotationElement extends CDIElement implements ICDIAnnotation {
+ protected AnnotationDefinition definition;
+
+ public CDIAnnotationElement() {}
+
+ public void setDefinition(AnnotationDefinition definition) {
+ this.definition = definition;
+ }
+
+ public IType getSourceType() {
+ return definition.getType();
+ }
+
+ public IAnnotationDeclaration getInheritedDeclaration() {
+ return definition.getInheritedAnnotation();
+ }
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIAnnotationElement.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-17
13:17:08 UTC (rev 19419)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2009-12-17
13:47:34 UTC (rev 19420)
@@ -50,6 +50,8 @@
private Map<String, StereotypeElement> stereotypes = new HashMap<String,
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>();
private Map<IPath, Set<IBean>> beansByPath = new HashMap<IPath,
Set<IBean>>();
private Map<String, Set<IBean>> beansByName = new HashMap<String,
Set<IBean>>();
@@ -340,6 +342,14 @@
return interceptorBindings.get(qualifiedName);
}
+ public QualifierElement getQualifier(String qualifiedName) {
+ return qualifiers.get(qualifiedName);
+ }
+
+ public ScopeElement getScope(String qualifiedName) {
+ return scopes.get(qualifiedName);
+ }
+
public void update() {
rebuildAnnotationTypes();
rebuildBeans();
@@ -349,30 +359,39 @@
void rebuildAnnotationTypes() {
stereotypes.clear();
interceptorBindings.clear();
+ qualifiers.clear();
+ scopes.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);
- IPath r = d.getType().getPath();
- if(r != null) {
- s.setSourcePath(r);
- }
+ initAnnotationElement(s, d);
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);
- }
+ initAnnotationElement(s, d);
interceptorBindings.put(d.getQualifiedName(), s);
+ } else if(d.getKind() == AnnotationDefinition.QUALIFIER) {
+ QualifierElement s = new QualifierElement();
+ initAnnotationElement(s, d);
+ qualifiers.put(d.getQualifiedName(), s);
+ } else if(d.getKind() == AnnotationDefinition.SCOPE) {
+ ScopeElement s = new ScopeElement();
+ initAnnotationElement(s, d);
+ scopes.put(d.getQualifiedName(), s);
}
}
}
+ private void initAnnotationElement(CDIAnnotationElement s, AnnotationDefinition d) {
+ s.setDefinition(d);
+ s.setParent(this);
+ IPath r = d.getType().getPath();
+ if(r != null) {
+ s.setSourcePath(r);
+ }
+ }
+
void rebuildBeans() {
synchronized (beansByPath) {
beansByPath.clear();
@@ -404,6 +423,9 @@
}
}
System.out.println("Project=" + getNature().getProject());
+ System.out.println("Qualifiers=" + qualifiers.size());
+ System.out.println("Stereotypes=" + stereotypes.size());
+ System.out.println("Scopes=" + scopes.size());
System.out.println("Named beans=" + beansByName.size());
System.out.println("Bean paths=" + beansByPath.size());
}
Modified:
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 2009-12-17
13:17:08 UTC (rev 19419)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingElement.java 2009-12-17
13:47:34 UTC (rev 19420)
@@ -17,22 +17,16 @@
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;
/**
*
* @author Viacheslav Kabanovich
*
*/
-public class InterceptorBindingElement extends CDIElement implements IInterceptorBinding
{
- AnnotationDefinition definition;
+public class InterceptorBindingElement extends CDIAnnotationElement implements
IInterceptorBinding {
public InterceptorBindingElement() {}
- public void setDefinition(AnnotationDefinition definition) {
- this.definition = definition;
- }
-
public Set<IInterceptorBindingDeclaration> getInterceptorBindingDeclarations() {
Set<IInterceptorBindingDeclaration> result = new
HashSet<IInterceptorBindingDeclaration>();
List<AnnotationDeclaration> as = definition.getAnnotations();
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierDeclaration.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierDeclaration.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierDeclaration.java 2009-12-17
13:47:34 UTC (rev 19420)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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.IQualifier;
+import org.jboss.tools.cdi.core.IQualifierDeclaration;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class QualifierDeclaration extends AnnotationDeclaration implements
IQualifierDeclaration {
+
+ public QualifierDeclaration() {}
+
+ public QualifierDeclaration(AnnotationDeclaration d) {
+ d.copyTo(this);
+ }
+
+ public IQualifier getQualifier() {
+ return project.getDelegate().getQualifier(getTypeName());
+ }
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierDeclaration.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierElement.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierElement.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierElement.java 2009-12-17
13:47:34 UTC (rev 19420)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.IQualifier;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class QualifierElement extends CDIAnnotationElement implements IQualifier {
+
+ public QualifierElement() {}
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierElement.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeDeclaration.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeDeclaration.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeDeclaration.java 2009-12-17
13:47:34 UTC (rev 19420)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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.IScope;
+import org.jboss.tools.cdi.core.IScopeDeclaration;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class ScopeDeclaration extends AnnotationDeclaration implements IScopeDeclaration
{
+
+ public ScopeDeclaration() {}
+
+ public ScopeDeclaration(AnnotationDeclaration d) {
+ d.copyTo(this);
+ }
+
+ public IScope getScope() {
+ return project.getDelegate().getScope(getTypeName());
+ }
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeDeclaration.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeElement.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeElement.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeElement.java 2009-12-17
13:47:34 UTC (rev 19420)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.IScope;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class ScopeElement extends CDIAnnotationElement implements IScope {
+
+ public ScopeElement() {}
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeElement.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-17
13:17:08 UTC (rev 19419)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java 2009-12-17
13:47:34 UTC (rev 19420)
@@ -16,27 +16,20 @@
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IType;
-import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.cdi.core.IInterceptorBindingDeclaration;
import org.jboss.tools.cdi.core.IStereotype;
import org.jboss.tools.cdi.core.IStereotypeDeclaration;
-import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationDefinition;
/**
*
* @author Viacheslav Kabanovich
*
*/
-public class StereotypeElement extends CDIElement implements IStereotype {
- AnnotationDefinition definition;
+public class StereotypeElement extends CDIAnnotationElement implements IStereotype {
public StereotypeElement() {}
- public void setDefinition(AnnotationDefinition definition) {
- this.definition = definition;
- }
-
public AnnotationDeclaration getAlternativeDeclaration() {
return definition.getAlternativeAnnotation();
}
@@ -60,10 +53,6 @@
return getNameDeclaration() != null ? getNameDeclaration().getDeclaration() : null;
}
- public IType getSourceType() {
- return definition.getType();
- }
-
public Set<IStereotypeDeclaration> getStereotypeDeclarations() {
Set<IStereotypeDeclaration> result = new
HashSet<IStereotypeDeclaration>();
for (AnnotationDeclaration d: definition.getAnnotations()) {
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-17
13:17:08 UTC (rev 19419)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java 2009-12-17
13:47:34 UTC (rev 19420)
@@ -23,6 +23,8 @@
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.QualifierDeclaration;
+import org.jboss.tools.cdi.internal.core.impl.ScopeDeclaration;
import org.jboss.tools.cdi.internal.core.impl.StereotypeDeclaration;
/**
@@ -52,13 +54,20 @@
AnnotationDeclaration a = new AnnotationDeclaration();
a.setProject(context.getProject());
a.setDeclaration(ts[i], contextType);
- if(context.getAnnotationKind(a.getType()) == AnnotationDefinition.STEREOTYPE) {
+ int kind = context.getAnnotationKind(a.getType());
+ if(kind == AnnotationDefinition.STEREOTYPE) {
a = new StereotypeDeclaration(a);
- } else if(context.getAnnotationKind(a.getType()) ==
AnnotationDefinition.INTERCEPTOR_BINDING) {
+ } else if(kind == AnnotationDefinition.INTERCEPTOR_BINDING) {
a = new InterceptorBindingDeclaration(a);
+ } else if(kind == AnnotationDefinition.QUALIFIER) {
+ a = new QualifierDeclaration(a);
+ } else if(kind == AnnotationDefinition.SCOPE) {
+ a = new ScopeDeclaration(a);
}
annotations.add(a);
- annotationsByType.put(a.getTypeName(), a);
+ if(a.getTypeName() != null) {
+ annotationsByType.put(a.getTypeName(), a);
+ }
}
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationDefinition.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationDefinition.java 2009-12-17
13:17:08 UTC (rev 19419)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationDefinition.java 2009-12-17
13:47:34 UTC (rev 19420)
@@ -75,4 +75,8 @@
}
}
+ public AnnotationDeclaration getInheritedAnnotation() {
+ return annotationsByType.get(CDIConstants.INHERITED_ANNOTATION_TYPE_NAME);
+ }
+
}
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-17
13:17:08 UTC (rev 19419)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationHelper.java 2009-12-17
13:47:34 UTC (rev 19420)
@@ -24,6 +24,7 @@
public static final Set<String> BASIC_ANNOTATION_TYPES = new
HashSet<String>();
public static final Set<String> CDI_ANNOTATION_TYPES = new
HashSet<String>();
public static final Set<String> SCOPE_ANNOTATION_TYPES = new
HashSet<String>();
+ public static final Set<String> QUALIFIER_ANNOTATION_TYPES = new
HashSet<String>();
public static final Set<String> STEREOTYPE_ANNOTATION_TYPES = new
HashSet<String>();
static {
@@ -44,11 +45,12 @@
STEREOTYPE_ANNOTATION_TYPES.add(DECORATOR_STEREOTYPE_TYPE_NAME);
STEREOTYPE_ANNOTATION_TYPES.add(DELEGATE_STEREOTYPE_TYPE_NAME);
+ QUALIFIER_ANNOTATION_TYPES.add(ANY_QUALIFIER_TYPE_NAME);
+ QUALIFIER_ANNOTATION_TYPES.add(DEFAULT_QUALIFIER_TYPE_NAME);
+ QUALIFIER_ANNOTATION_TYPES.add(NEW_QUALIFIER_TYPE_NAME);
+ QUALIFIER_ANNOTATION_TYPES.add(NAMED_QUALIFIER_TYPE_NAME);
+
CDI_ANNOTATION_TYPES.add(QUALIFIER_ANNOTATION_TYPE_NAME);
- CDI_ANNOTATION_TYPES.add(NAMED_QUALIFIER_TYPE_NAME);
- CDI_ANNOTATION_TYPES.add(ANY_QUALIFIER_TYPE_NAME);
- CDI_ANNOTATION_TYPES.add(DEFAULT_QUALIFIER_TYPE_NAME);
- CDI_ANNOTATION_TYPES.add(NEW_QUALIFIER_TYPE_NAME);
CDI_ANNOTATION_TYPES.add(STEREOTYPE_ANNOTATION_TYPE_NAME);
CDI_ANNOTATION_TYPES.add(TYPED_ANNOTATION_TYPE_NAME);
CDI_ANNOTATION_TYPES.add(PRODUCES_ANNOTATION_TYPE_NAME);
@@ -62,6 +64,7 @@
CDI_ANNOTATION_TYPES.addAll(SCOPE_ANNOTATION_TYPES);
CDI_ANNOTATION_TYPES.addAll(STEREOTYPE_ANNOTATION_TYPES);
+ CDI_ANNOTATION_TYPES.addAll(QUALIFIER_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-17
13:17:08 UTC (rev 19419)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java 2009-12-17
13:47:34 UTC (rev 19420)
@@ -159,6 +159,10 @@
createAnnotation(annotationType, name);
return AnnotationDefinition.STEREOTYPE;
}
+ if(AnnotationHelper.QUALIFIER_ANNOTATION_TYPES.contains(name)) {
+ createAnnotation(annotationType, name);
+ return AnnotationDefinition.QUALIFIER;
+ }
if(AnnotationHelper.BASIC_ANNOTATION_TYPES.contains(name)) {
return AnnotationDefinition.BASIC;
}