Author: scabanovich
Date: 2011-06-29 19:30:20 -0400 (Wed, 29 Jun 2011)
New Revision: 32485
Removed:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IJavaAnnotation.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotationLiteral.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/JavaAnnotation.java
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/definition/AbstractMemberDefinition.java
Log:
JBIDE-5046
https://issues.jboss.org/browse/JBIDE-5046
Deleted:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IJavaAnnotation.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IJavaAnnotation.java 2011-06-29
23:29:00 UTC (rev 32484)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IJavaAnnotation.java 2011-06-29
23:30:20 UTC (rev 32485)
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IMemberValuePair;
-import org.eclipse.jdt.core.IType;
-import org.jboss.tools.common.text.ITextSourceReference;
-
-/**
- * Hides IAnnotation and allows to subtitute another implementation than wrapper for
IAnnotation.
- *
- * @author Viacheslav Kabanovich
- *
- */
-public interface IJavaAnnotation extends ITextSourceReference {
-
- /**
- * Returns resource that declares this annotation.
- *
- * @return resource that declares this annotation
- */
- public IResource getResource();
-
- /**
- * Returns fully qualified type name if resolved or element name otherwise.
- *
- * @return fully qualified type name if resolved or element name otherwise
- */
- public String getTypeName();
-
- /**
- * Returns annotation type or null if it cannot be resolved.
- *
- * @return annotation type or null if it cannot be resolved
- */
- public IType getType();
- /**
- * Returns Java element on which or for which this annotation was created.
- *
- * @return Java element on which or for which this annotation was created
- */
- public IMember getParentMember();
-
- /**
- * Returns member value pairs as IAnnotation does.
- *
- * @return member value pairs as IAnnotation does
- */
- public IMemberValuePair[] getMemberValuePairs();
-
-}
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 2011-06-29
23:29:00 UTC (rev 32484)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotationDeclaration.java 2011-06-29
23:30:20 UTC (rev 32485)
@@ -17,8 +17,9 @@
import org.eclipse.jdt.core.IType;
import org.jboss.tools.cdi.core.CDICoreNature;
import org.jboss.tools.cdi.core.ICDIAnnotation;
-import org.jboss.tools.cdi.core.IJavaAnnotation;
import org.jboss.tools.common.java.IAnnotationDeclaration;
+import org.jboss.tools.common.java.IJavaAnnotation;
+import org.jboss.tools.common.java.impl.JavaAnnotation;
/**
*
Deleted:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotationLiteral.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotationLiteral.java 2011-06-29
23:29:00 UTC (rev 32484)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotationLiteral.java 2011-06-29
23:30:20 UTC (rev 32485)
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.core.resources.IResource;
-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.SourceRange;
-import org.eclipse.jdt.internal.core.MemberValuePair;
-import org.jboss.tools.cdi.core.IJavaAnnotation;
-
-public class AnnotationLiteral implements IJavaAnnotation {
- IResource declaringResource;
- IType annotationType;
-
- String source;
- ISourceRange range;
- IMemberValuePair[] memberValues = new IMemberValuePair[0];
-
- public AnnotationLiteral(IResource declaringResource, String source, ISourceRange range,
IMemberValuePair[] memberValues, IType annotationType) {
- this.declaringResource = declaringResource;
- this.source = source;
- this.range = range;
- this.memberValues = memberValues;
- this.annotationType = annotationType;
- }
-
- public AnnotationLiteral(IResource declaringResource, int offset, int length, Object
value, int valueType, IType annotationType) {
- this.declaringResource = declaringResource;
- this.range = new SourceRange(offset, length);
- if(value != null) {
- this.memberValues = new IMemberValuePair[]{
- createPair("value", value, valueType)
- };
- }
- this.annotationType = annotationType;
- }
-
- public void addMemberValuePair(String name, Object value, int valueType) {
- IMemberValuePair[] pairs = new IMemberValuePair[memberValues.length + 1];
- System.arraycopy(memberValues, 0, pairs, 0, memberValues.length);
- pairs[memberValues.length] = createPair(name, value, valueType);
- memberValues = pairs;
- }
-
- private IMemberValuePair createPair(String name, Object value, int valueType) {
- return new MemberValuePair(name, value, valueType);
- }
-
- public int getStartPosition() {
- return range == null ? -1 : range.getOffset();
- }
-
- public int getLength() {
- return range == null ? -1 : range.getLength();
- }
-
- public IResource getResource() {
- return declaringResource;
- }
-
- public String getTypeName() {
- if(annotationType != null) return annotationType.getFullyQualifiedName();
- return null;
- }
-
- public IType getType() {
- return annotationType;
- }
-
- public IMember getParentMember() {
- //Do we need it?
- return null;
- }
-
- public IMemberValuePair[] getMemberValuePairs() {
- return memberValues;
- }
-
-}
Deleted:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/JavaAnnotation.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/JavaAnnotation.java 2011-06-29
23:29:00 UTC (rev 32484)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/JavaAnnotation.java 2011-06-29
23:30:20 UTC (rev 32485)
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.core.resources.IResource;
-import org.eclipse.jdt.core.IAnnotation;
-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.CDICorePlugin;
-import org.jboss.tools.cdi.core.IJavaAnnotation;
-import org.jboss.tools.common.model.util.EclipseJavaUtil;
-
-public class JavaAnnotation implements IJavaAnnotation {
- IAnnotation annotation;
-
- String annotationTypeName;
- IType type;
-
- public JavaAnnotation(IAnnotation annotation, IType declaringType) {
- this.annotation = annotation;
- try {
- String name = annotation.getElementName();
- annotationTypeName = EclipseJavaUtil.resolveType(declaringType, name);
- type = EclipseJavaUtil.findType(annotation.getJavaProject(), annotationTypeName);
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
- }
- }
-
- public IResource getResource() {
- return annotation.getResource();
- }
-
- public String getTypeName() {
- return annotationTypeName;
- }
-
- public IType getType() {
- return type;
- }
-
- public int getLength() {
- try {
- ISourceRange range = annotation.getSourceRange();
- if(range != null) {
- return range.getLength();
- }
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
- }
- return 0;
- }
-
- public int getStartPosition() {
- try {
- ISourceRange range = annotation.getSourceRange();
- if(range != null) {
- return range.getOffset();
- }
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
- }
- return 0;
- }
-
- public IMember getParentMember() {
- return (IMember)annotation.getParent();
- }
-
- public IMemberValuePair[] getMemberValuePairs() {
- try {
- return annotation.getMemberValuePairs();
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
- }
- return new IMemberValuePair[0];
- }
-
- public IAnnotation getAnnotation() {
- return annotation;
- }
-
-}
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 2011-06-29
23:29:00 UTC (rev 32484)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java 2011-06-29
23:30:20 UTC (rev 32485)
@@ -27,16 +27,16 @@
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDICoreNature;
import org.jboss.tools.cdi.core.CDICorePlugin;
-import org.jboss.tools.cdi.core.IJavaAnnotation;
import org.jboss.tools.cdi.core.IRootDefinitionContext;
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.JavaAnnotation;
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;
import org.jboss.tools.common.java.IAnnotated;
import org.jboss.tools.common.java.IAnnotationDeclaration;
+import org.jboss.tools.common.java.IJavaAnnotation;
+import org.jboss.tools.common.java.impl.JavaAnnotation;
import org.jboss.tools.common.text.ITextSourceReference;
/**