JBoss Tools SVN: r30196 - in trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi: internal/core/impl and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-03-31 18:16:06 -0400 (Thu, 31 Mar 2011)
New Revision: 30196
Added:
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
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParameterDefinition.java
Log:
JBIDE-3120
https://issues.jboss.org/browse/JBIDE-3120
Removed org.eclipse.jdt.core.IAnnotation from CDI interfaces.
IAnnotationDeclaration implementation should handle it or work without it when annotation info is provided by non-java sources.
Added: 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 (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IJavaAnnotation.java 2011-03-31 22:16:06 UTC (rev 30196)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * 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.
+ *
+ * @return annotation type
+ */
+ 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();
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IJavaAnnotation.java
___________________________________________________________________
Added: 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 2011-03-31 20:11:36 UTC (rev 30195)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotationDeclaration.java 2011-03-31 22:16:06 UTC (rev 30196)
@@ -14,14 +14,11 @@
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.CDICoreNature;
-import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.cdi.core.ICDIAnnotation;
-import org.jboss.tools.common.model.util.EclipseJavaUtil;
+import org.jboss.tools.cdi.core.IJavaAnnotation;
/**
*
@@ -30,104 +27,49 @@
*/
public class AnnotationDeclaration implements IAnnotationDeclaration {
protected CDICoreNature project;
- protected IAnnotation annotation;
- protected int startPosition = -1;
- protected int length = 0;
- protected String annotationTypeName = null;
- protected IType type = null;
+ protected IJavaAnnotation annotation;
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) {
+ public void setDeclaration(IJavaAnnotation annotation) {
this.annotation = annotation;
- try {
- ISourceRange range = annotation.getSourceRange();
- if(range != null) {
- startPosition = range.getOffset();
- length = range.getLength();
- }
- String name = annotation.getElementName();
- annotationTypeName = EclipseJavaUtil.resolveType(declaringType, name);
- type = EclipseJavaUtil.findType(annotation.getJavaProject(), annotationTypeName);
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
- }
}
-// public IAnnotation getDeclaration() {
-// return annotation;
-// }
-
public IResource getResource() {
- if(annotation != null) {
- return annotation.getResource();
- }
- //TODO
- return null;
+ return annotation.getResource();
}
public IMemberValuePair[] getMemberValuePairs() {
- if(annotation != null) {
- try {
- return annotation.getMemberValuePairs();
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
- }
- }
- //
- return new IMemberValuePair[0];
+ return annotation.getMemberValuePairs();
}
-
public IMember getParentMember() {
- return (IMember)annotation.getParent();
+ return annotation.getParentMember();
}
public String getTypeName() {
- return annotationTypeName;
+ return annotation.getTypeName();
}
public IType getType() {
- return type;
+ return annotation.getType();
}
public int getLength() {
- //while annotation is available, it can be updated, we should take actual value.
- if(annotation != null) try {
- ISourceRange range = annotation.getSourceRange();
- if(range != null) {
- return length = range.getLength();
- }
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
- }
- return length;
+ return annotation.getLength();
}
public int getStartPosition() {
- //while annotation is available, it can be updated, we should take actual value.
- if(annotation != null) try {
- ISourceRange range = annotation.getSourceRange();
- if(range != null) {
- return startPosition = range.getOffset();
- }
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
- }
- return startPosition;
+ return annotation.getStartPosition();
}
/*
Added: 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 (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotationLiteral.java 2011-03-31 22:16:06 UTC (rev 30196)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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.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 int getStartPosition() {
+ return range == null ? -1 : range.getOffset();
+ }
+
+ public int getLength() {
+ return range == null ? -1 : range.getLength();
+ }
+
+ public IResource getResource() {
+ return declaringResource;
+ }
+
+ @Override
+ public String getTypeName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IType getType() {
+ return annotationType;
+ }
+
+ public IMember getParentMember() {
+ //Do we need it?
+ return null;
+ }
+
+ public IMemberValuePair[] getMemberValuePairs() {
+ return memberValues;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotationLiteral.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: 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 (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/JavaAnnotation.java 2011-03-31 22:16:06 UTC (rev 30196)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * 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;
+ protected int startPosition = -1;
+ protected int length = 0;
+
+ 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 length = range.getLength();
+ }
+ } catch (JavaModelException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
+ return length;
+ }
+
+ public int getStartPosition() {
+ try {
+ ISourceRange range = annotation.getSourceRange();
+ if(range != null) {
+ return startPosition = range.getOffset();
+ }
+ } catch (JavaModelException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
+ return startPosition;
+ }
+
+ 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];
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/JavaAnnotation.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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-03-31 20:11:36 UTC (rev 30195)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java 2011-03-31 22:16:06 UTC (rev 30196)
@@ -28,6 +28,7 @@
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
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;
@@ -81,7 +82,7 @@
for (int i = 0; i < ts.length; i++) {
AnnotationDeclaration a = new AnnotationDeclaration();
a.setProject(context.getProject());
- a.setDeclaration(ts[i], contextType);
+ a.setDeclaration(new JavaAnnotation(ts[i], contextType));
AnnotationDeclaration b = null;
int kind = context.getAnnotationKind(a.getType());
if(kind > 0 && (kind & AnnotationDefinition.STEREOTYPE) > 0) {
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParameterDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParameterDefinition.java 2011-03-31 20:11:36 UTC (rev 30195)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParameterDefinition.java 2011-03-31 22:16:06 UTC (rev 30196)
@@ -21,6 +21,7 @@
import org.jboss.tools.cdi.core.IAnnotated;
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.cdi.internal.core.impl.AnnotationDeclaration;
+import org.jboss.tools.cdi.internal.core.impl.JavaAnnotation;
import org.jboss.tools.cdi.internal.core.impl.ParametedType;
import org.jboss.tools.common.text.ITextSourceReference;
@@ -61,7 +62,9 @@
}
// JDT doesn't have API for annotations for method params. So let's wrap ITextSourceReference into IAnnotationDeclaration.
AnnotationDeclaration ad = new AnnotationDeclaration();
- ad.setDeclaration(null, methodDefinition.getMethod().getDeclaringType());
+ //TODO it should be annotation literal!
+ System.out.println("!!!!!!!!!!!!!Here we are!!!!!!!!");
+ ad.setDeclaration(new JavaAnnotation(null, methodDefinition.getMethod().getDeclaringType()));
CDICoreNature nature = CDICorePlugin.getCDI(methodDefinition.getResource().getProject(), false);
ad.setProject(nature);
return ad;
13 years, 8 months
JBoss Tools SVN: r30195 - trunk/cdi/plugins/org.jboss.tools.cdi.solder.core/src/org/jboss/tools/cdi/solder/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-03-31 16:11:36 -0400 (Thu, 31 Mar 2011)
New Revision: 30195
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.solder.core/src/org/jboss/tools/cdi/solder/core/BeanNameFeature.java
Log:
JBIDE-3120
https://issues.jboss.org/browse/JBIDE-3120
Removed org.eclipse.jdt.core.IAnnotation from CDI interfaces.
IAnnotationDeclaration implementation should handle it or work without it when annotation info is provided by non-java sources.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.solder.core/src/org/jboss/tools/cdi/solder/core/BeanNameFeature.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.solder.core/src/org/jboss/tools/cdi/solder/core/BeanNameFeature.java 2011-03-31 20:11:17 UTC (rev 30194)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.solder.core/src/org/jboss/tools/cdi/solder/core/BeanNameFeature.java 2011-03-31 20:11:36 UTC (rev 30195)
@@ -12,14 +12,11 @@
import java.beans.Introspector;
-import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IMemberValuePair;
-import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDIUtil;
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.cdi.core.IBean;
-import org.jboss.tools.cdi.core.ICDIAnnotation;
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.IProducerField;
import org.jboss.tools.cdi.core.IProducerMethod;
@@ -77,22 +74,18 @@
return null;
}
- private String getStringValue(IAnnotation a) {
+ private String getStringValue(IAnnotationDeclaration a) {
if(a == null) return null;
- try {
- IMemberValuePair[] ps = a.getMemberValuePairs();
- if(ps != null && ps.length > 0 && ps[0].getValue() != null) {
- return ps[0].getValue().toString();
- }
- } catch (JavaModelException e) {
- CDISolderCorePlugin.getDefault().logError(e);
+ IMemberValuePair[] ps = a.getMemberValuePairs();
+ if(ps != null && ps.length > 0 && ps[0].getValue() != null) {
+ return ps[0].getValue().toString();
}
return null;
}
private String resolvePackageName(AnnotationDeclaration fullyQualified, AnnotationDeclaration fullyQualifiedOnPackage, AbstractTypeDefinition t, PackageDefinition p) {
String contextClass = null;
- IAnnotation a = fullyQualified != null ? fullyQualified.getDeclaration() : fullyQualifiedOnPackage.getDeclaration();
+ AnnotationDeclaration a = fullyQualified != null ? fullyQualified : fullyQualifiedOnPackage;
contextClass = getStringValue(a);
if(contextClass == null) {
contextClass = t == null ? "" : t.getQualifiedName();
@@ -109,7 +102,7 @@
private String getSimpleBeanName(IBean bean, IAnnotationDeclaration named) {
String simpleName = null;
if(named != null) {
- simpleName = getStringValue(named.getDeclaration());
+ simpleName = getStringValue(named);
}
if(simpleName != null && simpleName.length() > 0) {
//do nothing
13 years, 8 months
JBoss Tools SVN: r30194 - trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-03-31 16:11:17 -0400 (Thu, 31 Mar 2011)
New Revision: 30194
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InterceptorDefinitionTest.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java
Log:
JBIDE-3120
https://issues.jboss.org/browse/JBIDE-3120
Removed org.eclipse.jdt.core.IAnnotation from CDI interfaces.
IAnnotationDeclaration implementation should handle it or work without it when annotation info is provided by non-java sources.
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InterceptorDefinitionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InterceptorDefinitionTest.java 2011-03-31 20:10:12 UTC (rev 30193)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InterceptorDefinitionTest.java 2011-03-31 20:11:17 UTC (rev 30194)
@@ -11,12 +11,12 @@
package org.jboss.tools.cdi.core.test.tck;
+
import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IMemberValuePair;
import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.cdi.core.IBean;
@@ -126,8 +126,7 @@
void assertContainsBindingDeclarationWithValue(Set<IInterceptorBindingDeclaration> bs, String className, String value) throws JavaModelException {
for (IInterceptorBindingDeclaration b: bs) {
if(className.equals(b.getInterceptorBinding().getSourceType().getFullyQualifiedName())) {
- IAnnotation a = b.getDeclaration();
- IMemberValuePair[] ps = a.getMemberValuePairs();
+ IMemberValuePair[] ps = b.getMemberValuePairs();
for (IMemberValuePair p: ps) {
if(p.getMemberName().equals("value")) {
assertEquals(value, p.getValue());
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java 2011-03-31 20:10:12 UTC (rev 30193)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java 2011-03-31 20:11:17 UTC (rev 30194)
@@ -17,6 +17,7 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMemberValuePair;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.cdi.core.CDICorePlugin;
@@ -159,8 +160,7 @@
Set<IQualifierDeclaration> declarations = bean.getQualifierDeclarations();
IParametedType type = getType(annotationTypeName);
for (IQualifierDeclaration declaration : declarations) {
- IAnnotation annotation = declaration.getDeclaration();
- if(type.getType().getElementName().equals(annotation.getElementName())) {
+ if(declaration.getType() != null && type.getType().getElementName().equals(declaration.getType().getElementName())) {
return declaration;
}
}
@@ -200,6 +200,17 @@
public ICDIAnnotation getAnnotation() {
return null;
}
+
+ public IMemberValuePair[] getMemberValuePairs() {
+ if(annotation != null) {
+ try {
+ return annotation.getMemberValuePairs();
+ } catch (JavaModelException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
+ }
+ return new IMemberValuePair[0];
+ }
};
return annotationDeclaration;
}
13 years, 8 months
JBoss Tools SVN: r30193 - in trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi: core/extension/feature and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-03-31 16:10:12 -0400 (Thu, 31 Mar 2011)
New Revision: 30193
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IVetoFeature.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotationDeclaration.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IBeanNameFeature.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/AnnotationDeclaration.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/validation/AnnotationValidationDelegate.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
Log:
JBIDE-3120
https://issues.jboss.org/browse/JBIDE-3120
Removed org.eclipse.jdt.core.IAnnotation from CDI interfaces.
IAnnotationDeclaration implementation should handle it or work without it when annotation info is provided by non-java sources.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2011-03-31 19:48:45 UTC (rev 30192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2011-03-31 20:10:12 UTC (rev 30193)
@@ -1047,7 +1047,7 @@
*/
public static Set<String> getTargetAnnotationValues(IAnnotationDeclaration target) throws JavaModelException {
Set<String> result = new HashSet<String>();
- IMemberValuePair[] ps = target.getDeclaration().getMemberValuePairs();
+ IMemberValuePair[] ps = target.getMemberValuePairs();
for (IMemberValuePair p: ps) {
if(!"value".equals(p.getMemberName())) continue;
Object o = p.getValue();
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotationDeclaration.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotationDeclaration.java 2011-03-31 19:48:45 UTC (rev 30192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotationDeclaration.java 2011-03-31 20:10:12 UTC (rev 30193)
@@ -10,8 +10,8 @@
******************************************************************************/
package org.jboss.tools.cdi.core;
-import org.eclipse.jdt.core.IAnnotation;
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;
@@ -28,8 +28,10 @@
*
* @return the annotation declaration.
*/
- IAnnotation getDeclaration();
+// IAnnotation getDeclaration();
+ IMemberValuePair[] getMemberValuePairs();
+
/**
* Returns the member which is annotated by this declaration.
*
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IBeanNameFeature.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IBeanNameFeature.java 2011-03-31 19:48:45 UTC (rev 30192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IBeanNameFeature.java 2011-03-31 20:10:12 UTC (rev 30193)
@@ -13,6 +13,9 @@
import org.jboss.tools.cdi.core.IBean;
/**
+ * This feature corresponds to runtime feature
+ * javax.enterprise.inject.spi.ProcessAnnotatedType.setAnnotatedType()
+ *
* This feature is invoked by bean when it computes its name.
* The first non-null value is accepted.
*
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IVetoFeature.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IVetoFeature.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IVetoFeature.java 2011-03-31 20:10:12 UTC (rev 30193)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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.extension.feature;
+
+/**
+ * This feature corresponds to runtime feature
+ * javax.enterprise.inject.spi.ProcessAnnotatedType.veto()
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public interface IVetoFeature {
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IVetoFeature.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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 2011-03-31 19:48:45 UTC (rev 30192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2011-03-31 20:10:12 UTC (rev 30193)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
+
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -19,10 +20,8 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
-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.Signature;
import org.jboss.tools.cdi.core.CDIConstants;
@@ -265,21 +264,21 @@
Set<ITypeDeclaration> result = new HashSet<ITypeDeclaration>();
AnnotationDeclaration typed = getDefinition().getTypedAnnotation();
if(typed != null) {
- IAnnotation a = typed.getDeclaration();
+ int s = typed.getStartPosition();
+ int l = typed.getLength();
try {
- ISourceRange r = a.getSourceRange();
String txt = null;
- if(r != null && a.getResource() instanceof IFile) {
+ if(s >= 0 && typed.getResource() instanceof IFile) {
AbstractTypeDefinition td = getDefinition().getTypeDefinition();
if(td != null) {
String content = td.getContent();
- if(content != null && content.length() > r.getOffset() + r.getLength()) {
- txt = content.substring(r.getOffset(), r.getOffset() + r.getLength());
+ if(content != null && content.length() > s + l) {
+ txt = content.substring(s, s + l);
}
}
}
- IMemberValuePair[] ps = a.getMemberValuePairs();
+ IMemberValuePair[] ps = typed.getMemberValuePairs();
if(ps == null || ps.length == 0) return result;
IMember member = (IMember)definition.getMember();
IType declaringType = member instanceof IType ? (IType)member : member.getDeclaringType();
@@ -297,7 +296,7 @@
if(txt != null) {
int q = txt.indexOf(rawTypeName);
if(q >= 0) {
- offset = r.getOffset() + q;
+ offset = s + q;
length = rawTypeName.length();
}
}
@@ -323,7 +322,7 @@
if(txt != null) {
int q = txt.indexOf(rawTypeName);
if(q >= 0) {
- offset = r.getOffset() + q;
+ offset = s + q;
length = rawTypeName.length();
}
}
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-03-31 19:48:45 UTC (rev 30192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotationDeclaration.java 2011-03-31 20:10:12 UTC (rev 30193)
@@ -10,8 +10,10 @@
******************************************************************************/
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;
@@ -65,10 +67,31 @@
}
}
- public IAnnotation getDeclaration() {
- return annotation;
+// public IAnnotation getDeclaration() {
+// return annotation;
+// }
+
+ public IResource getResource() {
+ if(annotation != null) {
+ return annotation.getResource();
+ }
+ //TODO
+ return null;
}
+ public IMemberValuePair[] getMemberValuePairs() {
+ if(annotation != null) {
+ try {
+ return annotation.getMemberValuePairs();
+ } catch (JavaModelException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
+ }
+ //
+ return new IMemberValuePair[0];
+ }
+
+
public IMember getParentMember() {
return (IMember)annotation.getParent();
}
@@ -82,10 +105,28 @@
}
public int getLength() {
+ //while annotation is available, it can be updated, we should take actual value.
+ if(annotation != null) try {
+ ISourceRange range = annotation.getSourceRange();
+ if(range != null) {
+ return length = range.getLength();
+ }
+ } catch (JavaModelException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
return length;
}
public int getStartPosition() {
+ //while annotation is available, it can be updated, we should take actual value.
+ if(annotation != null) try {
+ ISourceRange range = annotation.getSourceRange();
+ if(range != null) {
+ return startPosition = range.getOffset();
+ }
+ } catch (JavaModelException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
return startPosition;
}
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 2011-03-31 19:48:45 UTC (rev 30192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2011-03-31 20:10:12 UTC (rev 30193)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -27,7 +28,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IMemberValuePair;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
@@ -516,7 +516,7 @@
result.append(type.getFullyQualifiedName());
if(ms != null && ms.length > 0) {
TreeMap<String, String> values = new TreeMap<String, String>();
- IMemberValuePair[] ps = d.getDeclaration().getMemberValuePairs();
+ IMemberValuePair[] ps = d.getMemberValuePairs();
if (ps != null) for (IMemberValuePair p: ps) {
String n = p.getMemberName();
Object o = p.getValue();
@@ -732,17 +732,12 @@
if(a instanceof AnnotationDeclaration) {
AnnotationDeclaration aa = (AnnotationDeclaration)a;
if(CDIConstants.NORMAL_SCOPE_ANNOTATION_TYPE_NAME.equals(aa.getTypeName())) {
- IAnnotation ann = a.getDeclaration();
- try {
- IMemberValuePair[] ps = ann.getMemberValuePairs();
- if(ps != null) for (IMemberValuePair p: ps) {
- if("passivating".equals(p.getMemberName())) {
- Object o = p.getValue();
- return o != null && "true".equalsIgnoreCase(o.toString());
- }
+ IMemberValuePair[] ps = a.getMemberValuePairs();
+ if(ps != null) for (IMemberValuePair p: ps) {
+ if("passivating".equals(p.getMemberName())) {
+ Object o = p.getValue();
+ return o != null && "true".equalsIgnoreCase(o.toString());
}
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
}
return false;
}
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 2011-03-31 19:48:45 UTC (rev 30192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java 2011-03-31 20:10:12 UTC (rev 30193)
@@ -11,6 +11,7 @@
package org.jboss.tools.cdi.internal.core.impl;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -19,7 +20,6 @@
import java.util.Map;
import java.util.Set;
-import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IMemberValuePair;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
@@ -331,27 +331,18 @@
name = name.substring(0, 1).toLowerCase() + name.substring(1);
}
- 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();
- }
+ IMemberValuePair[] vs = named.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() {
- AnnotationDeclaration named = getDefinition().getNamedAnnotation();
- if(named != null) {
- return ValueInfo.getValueInfo(named.getDeclaration(), null);
- }
- return null;
+ return getDefinition().getNamedAnnotation();
}
public ClassBean getSpecializedBean() {
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 2011-03-31 19:48:45 UTC (rev 30192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerField.java 2011-03-31 20:10:12 UTC (rev 30193)
@@ -10,15 +10,13 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
+
import java.util.HashSet;
import java.util.Set;
-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.IInjectionPoint;
@@ -30,7 +28,6 @@
import org.jboss.tools.cdi.core.IStereotypeDeclaration;
import org.jboss.tools.cdi.core.ITypeDeclaration;
import org.jboss.tools.cdi.core.extension.feature.IBeanNameFeature;
-import org.jboss.tools.common.model.project.ext.impl.ValueInfo;
import org.jboss.tools.common.text.ITextSourceReference;
/**
@@ -106,29 +103,20 @@
if(named == null) return null;
String name = getField().getElementName();
- IAnnotation a = named.getDeclaration();
- try {
- IMemberValuePair[] vs = a.getMemberValuePairs();
- if(vs == null || vs.length == 0) {
- return name;
- } else {
- Object value = vs[0].getValue();
- if(value != null && value.toString().trim().length() > 0) {
- return value.toString().trim();
- }
+ IMemberValuePair[] vs = named.getMemberValuePairs();
+ if(vs == null || vs.length == 0) {
+ return name;
+ } else {
+ 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() {
- AnnotationDeclaration named = findNamedAnnotation();
- if(named != null) {
- return ValueInfo.getValueInfo(named.getDeclaration(), null);
- }
- return null;
+ return findNamedAnnotation();
}
public IBean getSpecializedBean() {
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 2011-03-31 19:48:45 UTC (rev 30192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java 2011-03-31 20:10:12 UTC (rev 30193)
@@ -10,15 +10,13 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
+
import java.util.HashSet;
import java.util.Set;
-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.IInjectionPoint;
import org.jboss.tools.cdi.core.IParametedType;
@@ -32,7 +30,6 @@
import org.jboss.tools.cdi.core.extension.feature.IBeanNameFeature;
import org.jboss.tools.cdi.internal.core.impl.definition.MethodDefinition;
import org.jboss.tools.cdi.internal.core.impl.definition.ParameterDefinition;
-import org.jboss.tools.common.model.project.ext.impl.ValueInfo;
import org.jboss.tools.common.text.ITextSourceReference;
import org.jboss.tools.common.util.BeanUtil;
@@ -136,31 +133,22 @@
String name = getMethod().getElementName();
- IAnnotation a = named.getDeclaration();
- try {
- IMemberValuePair[] vs = a.getMemberValuePairs();
- if(vs == null || vs.length == 0) {
- if(BeanUtil.isGetter(getMethod())) {
- return BeanUtil.getPropertyName(name);
- }
- } else {
- Object value = vs[0].getValue();
- if(value != null && value.toString().trim().length() > 0) {
- return value.toString().trim();
- }
+ IMemberValuePair[] vs = named.getMemberValuePairs();
+ if(vs == null || vs.length == 0) {
+ if(BeanUtil.isGetter(getMethod())) {
+ return BeanUtil.getPropertyName(name);
}
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
+ } else {
+ Object value = vs[0].getValue();
+ if(value != null && value.toString().trim().length() > 0) {
+ return value.toString().trim();
+ }
}
return name;
}
public ITextSourceReference getNameLocation() {
- AnnotationDeclaration named = findNamedAnnotation();
- if(named != null) {
- return ValueInfo.getValueInfo(named.getDeclaration(), null);
- }
- return null;
+ return findNamedAnnotation();
}
public void setSpecializedBean(ProducerMethod other) {
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/AnnotationValidationDelegate.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/AnnotationValidationDelegate.java 2011-03-31 19:48:45 UTC (rev 30192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/AnnotationValidationDelegate.java 2011-03-31 20:10:12 UTC (rev 30193)
@@ -190,7 +190,7 @@
if(retention == null) {
validator.addError(message, CDIPreferences.MISSING_OR_INCORRECT_TARGET_OR_RETENTION_IN_ANNOTATION_TYPE, CDIUtil.convertToSourceReference(type.getSourceType().getNameRange()), resource);
} else {
- IMemberValuePair[] ps = retention.getDeclaration().getMemberValuePairs();
+ IMemberValuePair[] ps = retention.getMemberValuePairs();
boolean ok = false;
for (IMemberValuePair p: ps) {
if(!"value".equals(p.getMemberName())) continue;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2011-03-31 19:48:45 UTC (rev 30192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2011-03-31 20:10:12 UTC (rev 30193)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.validation;
+
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
@@ -1322,21 +1323,17 @@
} else if (injection instanceof IInjectionPointMethod) {
IAnnotationDeclaration named = injection.getAnnotation(CDIConstants.NAMED_QUALIFIER_TYPE_NAME);
if (named != null) {
- try {
- IMemberValuePair[] values = named.getDeclaration().getMemberValuePairs();
- boolean valueExists = false;
- for (IMemberValuePair pair : values) {
- if ("value".equals(pair.getMemberName())) {
- valueExists = true;
- break;
- }
+ IMemberValuePair[] values = named.getMemberValuePairs();
+ boolean valueExists = false;
+ for (IMemberValuePair pair : values) {
+ if ("value".equals(pair.getMemberName())) {
+ valueExists = true;
+ break;
}
- if (!valueExists) {
- addError(CDIValidationMessages.PARAM_INJECTION_DECLARES_EMPTY_NAME, CDIPreferences.PARAM_INJECTION_DECLARES_EMPTY_NAME, named, injection.getResource());
- }
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
}
+ if (!valueExists) {
+ addError(CDIValidationMessages.PARAM_INJECTION_DECLARES_EMPTY_NAME, CDIPreferences.PARAM_INJECTION_DECLARES_EMPTY_NAME, named, injection.getResource());
+ }
}
IInjectionPointMethod injectionMethod = (IInjectionPointMethod)injection;
@@ -1737,30 +1734,27 @@
IScope scope = bean.getScope();
if(scope!=null && scope.isNorlmalScope()) {
IAnnotationDeclaration normalScopeDeclaration = scope.getAnnotationDeclaration(CDIConstants.NORMAL_SCOPE_ANNOTATION_TYPE_NAME);
- if(normalScopeDeclaration!=null) {
- IAnnotation annt = normalScopeDeclaration.getDeclaration();
- if(annt!=null) {
- boolean passivatingScope = false;
- IMemberValuePair[] pairs = annt.getMemberValuePairs();
- for (IMemberValuePair pair : pairs) {
- if("passivating".equals(pair.getMemberName()) && "true".equalsIgnoreCase("" + pair.getValue())) {
- passivatingScope = true;
+ if(normalScopeDeclaration != null) {
+ boolean passivatingScope = false;
+ IMemberValuePair[] pairs = normalScopeDeclaration.getMemberValuePairs();
+ for (IMemberValuePair pair : pairs) {
+ if("passivating".equals(pair.getMemberName()) && "true".equalsIgnoreCase("" + pair.getValue())) {
+ passivatingScope = true;
+ break;
+ }
+ }
+ if(passivatingScope) {
+ boolean passivatingCapable = false;
+ Set<IParametedType> supers = bean.getAllTypes();
+ for (IParametedType type : supers) {
+ if("java.io.Serializable".equals(type.getType().getFullyQualifiedName())) {
+ passivatingCapable = true;
break;
}
}
- if(passivatingScope) {
- boolean passivatingCapable = false;
- Set<IParametedType> supers = bean.getAllTypes();
- for (IParametedType type : supers) {
- if("java.io.Serializable".equals(type.getType().getFullyQualifiedName())) {
- passivatingCapable = true;
- break;
- }
- }
- if(!passivatingCapable) {
- ITextSourceReference reference = CDIUtil.convertToSourceReference(bean.getBeanClass().getNameRange());
- addError(MessageFormat.format(CDIValidationMessages.NOT_PASSIVATION_CAPABLE_BEAN, bean.getSimpleJavaName(), scope.getSourceType().getElementName()), CDIPreferences.NOT_PASSIVATION_CAPABLE_BEAN, reference, bean.getResource(), NOT_PASSIVATION_CAPABLE_BEAN_ID);
- }
+ if(!passivatingCapable) {
+ ITextSourceReference reference = CDIUtil.convertToSourceReference(bean.getBeanClass().getNameRange());
+ addError(MessageFormat.format(CDIValidationMessages.NOT_PASSIVATION_CAPABLE_BEAN, bean.getSimpleJavaName(), scope.getSourceType().getElementName()), CDIPreferences.NOT_PASSIVATION_CAPABLE_BEAN, reference, bean.getResource(), NOT_PASSIVATION_CAPABLE_BEAN_ID);
}
}
}
@@ -1832,31 +1826,27 @@
boolean markedAsWrong = false;
IAnnotationDeclaration target = binding.getAnnotationDeclaration(CDIConstants.TARGET_ANNOTATION_TYPE_NAME);
if(target!=null) {
- try {
- IMemberValuePair[] ps = target.getDeclaration().getMemberValuePairs();
- if (ps != null && ps.length==1) {
- IMemberValuePair pair = ps[0];
- Object value = pair.getValue();
- if(value != null && value instanceof Object[]) {
- Object[] values = (Object[]) value;
- if(values.length>1) {
- Set<IBeanMethod> methods = interceptor.getAllMethods();
- for (IBeanMethod method : methods) {
- if(method.isLifeCycleCallbackMethod()) {
- ITextSourceReference declaration = CDIUtil.getAnnotationDeclaration(interceptor, binding);
- if(declaration==null) {
- declaration = interceptor.getInterceptorAnnotation();
- }
- addError(CDIValidationMessages.ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING, CDIPreferences.ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING, declaration, interceptor.getResource());
- markedAsWrong = true;
- break;
+ IMemberValuePair[] ps = target.getMemberValuePairs();
+ if (ps != null && ps.length==1) {
+ IMemberValuePair pair = ps[0];
+ Object value = pair.getValue();
+ if(value != null && value instanceof Object[]) {
+ Object[] values = (Object[]) value;
+ if(values.length>1) {
+ Set<IBeanMethod> methods = interceptor.getAllMethods();
+ for (IBeanMethod method : methods) {
+ if(method.isLifeCycleCallbackMethod()) {
+ ITextSourceReference declaration = CDIUtil.getAnnotationDeclaration(interceptor, binding);
+ if(declaration==null) {
+ declaration = interceptor.getInterceptorAnnotation();
}
+ addError(CDIValidationMessages.ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING, CDIPreferences.ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING, declaration, interceptor.getResource());
+ markedAsWrong = true;
+ break;
}
}
}
}
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
}
}
if(markedAsWrong) {
@@ -2166,12 +2156,7 @@
// 1. non-empty name
IAnnotationDeclaration nameDeclaration = stereotype.getNameDeclaration();
if (nameDeclaration != null) {
- IMemberValuePair[] ps = null;
- try {
- ps = nameDeclaration.getDeclaration().getMemberValuePairs();
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
- }
+ IMemberValuePair[] ps = nameDeclaration.getMemberValuePairs();
if (ps != null && ps.length > 0) {
Object name = ps[0].getValue();
if (name != null && name.toString().length() > 0) {
13 years, 8 months
JBoss Tools SVN: r30192 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui: src/org/jboss/tools/deltacloud/ui/commands and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-03-31 15:48:45 -0400 (Thu, 31 Mar 2011)
New Revision: 30192
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java
Log:
[JBIDE-8660] enabled "Launch instance" in instance view even if no instance is selected (erroneously committed to JBIDE-8659 before)
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-31 19:47:58 UTC (rev 30191)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-31 19:48:45 UTC (rev 30192)
@@ -1,7 +1,7 @@
2011-03-31 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
* src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java:
- * plugin.xml:
+ * plugin.xml:
[JBIDE-8659] enabled "Launch instance" in instance view even if no instance is selected
* plugin.xml:
[JBIDE-8655] added "Launch instance" to context menu and toolbar in instance view
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2011-03-31 19:47:58 UTC (rev 30191)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2011-03-31 19:48:45 UTC (rev 30192)
@@ -258,7 +258,7 @@
class="org.jboss.tools.deltacloud.ui.commands.CreateInstanceFromAnyImageHandler"
commandId="org.jboss.tools.deltacloud.ui.createinstanceFromAnyImage">
<enabledWhen>
- <or>
+ <or>
<with
variable="selection">
<and>
@@ -272,11 +272,11 @@
</iterate>
</and>
</with>
- <with
- variable="activePart">
- <instanceof value="org.jboss.tools.deltacloud.ui.views.cloudelements.InstanceView" />
- </with>
- </or>
+ <with
+ variable="activePart">
+ <instanceof value="org.jboss.tools.deltacloud.ui.views.cloudelements.InstanceView" />
+ </with>
+ </or>
</enabledWhen>
</handler>
</extension>
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java 2011-03-31 19:47:58 UTC (rev 30191)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java 2011-03-31 19:48:45 UTC (rev 30192)
@@ -30,7 +30,7 @@
*/
public class CreateInstanceFromAnyImageHandler extends AbstractHandler implements IHandler {
- @Override
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
DeltaCloud cloud = null;
13 years, 8 months
JBoss Tools SVN: r30191 - in branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui: src/org/jboss/tools/deltacloud/ui/commands and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-03-31 15:47:58 -0400 (Thu, 31 Mar 2011)
New Revision: 30191
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java
Log:
[JBIDE-8660] enabled "Launch instance" in instance view even if no instance is selected (erroneously committed to JBIDE-8659 before)
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-31 19:44:50 UTC (rev 30190)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-31 19:47:58 UTC (rev 30191)
@@ -2,7 +2,7 @@
* src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java:
* plugin.xml:
- [JBIDE-8659] enabled "Launch instance" in instance view even if no instance is selected
+ [JBIDE-8660] enabled "Launch instance" in instance view even if no instance is selected
* plugin.xml:
[JBIDE-8655] added "Launch instance" to context menu and toolbar in instance view
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2011-03-31 19:44:50 UTC (rev 30190)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2011-03-31 19:47:58 UTC (rev 30191)
@@ -250,7 +250,7 @@
class="org.jboss.tools.deltacloud.ui.commands.CreateInstanceFromAnyImageHandler"
commandId="org.jboss.tools.deltacloud.ui.createinstanceFromAnyImage">
<enabledWhen>
- <or>
+ <or>
<with
variable="selection">
<and>
@@ -264,11 +264,11 @@
</iterate>
</and>
</with>
- <with
- variable="activePart">
- <instanceof value="org.jboss.tools.deltacloud.ui.views.cloudelements.InstanceView" />
- </with>
- </or>
+ <with
+ variable="activePart">
+ <instanceof value="org.jboss.tools.deltacloud.ui.views.cloudelements.InstanceView" />
+ </with>
+ </or>
</enabledWhen>
</handler>
</extension>
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java 2011-03-31 19:44:50 UTC (rev 30190)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java 2011-03-31 19:47:58 UTC (rev 30191)
@@ -30,7 +30,7 @@
*/
public class CreateInstanceFromAnyImageHandler extends AbstractHandler implements IHandler {
- @Override
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
DeltaCloud cloud = null;
13 years, 8 months
JBoss Tools SVN: r30190 - in branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui: src/org/jboss/tools/deltacloud/ui/commands and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-03-31 15:44:50 -0400 (Thu, 31 Mar 2011)
New Revision: 30190
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java
Log:
[JBIDE-8659] enabled "Launch instance" in instance view even if no instance is selected
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-31 19:42:37 UTC (rev 30189)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-31 19:44:50 UTC (rev 30190)
@@ -1,6 +1,9 @@
2011-03-31 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+ * src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java:
* plugin.xml:
+ [JBIDE-8659] enabled "Launch instance" in instance view even if no instance is selected
+ * plugin.xml:
[JBIDE-8655] added "Launch instance" to context menu and toolbar in instance view
2011-03-29 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2011-03-31 19:42:37 UTC (rev 30189)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2011-03-31 19:44:50 UTC (rev 30190)
@@ -250,19 +250,25 @@
class="org.jboss.tools.deltacloud.ui.commands.CreateInstanceFromAnyImageHandler"
commandId="org.jboss.tools.deltacloud.ui.createinstanceFromAnyImage">
<enabledWhen>
- <with
- variable="selection">
- <and>
- <count value="+" />
- <iterate operator="and">
- <adapt
- type="org.jboss.tools.deltacloud.core.DeltaCloud">
- <test property="org.jboss.tools.deltacloud.ui.commands.isValid"
- value="true"/>
- </adapt>
- </iterate>
- </and>
- </with>
+ <or>
+ <with
+ variable="selection">
+ <and>
+ <count value="+" />
+ <iterate operator="and">
+ <adapt
+ type="org.jboss.tools.deltacloud.core.DeltaCloud">
+ <test property="org.jboss.tools.deltacloud.ui.commands.isValid"
+ value="true"/>
+ </adapt>
+ </iterate>
+ </and>
+ </with>
+ <with
+ variable="activePart">
+ <instanceof value="org.jboss.tools.deltacloud.ui.views.cloudelements.InstanceView" />
+ </with>
+ </or>
</enabledWhen>
</handler>
</extension>
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java 2011-03-31 19:42:37 UTC (rev 30189)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java 2011-03-31 19:44:50 UTC (rev 30190)
@@ -33,16 +33,27 @@
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
- if (selection instanceof IStructuredSelection) {
- DeltaCloud cloud = UIUtils.getFirstAdaptedElement(selection, DeltaCloud.class);
+ DeltaCloud cloud = null;
+ cloud = getSelectedCloud(event, selection, cloud);
+ if (cloud != null) {
IWizard wizard = new NewInstanceWizard(cloud);
- WizardDialog dialog = new WizardDialog(UIUtils.getActiveWorkbenchWindow().getShell(),
- wizard);
+ WizardDialog dialog =
+ new WizardDialog(UIUtils.getActiveWorkbenchWindow().getShell(), wizard);
dialog.create();
dialog.open();
}
-
return Status.OK_STATUS;
}
+ private DeltaCloud getSelectedCloud(ExecutionEvent event, ISelection selection, DeltaCloud cloud) {
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ // try selection
+ cloud = UIUtils.getFirstAdaptedElement(selection, DeltaCloud.class);
+ }
+ if (cloud == null) {
+ // try active part
+ cloud = UIUtils.adapt(HandlerUtil.getActivePart(event), DeltaCloud.class);
+ }
+ return cloud;
+ }
}
13 years, 8 months
JBoss Tools SVN: r30189 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui: src/org/jboss/tools/deltacloud/ui/commands and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-03-31 15:42:37 -0400 (Thu, 31 Mar 2011)
New Revision: 30189
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java
Log:
[JBIDE-8659] enabled "Launch instance" in instance view even if no instance is selected
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-31 18:32:04 UTC (rev 30188)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-31 19:42:37 UTC (rev 30189)
@@ -1,6 +1,9 @@
2011-03-31 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+ * src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java:
* plugin.xml:
+ [JBIDE-8659] enabled "Launch instance" in instance view even if no instance is selected
+ * plugin.xml:
[JBIDE-8655] added "Launch instance" to context menu and toolbar in instance view
2011-03-29 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2011-03-31 18:32:04 UTC (rev 30188)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2011-03-31 19:42:37 UTC (rev 30189)
@@ -258,19 +258,25 @@
class="org.jboss.tools.deltacloud.ui.commands.CreateInstanceFromAnyImageHandler"
commandId="org.jboss.tools.deltacloud.ui.createinstanceFromAnyImage">
<enabledWhen>
- <with
- variable="selection">
- <and>
- <count value="+" />
- <iterate operator="and">
- <adapt
- type="org.jboss.tools.deltacloud.core.DeltaCloud">
- <test property="org.jboss.tools.deltacloud.ui.commands.isValid"
- value="true"/>
- </adapt>
- </iterate>
- </and>
- </with>
+ <or>
+ <with
+ variable="selection">
+ <and>
+ <count value="+" />
+ <iterate operator="and">
+ <adapt
+ type="org.jboss.tools.deltacloud.core.DeltaCloud">
+ <test property="org.jboss.tools.deltacloud.ui.commands.isValid"
+ value="true"/>
+ </adapt>
+ </iterate>
+ </and>
+ </with>
+ <with
+ variable="activePart">
+ <instanceof value="org.jboss.tools.deltacloud.ui.views.cloudelements.InstanceView" />
+ </with>
+ </or>
</enabledWhen>
</handler>
</extension>
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java 2011-03-31 18:32:04 UTC (rev 30188)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java 2011-03-31 19:42:37 UTC (rev 30189)
@@ -33,16 +33,27 @@
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
- if (selection instanceof IStructuredSelection) {
- DeltaCloud cloud = WorkbenchUtils.getFirstAdaptedElement(selection, DeltaCloud.class);
+ DeltaCloud cloud = null;
+ cloud = getSelectedCloud(event, selection, cloud);
+ if (cloud != null) {
IWizard wizard = new NewInstanceWizard(cloud);
- WizardDialog dialog = new WizardDialog(WorkbenchUtils.getActiveWorkbenchWindow().getShell(),
- wizard);
+ WizardDialog dialog =
+ new WizardDialog(WorkbenchUtils.getActiveWorkbenchWindow().getShell(), wizard);
dialog.create();
dialog.open();
}
-
return Status.OK_STATUS;
}
+ private DeltaCloud getSelectedCloud(ExecutionEvent event, ISelection selection, DeltaCloud cloud) {
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ // try selection
+ cloud = WorkbenchUtils.getFirstAdaptedElement(selection, DeltaCloud.class);
+ }
+ if (cloud == null) {
+ // try active part
+ cloud = WorkbenchUtils.adapt(HandlerUtil.getActivePart(event), DeltaCloud.class);
+ }
+ return cloud;
+ }
}
13 years, 8 months
JBoss Tools SVN: r30188 - in trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi: internal/core/impl and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-03-31 14:32:04 -0400 (Thu, 31 Mar 2011)
New Revision: 30188
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IStereotype.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java
Log:
JBIDE-3120
https://issues.jboss.org/browse/JBIDE-3120
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IStereotype.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IStereotype.java 2011-03-31 17:26:41 UTC (rev 30187)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IStereotype.java 2011-03-31 18:32:04 UTC (rev 30188)
@@ -10,8 +10,6 @@
******************************************************************************/
package org.jboss.tools.cdi.core;
-import org.eclipse.jdt.core.IAnnotation;
-
/**
* Represents a stereotype.
*
@@ -20,14 +18,6 @@
public interface IStereotype extends IScoped, IStereotyped, ICDINamedAnnotation, IAnnotated, IInterceptorBinded {
/**
- * Returns the location of @Name declaration of this stereotype. If the bean
- * doesn't have the @Name declaration then null will be returned.
- *
- * @return the location of @Name declaration of this bean.
- */
- IAnnotation getNameLocation();
-
- /**
* Determines if the stereotype is an alternative.
*
* @return <tt>true</tt> if the stereotype is an alternative, and
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 2011-03-31 17:26:41 UTC (rev 30187)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java 2011-03-31 18:32:04 UTC (rev 30188)
@@ -15,7 +15,6 @@
import java.util.List;
import java.util.Set;
-import org.eclipse.jdt.core.IAnnotation;
import org.jboss.tools.cdi.core.CDIUtil;
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.cdi.core.IInterceptorBinding;
@@ -69,14 +68,6 @@
/*
* (non-Javadoc)
- * @see org.jboss.tools.cdi.core.IStereotype#getNameLocation()
- */
- public IAnnotation getNameLocation() {
- return getNameDeclaration() != null ? getNameDeclaration().getDeclaration() : null;
- }
-
- /*
- * (non-Javadoc)
* @see org.jboss.tools.cdi.core.IStereotype#getStereotypeDeclarations()
*/
public Set<IStereotypeDeclaration> getStereotypeDeclarations() {
13 years, 8 months
JBoss Tools SVN: r30187 - trunk/build/target-platform.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-03-31 13:26:41 -0400 (Thu, 31 Mar 2011)
New Revision: 30187
Modified:
trunk/build/target-platform/multiple.target
trunk/build/target-platform/multiple.target.p2mirror.xml
trunk/build/target-platform/unified.target
trunk/build/target-platform/unified.target.p2mirror.xml
Log:
bump m2e up to 0.13, and rename feature to match new refactored feature name (org.maven.ide.eclipse.feature -> org.eclipse.m2e.feature)
Modified: trunk/build/target-platform/multiple.target
===================================================================
--- trunk/build/target-platform/multiple.target 2011-03-31 16:50:09 UTC (rev 30186)
+++ trunk/build/target-platform/multiple.target 2011-03-31 17:26:41 UTC (rev 30187)
@@ -14,8 +14,9 @@
<location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit">
<repository location="http://download.jboss.org/jbosstools/updates/indigo/"/>
- <unit id="org.maven.ide.eclipse.feature.feature.group" version="0.12.1.20110112-1712"/>
- <unit id="org.maven.ide.eclipse.wtp.feature.feature.group" version="0.11.1.20101108-1810"/>
+ <!-- m2e -->
+ <unit version="0.13.0.201103291237" id="org.eclipse.m2e.feature.feature.group"/>
+ <unit version="0.13.0.201103231111" id="org.maven.ide.eclipse.wtp.feature.feature.group"/>
<unit id="javax.wsdl" version="1.6.2.v201012040545"/>
<unit id="org.apache.oro" version="2.0.8.v201005080400"/>
Modified: trunk/build/target-platform/multiple.target.p2mirror.xml
===================================================================
--- trunk/build/target-platform/multiple.target.p2mirror.xml 2011-03-31 16:50:09 UTC (rev 30186)
+++ trunk/build/target-platform/multiple.target.p2mirror.xml 2011-03-31 17:26:41 UTC (rev 30187)
@@ -31,7 +31,7 @@
<repository location="http://download.jboss.org/jbosstools/builds/staging/_composite_/3.3.indigo/"/>
<repository location="http://download.jboss.org/jbosstools/updates/indigo/"/>
</source>
-<iu id="org.maven.ide.eclipse.feature.feature.group" version=""/>
+<iu id="org.eclipse.m2e.feature.feature.group" version=""/>
<iu id="org.maven.ide.eclipse.wtp.feature.feature.group" version=""/>
<iu id="javax.wsdl" version=""/>
<iu id="org.apache.oro" version=""/>
Modified: trunk/build/target-platform/unified.target
===================================================================
--- trunk/build/target-platform/unified.target 2011-03-31 16:50:09 UTC (rev 30186)
+++ trunk/build/target-platform/unified.target 2011-03-31 17:26:41 UTC (rev 30187)
@@ -14,8 +14,9 @@
<location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit">
<repository location="http://download.jboss.org/jbosstools/updates/target-platform_3.3.indigo/l..."/>
- <unit id="org.maven.ide.eclipse.feature.feature.group" version="0.12.1.20110112-1712"/>
- <unit id="org.maven.ide.eclipse.wtp.feature.feature.group" version="0.11.1.20101108-1810"/>
+ <!-- m2e -->
+ <unit version="0.13.0.201103291237" id="org.eclipse.m2e.feature.feature.group"/>
+ <unit version="0.13.0.201103231111" id="org.maven.ide.eclipse.wtp.feature.feature.group"/>
<unit id="javax.wsdl" version="1.6.2.v201012040545"/>
<unit id="org.apache.oro" version="2.0.8.v201005080400"/>
Modified: trunk/build/target-platform/unified.target.p2mirror.xml
===================================================================
--- trunk/build/target-platform/unified.target.p2mirror.xml 2011-03-31 16:50:09 UTC (rev 30186)
+++ trunk/build/target-platform/unified.target.p2mirror.xml 2011-03-31 17:26:41 UTC (rev 30187)
@@ -31,7 +31,7 @@
<repository location="http://download.jboss.org/jbosstools/updates/target-platform_3.3.indigo/l..."/>
<repository location="http://download.jboss.org/jbosstools/updates/target-platform_3.3.indigo/l..."/>
</source>
-<iu id="org.maven.ide.eclipse.feature.feature.group" version=""/>
+<iu id="org.eclipse.m2e.feature.feature.group" version=""/>
<iu id="org.maven.ide.eclipse.wtp.feature.feature.group" version=""/>
<iu id="javax.wsdl" version=""/>
<iu id="org.apache.oro" version=""/>
13 years, 8 months