JBoss Tools SVN: r19062 - in trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi: internal/core/impl and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-12-04 12:26:03 -0500 (Fri, 04 Dec 2009)
New Revision: 19062
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/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
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/FieldDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
Removed:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotatedTypeDeclaration.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/scanner/CDIBuilderDelegate.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4943
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java 2009-12-04 17:26:03 UTC (rev 19062)
@@ -0,0 +1,38 @@
+package org.jboss.tools.cdi.core;
+
+public interface CDIConstants {
+ public String INHERITED_ANNOTATION_TYPE_NAME = "java.lang.annotation.Inherited";
+ public String TARGET_ANNOTATION_TYPE_NAME = "java.lang.annotation.Target";
+ public String RETENTION_ANNOTATION_TYPE_NAME = "java.lang.annotation.Retention";
+
+ public String QUALIFIER_ANNOTATION_TYPE_NAME = "javax.inject.Qualifier";
+
+ public String NAMED_QUALIFIER_TYPE_NAME = "javax.inject.Named";
+ public String ANY_QUALIFIER_TYPE_NAME = "javax.enterprise.inject.Any";
+ public String DEFAULT_QUALIFIER_TYPE_NAME = "javax.enterprise.inject.Default";
+ public String NEW_QUALIFIER_TYPE_NAME = "javax.enterprise.inject.New";
+
+ public String STEREOTYPE_ANNOTATION_TYPE_NAME = "javax.enterprise.inject.Stereotype";
+ public String MODEL_STEREOTYPE_TYPE_NAME = "javax.enterprise.inject.Model";
+ public String DECORATOR_STEREOTYPE_TYPE_NAME = "javax.decorator.Decorator";
+
+ public String TYPED_ANNOTATION_TYPE_NAME = "javax.enterprise.inject.Typed";
+
+ public String PRODUCES_ANNOTATION_TYPE_NAME = "javax.enterprise.inject.Produces";
+
+ public String SCOPE_ANNOTATION_TYPE_NAME = "javax.inject.Scope";
+
+ public String PROVIDER_ANNOTATION_TYPE_NAME = "javax.inject.Provider";
+
+ public String INJECT_ANNOTATION_TYPE_NAME = "javax.inject.Inject";
+
+ public String ALTERNATIVE_ANNOTATION_TYPE_NAME = "javax.enterprise.inject.Alternative";
+
+ public String INTERCEPTOR_BINDING_ANNOTATION_TYPE_NAME = "javax.interceptor.InterceptorBinding";
+
+ public String APPLICATION_SCOPED_ANNOTATION_TYPE_NAME = "javax.enterprise.context.ApplicationScoped";
+ public String CONVERSATION_SCOPED_ANNOTATION_TYPE_NAME = "javax.enterprise.context.ConversationScoped";
+ public String REQUEST_SCOPED_ANNOTATION_TYPE_NAME = "javax.enterprise.context.RequestScoped";
+ public String SESSION_SCOPED_ANNOTATION_TYPE_NAME = "javax.enterprise.context.SessionScoped";
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotatedTypeDeclaration.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotatedTypeDeclaration.java 2009-12-04 16:58:34 UTC (rev 19061)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotatedTypeDeclaration.java 2009-12-04 17:26:03 UTC (rev 19062)
@@ -1,37 +0,0 @@
-package org.jboss.tools.cdi.internal.core.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IType;
-import org.jboss.tools.cdi.core.CDICorePlugin;
-
-public class AnnotatedTypeDeclaration {
- List<AnnotationDeclaration> annotations = new ArrayList<AnnotationDeclaration>();
- String qualifiedName;
- IType type;
-
- public AnnotatedTypeDeclaration() {
- }
-
- public void setType(IType type) {
- this.type = type;
- try {
- init();
- } catch (CoreException e) {
- CDICorePlugin.getDefault().logError(e);
- }
- }
-
- void init() throws CoreException {
- qualifiedName = type.getFullyQualifiedName();
- IAnnotation[] ts = type.getAnnotations();
- for (int i = 0; i < annotations.size(); i++) {
- AnnotationDeclaration a = new AnnotationDeclaration();
- a.setDeclaration(ts[i], type);
- annotations.add(a);
- }
- }
-}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotationDeclaration.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotationDeclaration.java 2009-12-04 16:58:34 UTC (rev 19061)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotationDeclaration.java 2009-12-04 17:26:03 UTC (rev 19062)
@@ -8,13 +8,13 @@
import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
public class AnnotationDeclaration implements IAnnotationDeclaration {
IAnnotation annotation;
int startPosition = -1;
int length = 0;
String annotationTypeName = null;
+ IType type = null;
public AnnotationDeclaration() {}
@@ -26,11 +26,12 @@
startPosition = range.getOffset();
length = range.getLength();
}
+ String name = annotation.getElementName();
+ annotationTypeName = EclipseJavaUtil.resolveType(declaringType, name);
+ type = EclipseJavaUtil.findType(declaringType.getJavaProject(), annotationTypeName);
} catch (JavaModelException e) {
CDICorePlugin.getDefault().logError(e);
}
- String name = annotation.getElementName();
- annotationTypeName = EclipseJavaUtil.resolveType(declaringType, name);
}
public IAnnotation getDeclaration() {
@@ -41,8 +42,12 @@
return (IMember)annotation.getParent();
}
+ public String getTypeName() {
+ return annotationTypeName;
+ }
+
public IType getType() {
- return getParentMember().getDeclaringType();
+ return type;
}
public int getLength() {
Added: 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 (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java 2009-12-04 17:26:03 UTC (rev 19062)
@@ -0,0 +1,37 @@
+package org.jboss.tools.cdi.internal.core.impl.definition;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IAnnotatable;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IType;
+import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.jboss.tools.cdi.internal.core.impl.AnnotationDeclaration;
+
+public abstract class AbstractMemberDefinition {
+ protected List<AnnotationDeclaration> annotations = new ArrayList<AnnotationDeclaration>();
+ protected IAnnotatable member;
+
+ public AbstractMemberDefinition() {}
+
+ protected void setAnnotatable(IAnnotatable member, IType contextType, DefinitionContext context) {
+ this.member = member;
+ try {
+ init(contextType, context);
+ } catch (CoreException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
+ }
+
+ protected void init(IType contextType, DefinitionContext context) throws CoreException {
+ IAnnotation[] ts = member.getAnnotations();
+ for (int i = 0; i < annotations.size(); i++) {
+ AnnotationDeclaration a = new AnnotationDeclaration();
+ a.setDeclaration(ts[i], contextType);
+ annotations.add(a);
+ }
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java 2009-12-04 17:26:03 UTC (rev 19062)
@@ -0,0 +1,31 @@
+package org.jboss.tools.cdi.internal.core.impl.definition;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IType;
+
+public class AbstractTypeDefinition extends AbstractMemberDefinition {
+ protected String qualifiedName;
+ IType type;
+
+ public AbstractTypeDefinition() {}
+
+ public String getQualifiedName() {
+ return qualifiedName;
+ }
+
+ public IType getType() {
+ return type;
+ }
+
+ public void setType(IType type, DefinitionContext context) {
+ super.setAnnotatable(type, type,context);
+ }
+
+ @Override
+ protected void init(IType contextType, DefinitionContext context) throws CoreException {
+ this.type = contextType;
+ super.init(contextType, context);
+ qualifiedName = getType().getFullyQualifiedName();
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: 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 (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationDefinition.java 2009-12-04 17:26:03 UTC (rev 19062)
@@ -0,0 +1,59 @@
+package org.jboss.tools.cdi.internal.core.impl.definition;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IType;
+import org.jboss.tools.cdi.core.CDIConstants;
+import org.jboss.tools.cdi.internal.core.impl.AnnotationDeclaration;
+
+public class AnnotationDefinition extends AbstractTypeDefinition {
+ public static final int NON_RELEVANT = 0;
+ public static final int BASIC = 1; //has Inherited, Target, Retention
+ public static final int CDI = 2; //has Model, Named, Typed, *Scoped, New
+ public static final int QUALIFIER = 3; //has Qualifier
+ public static final int STEREOTYPE = 4; //has Stereotype
+ public static final int INTERCEPTOR_BINDING = 5; //has InterceptorBinding
+ //TODO add other definition kinds of interest
+
+ protected int kind = NON_RELEVANT;
+
+ public AnnotationDefinition() {}
+
+ public void setKind(int kind) {
+ this.kind = kind;
+ }
+
+ public int getKind() {
+ return kind;
+ }
+
+ @Override
+ protected void init(IType contextType, DefinitionContext context) throws CoreException {
+ super.init(contextType, context);
+ if(annotations.isEmpty()) {
+ //TODO check super ?
+ return;
+ }
+ Map<String, AnnotationDeclaration> ds = new HashMap<String, AnnotationDeclaration>();
+
+ for (AnnotationDeclaration a: annotations) {
+ String typeName = a.getTypeName();
+ ds.put(typeName, a);
+ }
+
+ if(ds.containsKey(CDIConstants.STEREOTYPE_ANNOTATION_TYPE_NAME)) {
+ kind = STEREOTYPE;
+ } else if(ds.containsKey(CDIConstants.QUALIFIER_ANNOTATION_TYPE_NAME)) {
+ kind = QUALIFIER;
+ } else if(ds.containsKey(CDIConstants.INTERCEPTOR_BINDING_ANNOTATION_TYPE_NAME)) {
+ kind = INTERCEPTOR_BINDING;
+ } else if(AnnotationHelper.BASIC_ANNOTATION_TYPES.contains(qualifiedName)) {
+ kind = AnnotationDefinition.BASIC;
+ } else if(AnnotationHelper.CDI_ANNOTATION_TYPES.contains(qualifiedName)) {
+ kind = AnnotationDefinition.CDI;
+ }
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationDefinition.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: 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 (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationHelper.java 2009-12-04 17:26:03 UTC (rev 19062)
@@ -0,0 +1,41 @@
+package org.jboss.tools.cdi.internal.core.impl.definition;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.tools.cdi.core.CDIConstants;
+
+public class AnnotationHelper implements CDIConstants {
+ 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>();
+
+ {
+ BASIC_ANNOTATION_TYPES.add(INHERITED_ANNOTATION_TYPE_NAME);
+ BASIC_ANNOTATION_TYPES.add(TARGET_ANNOTATION_TYPE_NAME);
+ BASIC_ANNOTATION_TYPES.add(RETENTION_ANNOTATION_TYPE_NAME);
+
+ SCOPE_ANNOTATION_TYPES.add(APPLICATION_SCOPED_ANNOTATION_TYPE_NAME);
+ SCOPE_ANNOTATION_TYPES.add(CONVERSATION_SCOPED_ANNOTATION_TYPE_NAME);
+ SCOPE_ANNOTATION_TYPES.add(REQUEST_SCOPED_ANNOTATION_TYPE_NAME);
+ SCOPE_ANNOTATION_TYPES.add(SESSION_SCOPED_ANNOTATION_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(MODEL_STEREOTYPE_TYPE_NAME);
+ CDI_ANNOTATION_TYPES.add(DECORATOR_STEREOTYPE_TYPE_NAME);
+ CDI_ANNOTATION_TYPES.add(TYPED_ANNOTATION_TYPE_NAME);
+ CDI_ANNOTATION_TYPES.add(PRODUCES_ANNOTATION_TYPE_NAME);
+ CDI_ANNOTATION_TYPES.add(SCOPE_ANNOTATION_TYPE_NAME);
+ CDI_ANNOTATION_TYPES.add(PROVIDER_ANNOTATION_TYPE_NAME);
+ CDI_ANNOTATION_TYPES.add(INJECT_ANNOTATION_TYPE_NAME);
+ CDI_ANNOTATION_TYPES.add(ALTERNATIVE_ANNOTATION_TYPE_NAME);
+ CDI_ANNOTATION_TYPES.add(INTERCEPTOR_BINDING_ANNOTATION_TYPE_NAME);
+ CDI_ANNOTATION_TYPES.addAll(SCOPE_ANNOTATION_TYPES);
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: 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 (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java 2009-12-04 17:26:03 UTC (rev 19062)
@@ -0,0 +1,90 @@
+package org.jboss.tools.cdi.internal.core.impl.definition;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.jboss.tools.cdi.core.CDICoreNature;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+
+public class DefinitionContext {
+ protected CDICoreNature project;
+ protected IJavaProject javaProject;
+
+ Set<IType> types = new HashSet<IType>();
+ Map<IPath, Set<IType>> resources = new HashMap<IPath, Set<IType>>();
+ Map<IType, AbstractTypeDefinition> typeDefinitions = new HashMap<IType, AbstractTypeDefinition>();
+ Map<IType, AnnotationDefinition> annotations = new HashMap<IType, AnnotationDefinition>();
+
+ public DefinitionContext() {}
+
+ public void setProject(CDICoreNature project) {
+ this.project = project;
+ javaProject = EclipseResourceUtil.getJavaProject(project.getProject());
+ }
+
+ public CDICoreNature getProject() {
+ return project;
+ }
+
+ public void addType(IPath file, IType type, AbstractTypeDefinition def) {
+ if(file != null) {
+ Set<IType> ts = resources.get(file);
+ if(ts == null) {
+ ts = new HashSet<IType>();
+ resources.put(file, ts);
+ }
+ ts.add(type);
+ types.add(type);
+ }
+ if(def != null) {
+ typeDefinitions.put(type, def);
+ if(def instanceof AnnotationDefinition) {
+ annotations.put(type, (AnnotationDefinition)def);
+ }
+ }
+ }
+
+ public void clean(IPath path) {
+ Set<IType> ts = resources.remove(path);
+ if(ts == null) return;
+ for (IType t: ts) {
+ types.remove(t);
+ typeDefinitions.remove(t);
+ annotations.remove(t);
+ }
+ }
+
+ public int getAnnotationKind(IType annotationType) {
+ if(annotationType == null) return -1;
+ AnnotationDefinition d = annotations.get(annotationType);
+ if(d != null) {
+ return d.getKind();
+ }
+ //? use cache for basic?
+ if(types.contains(annotationType)) {
+ return AnnotationDefinition.NON_RELEVANT;
+ }
+ String name = annotationType.getFullyQualifiedName();
+ if(AnnotationHelper.BASIC_ANNOTATION_TYPES.contains(name)) {
+ return AnnotationDefinition.BASIC;
+ }
+ if(AnnotationHelper.CDI_ANNOTATION_TYPES.contains(name)) {
+ return AnnotationDefinition.CDI;
+ }
+
+ d = new AnnotationDefinition();
+ d.setType(annotationType, this);
+ int kind = d.getKind();
+ if(kind <= AnnotationDefinition.CDI) {
+ d = null;
+ }
+ addType(annotationType.getPath(), annotationType, d);
+ return kind;
+ }
+}
+
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/FieldDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/FieldDefinition.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/FieldDefinition.java 2009-12-04 17:26:03 UTC (rev 19062)
@@ -0,0 +1,19 @@
+package org.jboss.tools.cdi.internal.core.impl.definition;
+
+import org.eclipse.jdt.core.IField;
+
+public class FieldDefinition extends AbstractMemberDefinition {
+ IField field;
+
+ public FieldDefinition() {}
+
+ public void setField(IField field, DefinitionContext context) {
+ this.field = field;
+ setAnnotatable(field, field.getDeclaringType(), context);
+ }
+
+ public IField getField() {
+ return field;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/FieldDefinition.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java 2009-12-04 17:26:03 UTC (rev 19062)
@@ -0,0 +1,19 @@
+package org.jboss.tools.cdi.internal.core.impl.definition;
+
+import org.eclipse.jdt.core.IMethod;
+
+public class MethodDefinition extends AbstractMemberDefinition {
+ IMethod method;
+
+ public MethodDefinition() {}
+
+ public void setMethod(IMethod method, DefinitionContext context) {
+ this.method = method;
+ setAnnotatable(method, method.getDeclaringType(), context);
+ }
+
+ public IMethod getMethod() {
+ return method;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java (from rev 19032, trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotatedTypeDeclaration.java)
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java 2009-12-04 17:26:03 UTC (rev 19062)
@@ -0,0 +1,42 @@
+package org.jboss.tools.cdi.internal.core.impl.definition;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.jboss.tools.cdi.internal.core.impl.AnnotationDeclaration;
+
+public class TypeDefinition extends AbstractTypeDefinition {
+ List<FieldDefinition> fields = new ArrayList<FieldDefinition>();
+ List<MethodDefinition> methods = new ArrayList<MethodDefinition>();
+
+ public TypeDefinition() {
+ }
+
+ @Override
+ protected void init(IType contextType, DefinitionContext context) throws CoreException {
+ super.init(contextType, context);
+ for (AnnotationDeclaration d: annotations) {
+ int kind = context.getAnnotationKind(d.getType());
+ //TODO do we need to create members for specific annotations?
+ }
+ IField[] fs = getType().getFields();
+ for (int i = 0; i < fs.length; i++) {
+ FieldDefinition f = new FieldDefinition();
+ f.setField(fs[i], context);
+ //TODO check if it is annotated
+ fields.add(f);
+ }
+ IMethod[] ms = getType().getMethods();
+ for (int i = 0; i < ms.length; i++) {
+ MethodDefinition m = new MethodDefinition();
+ m.setMethod(ms[i], context);
+ //TODO check if it is annotated
+ methods.add(m);
+ }
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/CDIBuilderDelegate.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/CDIBuilderDelegate.java 2009-12-04 16:58:34 UTC (rev 19061)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/CDIBuilderDelegate.java 2009-12-04 17:26:03 UTC (rev 19062)
@@ -4,14 +4,17 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.ICompilationUnit;
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.ICDIBuilderDelegate;
import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.internal.core.impl.CDIProject;
+import org.jboss.tools.cdi.internal.core.impl.definition.DefinitionContext;
public class CDIBuilderDelegate implements ICDIBuilderDelegate {
@@ -29,9 +32,24 @@
}
public void build(FileSet fileSet, CDICoreNature projectNature) {
+ //TODO get context from projectNature
+ DefinitionContext context = new DefinitionContext();
+ context.setProject(projectNature);
Map<IFile, ICompilationUnit> as = fileSet.getAnnotations();
for (IFile f: as.keySet()) {
-
+ ICompilationUnit u = as.get(f);
+ IType[] ts = null;
+ try {
+ ts = u.getTypes();
+ if(ts != null) for (int i = 0; i < ts.length; i++) {
+ if(ts[i].isAnnotation()) {
+ //this builds annotation definition
+ context.getAnnotationKind(ts[i]);
+ }
+ }
+ } catch (CoreException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
}
Map<IFile, ICompilationUnit> is = fileSet.getInterfaces();
16 years, 4 months
JBoss Tools SVN: r19061 - in trunk/smooks/plugins/org.jboss.tools.smooks.ui: src/org/jboss/tools/smooks/launch and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: tfennelly
Date: 2009-12-04 11:58:34 -0500 (Fri, 04 Dec 2009)
New Revision: 19061
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/.classpath
trunk/smooks/plugins/org.jboss.tools.smooks.ui/.project
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5389
Smooks Run Configuration should return some output even when no output is available
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/.classpath
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/.classpath 2009-12-04 16:55:57 UTC (rev 19060)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/.classpath 2009-12-04 16:58:34 UTC (rev 19061)
@@ -4,6 +4,8 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="smooks-csv"/>
+ <classpathentry kind="src" path="smooks-core"/>
<classpathentry exported="true" kind="lib" path="libs/dom4j-1.6.1.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/.project
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/.project 2009-12-04 16:55:57 UTC (rev 19060)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/.project 2009-12-04 16:58:34 UTC (rev 19061)
@@ -25,4 +25,16 @@
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
+ <linkedResources>
+ <link>
+ <name>smooks-core</name>
+ <type>2</type>
+ <location>/Users/tfennelly/milyn/trunk/smooks-core/src/main/java</location>
+ </link>
+ <link>
+ <name>smooks-csv</name>
+ <type>2</type>
+ <location>/Users/tfennelly/milyn/trunk/smooks-cartridges/csv/src/main/java</location>
+ </link>
+ </linkedResources>
</projectDescription>
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java 2009-12-04 16:55:57 UTC (rev 19060)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java 2009-12-04 16:58:34 UTC (rev 19061)
@@ -70,6 +70,7 @@
try {
Set<ProcessNodeType> processNodeTypes = SmooksLauncher.fromNodeTypeString(args[3]);
JavaResult javaResult = new JavaResult();
+ boolean nothingDisplayed = true;
if(processNodeTypes.contains(ProcessNodeType.TEMPLATING)) {
StringResult stringResult = new StringResult();
@@ -79,6 +80,7 @@
System.out.println(" |--");
System.out.println(indent(stringResult.toString()));
System.out.println(" |--\n");
+ nothingDisplayed = false;
} else {
smooks.filterSource(new StreamSource(new FileInputStream(input)), javaResult);
}
@@ -93,8 +95,14 @@
System.out.println(indent((new XStream()).toXML(binding.getValue())));
System.out.println(" |--");
}
+ nothingDisplayed = false;
}
+ if(nothingDisplayed) {
+ System.out.println("Nothing to Display:");
+ System.out.println(" - No Java Mappings.");
+ System.out.println(" - No Templates Applied.");
+ }
} finally {
smooks.close();
}
16 years, 4 months
JBoss Tools SVN: r19060 - in branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui: src/org/jboss/tools/smooks/launch and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: tfennelly
Date: 2009-12-04 11:55:57 -0500 (Fri, 04 Dec 2009)
New Revision: 19060
Modified:
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/.classpath
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/.project
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5389
Smooks Run Configuration should return some output even when no output is available
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/.classpath
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/.classpath 2009-12-04 16:07:01 UTC (rev 19059)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/.classpath 2009-12-04 16:55:57 UTC (rev 19060)
@@ -4,6 +4,8 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="smooks-csv"/>
+ <classpathentry kind="src" path="smooks-core"/>
<classpathentry exported="true" kind="lib" path="libs/dom4j-1.6.1.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/.project
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/.project 2009-12-04 16:07:01 UTC (rev 19059)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/.project 2009-12-04 16:55:57 UTC (rev 19060)
@@ -25,4 +25,16 @@
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
+ <linkedResources>
+ <link>
+ <name>smooks-core</name>
+ <type>2</type>
+ <location>/Users/tfennelly/milyn/trunk/smooks-core/src/main/java</location>
+ </link>
+ <link>
+ <name>smooks-csv</name>
+ <type>2</type>
+ <location>/Users/tfennelly/milyn/trunk/smooks-cartridges/csv/src/main/java</location>
+ </link>
+ </linkedResources>
</projectDescription>
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java 2009-12-04 16:07:01 UTC (rev 19059)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java 2009-12-04 16:55:57 UTC (rev 19060)
@@ -70,6 +70,7 @@
try {
Set<ProcessNodeType> processNodeTypes = SmooksLauncher.fromNodeTypeString(args[3]);
JavaResult javaResult = new JavaResult();
+ boolean nothingDisplayed = true;
if(processNodeTypes.contains(ProcessNodeType.TEMPLATING)) {
StringResult stringResult = new StringResult();
@@ -79,6 +80,7 @@
System.out.println(" |--");
System.out.println(indent(stringResult.toString()));
System.out.println(" |--\n");
+ nothingDisplayed = false;
} else {
smooks.filterSource(new StreamSource(new FileInputStream(input)), javaResult);
}
@@ -93,8 +95,14 @@
System.out.println(indent((new XStream()).toXML(binding.getValue())));
System.out.println(" |--");
}
+ nothingDisplayed = false;
}
+ if(nothingDisplayed) {
+ System.out.println("Nothing to Display:");
+ System.out.println(" - No Java Mappings.");
+ System.out.println(" - No Templates Applied.");
+ }
} finally {
smooks.close();
}
16 years, 4 months
JBoss Tools SVN: r19059 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-12-04 11:07:01 -0500 (Fri, 04 Dec 2009)
New Revision: 19059
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
Log:
JBIDE-4877: completion in xhtml should not require namespace to match on tag
CA proposal for the tag names calculation is modified
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-12-04 16:03:56 UTC (rev 19058)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-12-04 16:07:01 UTC (rev 19059)
@@ -10,6 +10,9 @@
******************************************************************************/
package org.jboss.tools.jst.jsp.contentassist;
+import java.util.List;
+import java.util.Map;
+
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
@@ -24,6 +27,7 @@
import org.jboss.tools.jst.web.kb.PageContextFactory;
import org.jboss.tools.jst.web.kb.PageProcessor;
import org.jboss.tools.jst.web.kb.KbQuery.Type;
+import org.jboss.tools.jst.web.kb.taglib.INameSpace;
/**
*
@@ -45,10 +49,13 @@
@Override
protected KbQuery createKbQuery(Type type, String query, String stringQuery) {
+ return createKbQuery(type, query, stringQuery, getTagPrefix(), getTagUri());
+ }
+
+ @Override
+ protected KbQuery createKbQuery(Type type, String query, String stringQuery, String prefix, String uri) {
KbQuery kbQuery = new KbQuery();
- String prefix = getTagPrefix();
- String uri = getTagUri();
String[] parentTags = getParentTags(type == Type.ATTRIBUTE_NAME || type == Type.ATTRIBUTE_VALUE);
String parent = getParent(type == Type.ATTRIBUTE_VALUE, type == Type.ATTRIBUTE_NAME);
String queryValue = query;
@@ -95,56 +102,66 @@
return;
}
- try {
- String matchString = contentAssistRequest.getMatchString();
- String query = matchString;
- if (query == null)
- query = ""; //$NON-NLS-1$
- String stringQuery = "<" + matchString; //$NON-NLS-1$
-
- KbQuery kbQuery = createKbQuery(Type.TAG_NAME, query, stringQuery);
- TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
-
- for (int i = 0; proposals != null && i < proposals.length; i++) {
- TextProposal textProposal = proposals[i];
+ addTagNameProposals(contentAssistRequest, childPosition);
+ }
+
+ private void addTagNameProposalsForPrefix(
+ ContentAssistRequest contentAssistRequest,
+ int childPosition,
+ String query,
+ String prefix,
+ String uri,
+ int defaultRelevance
+ ) {
+ if (query == null)
+ query = ""; //$NON-NLS-1$
+ String stringQuery = "<" + query; //$NON-NLS-1$
- String replacementString = textProposal.getReplacementString();
- String closingTag = textProposal.getLabel();
- if (closingTag != null && closingTag.startsWith("<")) { //$NON-NLS-1$
- closingTag = closingTag.substring(1);
- }
+ KbQuery kbQuery = createKbQuery(Type.TAG_NAME, query, stringQuery, prefix, uri);
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
+
+ for (int i = 0; proposals != null && i < proposals.length; i++) {
+ TextProposal textProposal = proposals[i];
+
+ String replacementString = textProposal.getReplacementString();
+ String closingTag = textProposal.getLabel();
+ if (closingTag != null && closingTag.startsWith("<")) { //$NON-NLS-1$
+ closingTag = closingTag.substring(1);
+ }
+
+ if (replacementString.startsWith("<")) { //$NON-NLS-1$
+ // Because the tag starting char is already in the text
+ replacementString = replacementString.substring(1);
+ }
+ if (!replacementString.endsWith("/>")) { //$NON-NLS-1$
+ replacementString += "</" + closingTag + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
- if (!replacementString.endsWith("/>")) { //$NON-NLS-1$
- replacementString += "</" + closingTag + ">"; //$NON-NLS-1$ //$NON-NLS-2$
- }
+
+ int replacementOffset = contentAssistRequest.getReplacementBeginPosition();
+ int replacementLength = contentAssistRequest.getReplacementLength();
+ int cursorPosition = getCursorPositionForProposedText(replacementString);
+ Image image = textProposal.getImage();
+ if (image == null) {
+ image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
+ }
+ String displayString = closingTag;
+ IContextInformation contextInformation = null;
+ String additionalProposalInfo = textProposal.getContextInfo();
+ int relevance = textProposal.getRelevance();
+ if (relevance == TextProposal.R_NONE) {
+ relevance = defaultRelevance == TextProposal.R_NONE? TextProposal.R_TAG_INSERTION : defaultRelevance;
+ }
- int replacementOffset = contentAssistRequest.getReplacementBeginPosition();
- int replacementLength = contentAssistRequest.getReplacementLength();
- int cursorPosition = getCursorPositionForProposedText(replacementString);
- Image image = textProposal.getImage();
- if (image == null) {
- image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
- }
- String displayString = closingTag;
- IContextInformation contextInformation = null;
- String additionalProposalInfo = textProposal.getContextInfo();
- int relevance = textProposal.getRelevance();
- if (relevance == TextProposal.R_NONE) {
- relevance = TextProposal.R_TAG_INSERTION;
- }
- AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(true, replacementString,
- replacementOffset, replacementLength, cursorPosition, image, displayString,
- contextInformation, additionalProposalInfo, relevance);
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(true, replacementString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString,
+ contextInformation, additionalProposalInfo, relevance);
- contentAssistRequest.addProposal(proposal);
- }
- } finally {
+ contentAssistRequest.addProposal(proposal);
}
- return;
}
-
/**
* Calculates and adds the tag name proposals to the Content Assist Request object
*
@@ -154,59 +171,36 @@
@Override
protected void addTagNameProposals(
ContentAssistRequest contentAssistRequest, int childPosition) {
- try {
- String matchString = contentAssistRequest.getMatchString();
- String query = matchString;
- if (query == null)
- query = ""; //$NON-NLS-1$
- String stringQuery = "<" + matchString; //$NON-NLS-1$
-
- KbQuery kbQuery = createKbQuery(Type.TAG_NAME, query, stringQuery);
- TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
+
+ String mainPrefix = getTagPrefix();
+ String mainURI = getTagUri();
+
+ String query = contentAssistRequest.getMatchString();
+ addTagNameProposalsForPrefix(contentAssistRequest, childPosition, query, mainPrefix, mainURI, TextProposal.R_TAG_INSERTION);
+
+ if (query == null || query.length() == 0 || query.contains(":")) //$NON-NLS-1$
+ return;
+
+ // Make an additional proposals to allow prefixed tags to be entered with no prefix typed
+ ELContext elContext = getContext();
+ if (elContext instanceof IPageContext) {
+ IPageContext pageContext = (IPageContext)elContext;
+ Map<String, List<INameSpace>> nsMap = pageContext.getNameSpaces(contentAssistRequest.getReplacementBeginPosition());
+ if (nsMap == null) return;
- for (int i = 0; proposals != null && i < proposals.length; i++) {
- TextProposal textProposal = proposals[i];
+ for (List<INameSpace> namespaces : nsMap.values()) {
+ if (namespaces == null) continue;
- String replacementString = textProposal.getReplacementString();
- String closingTag = textProposal.getLabel();
- if (closingTag != null && closingTag.startsWith("<")) { //$NON-NLS-1$
- closingTag = closingTag.substring(1);
+ for (INameSpace namespace : namespaces) {
+ String possiblePrefix = namespace.getPrefix();
+ String possibleURI = namespace.getURI();
+ String possibleQuery = namespace.getPrefix() + ":" + query; //$NON-NLS-1$
+ addTagNameProposalsForPrefix(contentAssistRequest, childPosition,
+ possibleQuery, possiblePrefix, possibleURI,
+ TextProposal.R_TAG_INSERTION - 1); // TODO: Make relevance to be lower here
}
-
- if (replacementString.startsWith("<")) { //$NON-NLS-1$
- // Because the tag starting char is already in the text
- replacementString = replacementString.substring(1);
- }
- if (!replacementString.endsWith("/>")) { //$NON-NLS-1$
- replacementString += "</" + closingTag + ">"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-
- int replacementOffset = contentAssistRequest.getReplacementBeginPosition();
- int replacementLength = contentAssistRequest.getReplacementLength();
- int cursorPosition = getCursorPositionForProposedText(replacementString);
- Image image = textProposal.getImage();
- if (image == null) {
- image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
- }
-
- String displayString = closingTag;
- IContextInformation contextInformation = null;
- String additionalProposalInfo = textProposal.getContextInfo();
- int relevance = textProposal.getRelevance();
- if (relevance == TextProposal.R_NONE) {
- relevance = TextProposal.R_TAG_INSERTION;
- }
-
- AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(true, replacementString,
- replacementOffset, replacementLength, cursorPosition, image, displayString,
- contextInformation, additionalProposalInfo, relevance);
-
- contentAssistRequest.addProposal(proposal);
}
- } finally {
}
- return;
}
/**
@@ -219,116 +213,110 @@
if (prefix != null && prefix.isELStarted()) {
return;
}
- try {
- String matchString = contentAssistRequest.getMatchString();
- String query = matchString;
- if (query == null)
- query = ""; //$NON-NLS-1$
- String stringQuery = matchString;
+
+ String matchString = contentAssistRequest.getMatchString();
+ String query = matchString;
+ if (query == null)
+ query = ""; //$NON-NLS-1$
+ String stringQuery = matchString;
- KbQuery kbQuery = createKbQuery(Type.ATTRIBUTE_VALUE, query, stringQuery);
- TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
+ KbQuery kbQuery = createKbQuery(Type.ATTRIBUTE_VALUE, query, stringQuery);
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
- for (int i = 0; proposals != null && i < proposals.length; i++) {
- TextProposal textProposal = proposals[i];
- int replacementOffset = contentAssistRequest.getReplacementBeginPosition();
- int replacementLength = contentAssistRequest.getReplacementLength();
- if(textProposal.getStart() >= 0 && textProposal.getEnd() >= 0) {
- replacementOffset += textProposal.getStart() + 1;
- replacementLength = textProposal.getEnd() - textProposal.getStart();
- }
- String replacementString = "\"" + textProposal.getReplacementString() + "\""; //$NON-NLS-1$ //$NON-NLS-2$
- if(textProposal.getStart() >= 0 && textProposal.getEnd() >= 0) {
- replacementString = textProposal.getReplacementString();
- }
- int cursorPosition = getCursorPositionForProposedText(replacementString);
- Image image = textProposal.getImage();
- String displayString = textProposal.getLabel() == null ?
- replacementString :
- textProposal.getLabel();
- IContextInformation contextInformation = null;
- String additionalProposalInfo = textProposal.getContextInfo();
- int relevance = textProposal.getRelevance();
- if (relevance == TextProposal.R_NONE) {
- relevance = TextProposal.R_JSP_ATTRIBUTE_VALUE;
- }
+ for (int i = 0; proposals != null && i < proposals.length; i++) {
+ TextProposal textProposal = proposals[i];
+ int replacementOffset = contentAssistRequest.getReplacementBeginPosition();
+ int replacementLength = contentAssistRequest.getReplacementLength();
+ if(textProposal.getStart() >= 0 && textProposal.getEnd() >= 0) {
+ replacementOffset += textProposal.getStart() + 1;
+ replacementLength = textProposal.getEnd() - textProposal.getStart();
+ }
+ String replacementString = "\"" + textProposal.getReplacementString() + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+ if(textProposal.getStart() >= 0 && textProposal.getEnd() >= 0) {
+ replacementString = textProposal.getReplacementString();
+ }
+ int cursorPosition = getCursorPositionForProposedText(replacementString);
+ Image image = textProposal.getImage();
+ String displayString = textProposal.getLabel() == null ?
+ replacementString :
+ textProposal.getLabel();
+ IContextInformation contextInformation = null;
+ String additionalProposalInfo = textProposal.getContextInfo();
+ int relevance = textProposal.getRelevance();
+ if (relevance == TextProposal.R_NONE) {
+ relevance = TextProposal.R_JSP_ATTRIBUTE_VALUE;
+ }
- AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(replacementString,
- replacementOffset, replacementLength, cursorPosition, image, displayString,
- contextInformation, additionalProposalInfo, relevance);
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(replacementString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString,
+ contextInformation, additionalProposalInfo, relevance);
- contentAssistRequest.addProposal(proposal);
- }
- } finally {
+ contentAssistRequest.addProposal(proposal);
}
}
@Override
protected void addAttributeValueELProposals(ContentAssistRequest contentAssistRequest) {
- try {
- TextRegion prefix = getELPrefix();
- if (prefix == null) {
- return;
- }
+ TextRegion prefix = getELPrefix();
+ if (prefix == null) {
+ return;
+ }
- if(!prefix.isELStarted()) {
- AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(true, "#{}", //$NON-NLS-1$
- getOffset(), 0, 2, JSF_EL_PROPOSAL_IMAGE, JstUIMessages.JspContentAssistProcessor_NewELExpression,
- null, JstUIMessages.JspContentAssistProcessor_NewELExpressionAttrInfo, TextProposal.R_XML_ATTRIBUTE_VALUE_TEMPLATE);
+ if(!prefix.isELStarted()) {
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(true, "#{}", //$NON-NLS-1$
+ getOffset(), 0, 2, JSF_EL_PROPOSAL_IMAGE, JstUIMessages.JspContentAssistProcessor_NewELExpression,
+ null, JstUIMessages.JspContentAssistProcessor_NewELExpressionAttrInfo, TextProposal.R_XML_ATTRIBUTE_VALUE_TEMPLATE);
- contentAssistRequest.addProposal(proposal);
- return;
- }
- String matchString = "#{" + prefix.getText(); //$NON-NLS-1$
- String query = matchString;
- if (query == null)
- query = ""; //$NON-NLS-1$
- String stringQuery = matchString;
+ contentAssistRequest.addProposal(proposal);
+ return;
+ }
+ String matchString = "#{" + prefix.getText(); //$NON-NLS-1$
+ String query = matchString;
+ if (query == null)
+ query = ""; //$NON-NLS-1$
+ String stringQuery = matchString;
+
+ int beginChangeOffset = prefix.getStartOffset() + prefix.getOffset();
+
+ KbQuery kbQuery = createKbQuery(Type.ATTRIBUTE_VALUE, query, stringQuery);
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
+
+ for (int i = 0; proposals != null && i < proposals.length; i++) {
+ TextProposal textProposal = proposals[i];
- int beginChangeOffset = prefix.getStartOffset() + prefix.getOffset();
-
- KbQuery kbQuery = createKbQuery(Type.ATTRIBUTE_VALUE, query, stringQuery);
- TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
+ int replacementOffset = beginChangeOffset;
+ int replacementLength = prefix.getLength();
+ String replacementString = prefix.getText().substring(0, replacementLength) + textProposal.getReplacementString();
+ int cursorPosition = replacementString.length();
+ Image image = textProposal.getImage();
- for (int i = 0; proposals != null && i < proposals.length; i++) {
- TextProposal textProposal = proposals[i];
-
- int replacementOffset = beginChangeOffset;
- int replacementLength = prefix.getLength();
- String replacementString = prefix.getText().substring(0, replacementLength) + textProposal.getReplacementString();
- int cursorPosition = replacementString.length();
- Image image = textProposal.getImage();
-
- // JBIDE-512, JBIDE-2541 related changes ===>>>
+ // JBIDE-512, JBIDE-2541 related changes ===>>>
// String displayString = prefix.getText().substring(0, replacementLength) + textProposal.getReplacementString();
- String displayString = textProposal.getLabel();
- if (displayString == null)
- displayString = textProposal.getReplacementString() == null ? replacementString : textProposal.getReplacementString();
-
- // <<<=== JBIDE-512, JBIDE-2541 related changes
+ String displayString = textProposal.getLabel();
+ if (displayString == null)
+ displayString = textProposal.getReplacementString() == null ? replacementString : textProposal.getReplacementString();
+ // <<<=== JBIDE-512, JBIDE-2541 related changes
- IContextInformation contextInformation = null;
- String additionalProposalInfo = (textProposal.getContextInfo() == null ? "" : textProposal.getContextInfo()); //$NON-NLS-1$
- int relevance = textProposal.getRelevance();
- if (relevance == TextProposal.R_NONE) {
- relevance = TextProposal.R_JSP_JSF_EL_VARIABLE_ATTRIBUTE_VALUE;
- }
+ IContextInformation contextInformation = null;
+ String additionalProposalInfo = (textProposal.getContextInfo() == null ? "" : textProposal.getContextInfo()); //$NON-NLS-1$
+ int relevance = textProposal.getRelevance();
+ if (relevance == TextProposal.R_NONE) {
+ relevance = TextProposal.R_JSP_JSF_EL_VARIABLE_ATTRIBUTE_VALUE;
+ }
- AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(replacementString,
- replacementOffset, replacementLength, cursorPosition, image, displayString,
- contextInformation, additionalProposalInfo, relevance);
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(replacementString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString,
+ contextInformation, additionalProposalInfo, relevance);
- contentAssistRequest.addProposal(proposal);
- }
+ contentAssistRequest.addProposal(proposal);
+ }
- if (prefix.isELStarted() && !prefix.isELClosed()) {
- AutoContentAssistantProposal proposal = new AutoContentAssistantProposal("}", //$NON-NLS-1$
- getOffset(), 0, 1, JSF_EL_PROPOSAL_IMAGE, JstUIMessages.JspContentAssistProcessor_CloseELExpression,
- null, JstUIMessages.JspContentAssistProcessor_CloseELExpressionInfo, TextProposal.R_XML_ATTRIBUTE_VALUE_TEMPLATE);
+ if (prefix.isELStarted() && !prefix.isELClosed()) {
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal("}", //$NON-NLS-1$
+ getOffset(), 0, 1, JSF_EL_PROPOSAL_IMAGE, JstUIMessages.JspContentAssistProcessor_CloseELExpression,
+ null, JstUIMessages.JspContentAssistProcessor_CloseELExpressionInfo, TextProposal.R_XML_ATTRIBUTE_VALUE_TEMPLATE);
- contentAssistRequest.addProposal(proposal);
- }
- } finally {
+ contentAssistRequest.addProposal(proposal);
}
}
16 years, 4 months
JBoss Tools SVN: r19058 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-12-04 11:03:56 -0500 (Fri, 04 Dec 2009)
New Revision: 19058
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java
Log:
JBIDE-4877: completion in xhtml should not require namespace to match on tag
CA proposal for the tag names calculation is extended
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java 2009-12-04 15:59:52 UTC (rev 19057)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java 2009-12-04 16:03:56 UTC (rev 19058)
@@ -599,7 +599,8 @@
*/
/**
- * Returns the <code>org.jboss.tools.jst.web.kb.KbQuery</code> instance
+ * Returns the <code>org.jboss.tools.jst.web.kb.KbQuery</code> instance. The prefix and URI for the tags
+ * are calculated from the current node
*
* @param type One of the <code>org.jboss.tools.jst.web.kb.KbQuery.Type</code> values
* @param query The value for query
@@ -610,6 +611,18 @@
abstract protected KbQuery createKbQuery(Type type, String query, String stringQuery);
/**
+ * Returns the <code>org.jboss.tools.jst.web.kb.KbQuery</code> instance
+ *
+ * @param type One of the <code>org.jboss.tools.jst.web.kb.KbQuery.Type</code> values
+ * @param query The value for query
+ * @param prefix the prefix for the tag
+ * @param uri the URI for the tag
+ *
+ * @return The <code>org.jboss.tools.jst.web.kb.KbQuery</code> instance
+ */
+ abstract protected KbQuery createKbQuery(Type type, String query, String stringQuery, String prefix, String uri);
+
+ /**
* Returns the <code>org.jboss.tools.common.el.core.resolver.ELContext</code> instance
*
* @return
@@ -646,8 +659,7 @@
if (sModel != null) {
String baseLocation = sModel.getBaseLocation();
IPath location = new Path(baseLocation).makeAbsolute();
- IFile resource = FileBuffers.getWorkspaceFileAtLocation(location);
- return resource;
+ return FileBuffers.getWorkspaceFileAtLocation(location);
}
}
finally {
16 years, 4 months
JBoss Tools SVN: r19057 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-12-04 10:59:52 -0500 (Fri, 04 Dec 2009)
New Revision: 19057
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoContentAssistantProposal.java
Log:
JBIDE-4877: completion in xhtml should not require namespace to match on tag
CA proposal validation is updated
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoContentAssistantProposal.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoContentAssistantProposal.java 2009-12-04 15:43:20 UTC (rev 19056)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoContentAssistantProposal.java 2009-12-04 15:59:52 UTC (rev 19057)
@@ -138,7 +138,10 @@
if (offset < fReplacementOffset)
return false;
boolean validated = startsWith(document, offset, getReplacementString());
-
+ if (!validated && getReplacementString() != null && getReplacementString().indexOf(":") != -1) { //$NON-NLS-1$
+ String replacementString = getReplacementString().substring(getReplacementString().indexOf(":") + 1); //$NON-NLS-1$
+ validated = startsWith(document, offset, replacementString);
+ }
// it would be better to use "originalCursorPosition" instead of
// getReplacementOffset(), but we don't have that info.
int newLength = offset - getReplacementOffset();
16 years, 4 months
JBoss Tools SVN: r19056 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor.
by jbosstools-commits@lists.jboss.org
Author: yzhishko
Date: 2009-12-04 10:43:20 -0500 (Fri, 04 Dec 2009)
New Revision: 19056
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageContributor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-527 Next Annotation and Previous Annotation were added.
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageContributor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageContributor.java 2009-12-04 15:38:50 UTC (rev 19055)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageContributor.java 2009-12-04 15:43:20 UTC (rev 19056)
@@ -14,6 +14,7 @@
import org.jboss.tools.common.model.ui.texteditors.AbstractMultiPageContributor;
import org.eclipse.jem.internal.java.adapters.nls.ResourceHandler;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorPart;
@@ -90,6 +91,14 @@
slm.setErrorMessage(null);
slm.setMessage(null);
}
+ ITextEditor textEditor= null;
+ if (part instanceof ITextEditor)
+ textEditor= (ITextEditor)part;
+ /** The global actions to be connected with editor actions */
+ IAction action= getAction(textEditor, ITextEditorActionConstants.NEXT);
+ actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_NEXT_ANNOTATION, action);
+ action= getAction(textEditor, ITextEditorActionConstants.PREVIOUS);
+ actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_PREVIOUS_ANNOTATION, action);
}
}
16 years, 4 months
JBoss Tools SVN: r19055 - trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors.
by jbosstools-commits@lists.jboss.org
Author: tfennelly
Date: 2009-12-04 10:38:50 -0500 (Fri, 04 Dec 2009)
New Revision: 19055
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/messages.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-5256
Change "Processing" label at top of "Process" page to "Smooks Processing..."
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/messages.properties
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/messages.properties 2009-12-04 15:26:42 UTC (rev 19054)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/messages.properties 2009-12-04 15:38:50 UTC (rev 19055)
@@ -4,8 +4,8 @@
SmooksJavaMappingGraphicalEditor_NullLabel=<NULL>
SmooksProcessGraphicalEditor_AddTaskActionText=Add Task
SmooksProcessGraphicalEditor_FormText=Smooks Processing
-SmooksProcessGraphicalEditor_TaskConfigurationSectionTitle=Task Properties
-SmooksProcessGraphicalEditor_TasksMapSectionTitle=Tasks Map
+SmooksProcessGraphicalEditor_TaskConfigurationSectionTitle=Selected Task Details
+SmooksProcessGraphicalEditor_TasksMapSectionTitle=Processing Tasks
TaskTypeManager_ApplyTemplateTaskLabel=Apply Template
TaskTypeManager_ApplyXSLTemplateTaskLabel=Apply XSL Template
TaskTypeManager_Input=Input
16 years, 4 months
JBoss Tools SVN: r19054 - in trunk: hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2009-12-04 10:26:42 -0500 (Fri, 04 Dec 2009)
New Revision: 19054
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CodeGenerationLauncherTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConfigurationFileTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateAllTests.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateTest.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/PerspectiveType.java
Log:
Hibernate bot test and BotExt ongoing update - hibernate code generation added and other test updates
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CodeGenerationLauncherTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CodeGenerationLauncherTest.java 2009-12-04 15:01:11 UTC (rev 19053)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CodeGenerationLauncherTest.java 2009-12-04 15:26:42 UTC (rev 19054)
@@ -11,43 +11,103 @@
package org.jboss.tools.hibernate.ui.bot.testcase;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
+import org.jboss.tools.hibernate.ui.bot.testsuite.Project;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.types.PerspectiveType;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(SWTBotJunit4ClassRunner.class)
public class CodeGenerationLauncherTest extends HibernateTest {
+ SWTBotShell mainShell = null;
+
+ @BeforeClass
+ public static void setUp() {
+
+ prepareProject();
+ prepareConsole();
+ }
+
/**
- * TC 09
+ * Run code generation code
*/
@Test
- public void fillMainTab() {
-
+ public void generate() {
+ eclipse.openPerspective(PerspectiveType.HIBERNATE);
+
+ createNewHibernateCodeGenerationConfiguration();
+
+ fillMainTab();
+ fillExportersTab();
+ fillRefreshTab();
+ fillCommonTab();
+
+ bot.button(IDELabel.Button.RUN);
}
+ private void createNewHibernateCodeGenerationConfiguration() {
+ SWTBotMenu menu = null;
+ menu = bot.menu("Run");
+ menu = menu.menu(IDELabel.Menu.HIBERNATE_CODE_GENERATION);
+ menu = menu.menu(IDELabel.Menu.HIBERNATE_CODE_GENERATION_CONF).click();
+
+ mainShell = bot.activeShell();
+ }
+ /**
+ * TC 09
+ */
+ public void fillMainTab() {
+
+ bot.tree().expandNode("Hibernate Code Generation").select();
+ bot.toolbarButtonWithTooltip("New launch configuration").click();
+
+ eclipse.selectTreeLocation("Hibernate Code Generation","New_configuration");
+ bot.textWithLabel("Name:").setText("HSQL Configuration");
+
+ // Console Configuration
+ bot.comboBoxWithLabel("Console configuration:").setSelection(Project.PROJECT_NAME);
+
+ // Output directory
+ bot.button("Browse...").click();
+ bot.shell("Select output directory").activate();
+ eclipse.selectTreeLocation(Project.PROJECT_NAME);
+ bot.button("Create New Folder...").click();
+ bot.shell("New Folder").activate();
+ bot.textWithLabel("Folder name:").setText("gen");
+ bot.button(IDELabel.Button.OK).click();
+ eclipse.selectTreeLocation(Project.PROJECT_NAME,"gen");
+ bot.button(IDELabel.Button.OK).click();
+ }
/**
* TC 10
*/
- @Test
public void fillExportersTab() {
-
+ mainShell.activate();
+ bot.cTabItem(IDELabel.HBLaunchConfigurationDialog.EXPORTERS_TAB).activate();
+ bot.table().select("Domain code (.java)");
+ bot.table().getTableItem(0).check();
}
/**
* TC 11
*/
- @Test
public void fillRefreshTab() {
+ mainShell.activate();
+ bot.cTabItem(IDELabel.HBLaunchConfigurationDialog.REFRESH_TAB).activate();
}
/**
* TC 12
*/
- @Test
public void fillCommonTab() {
-
+ mainShell.activate();
+ bot.cTabItem(IDELabel.HBLaunchConfigurationDialog.COMMON_TAB).activate();
}
}
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConfigurationFileTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConfigurationFileTest.java 2009-12-04 15:01:11 UTC (rev 19053)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConfigurationFileTest.java 2009-12-04 15:26:42 UTC (rev 19054)
@@ -30,7 +30,7 @@
@BeforeClass
public static void setUp() {
- HibernateTest.createProject();
+ HibernateTest.prepareProject();
}
@AfterClass
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java 2009-12-04 15:01:11 UTC (rev 19053)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java 2009-12-04 15:26:42 UTC (rev 19054)
@@ -26,7 +26,7 @@
@BeforeClass
public static void setUp() {
- HibernateTest.createProject();
+ HibernateTest.prepareProject();
}
@AfterClass
@@ -35,12 +35,15 @@
}
private SWTBotShell mainShell;
+ private static boolean done = false;
/**
* Create console TestCases TC03 - TC16
*/
@Test
public void createConsole() {
+ if (done) return;
+
packageExplorer.selectProject(Project.PROJECT_NAME);
eclipse.createNew(EntityType.HIBERNATE_CONSOLE);
@@ -52,6 +55,8 @@
createCommonTab();
bot.button(IDELabel.Button.FINISH).click();
+
+ done = true;
}
/**
@@ -73,7 +78,8 @@
SWTBotShell shell = bot.activeShell();
bot.button(IDELabel.Button.FINISH).click();
- eclipse.waitForClosedShell(shell);
+ eclipse.waitForClosedShell(shell);
+
}
/**
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateAllTests.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateAllTests.java 2009-12-04 15:01:11 UTC (rev 19053)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateAllTests.java 2009-12-04 15:26:42 UTC (rev 19054)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.bot.testsuite;
+import org.jboss.tools.hibernate.ui.bot.testcase.CodeGenerationLauncherTest;
import org.jboss.tools.hibernate.ui.bot.testcase.ConfigurationFileTest;
import org.jboss.tools.hibernate.ui.bot.testcase.ConsoleTest;
import org.jboss.tools.hibernate.ui.bot.testcase.MappingFileTest;
@@ -33,8 +34,9 @@
ReverseEngineerFileTest.class, ViewsTest.class */
@SuiteClasses( { ConfigurationFileTest.class,
- ConsoleTest.class,
- MappingFileTest.class})
+ ConsoleTest.class,
+ MappingFileTest.class,
+ CodeGenerationLauncherTest.class})
public class HibernateAllTests extends HibernateTest {
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateTest.java 2009-12-04 15:01:11 UTC (rev 19053)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateTest.java 2009-12-04 15:26:42 UTC (rev 19054)
@@ -21,6 +21,7 @@
import org.eclipse.core.runtime.Platform;
import org.jboss.tools.hibernate.ui.bot.testcase.Activator;
+import org.jboss.tools.hibernate.ui.bot.testcase.ConsoleTest;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
import org.jboss.tools.ui.bot.ext.entity.JavaClassEntity;
import org.jboss.tools.ui.bot.ext.entity.JavaProjectEntity;
@@ -39,11 +40,11 @@
public static void prepare() {
- createProject();
- createClasses();
+ prepareProject();
+ prepareClasses();
}
- public static void createClasses() {
+ public static void prepareClasses() {
if (classesCreated) return;
@@ -63,7 +64,7 @@
classesCreated = true;
}
- public static void createProject() {
+ public static void prepareProject() {
if (projectCreated) return;
@@ -128,6 +129,10 @@
if (finished) return;
log.info("Clean finished");
- bot.sleep(TIME_10S);
}
+
+ public static void prepareConsole() {
+ ConsoleTest consoleTest = new ConsoleTest();
+ consoleTest.createConsole();
+ }
}
\ No newline at end of file
Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2009-12-04 15:01:11 UTC (rev 19053)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2009-12-04 15:26:42 UTC (rev 19054)
@@ -12,6 +12,7 @@
package org.jboss.tools.ui.bot.ext;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
import java.io.File;
@@ -76,10 +77,14 @@
public void openPerspective(PerspectiveType type) {
String perspectiveLabel = "";
- if (type == PerspectiveType.JAVA) {
- perspectiveLabel = IDELabel.SelectPerspectiveDialog.JAVA;
+ switch (type) {
+ case JAVA: perspectiveLabel = IDELabel.SelectPerspectiveDialog.JAVA; break;
+ case HIBERNATE: perspectiveLabel = IDELabel.SelectPerspectiveDialog.HIBERNATE;break;
+ case SEAM: perspectiveLabel = IDELabel.SelectPerspectiveDialog.SEAM;break;
+ case WEB_DEVELOPMENT:perspectiveLabel = IDELabel.SelectPerspectiveDialog.WEB_DEVELOPMENT; break;
+ default: fail("Unknown perspective to open");
}
-
+
bot.menu(IDELabel.Menu.WINDOW).menu(IDELabel.Menu.OPEN_PERSPECTIVE).menu(
IDELabel.Menu.OTHER).click();
bot.table().select(perspectiveLabel);
Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2009-12-04 15:01:11 UTC (rev 19053)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2009-12-04 15:26:42 UTC (rev 19054)
@@ -38,6 +38,8 @@
public static final String XHTML_FILE = "XHTML...";
public static final String HELP = "Help";
public static final String ABOUT_JBOSS_DEVELOPER_STUDIO = "About JBoss Developer Studio";
+ public static final String HIBERNATE_CODE_GENERATION = "Hibernate Code Generation...";
+ public static final String HIBERNATE_CODE_GENERATION_CONF = "Hibernate Code Generation Configurations...";
}
public class Button {
@@ -49,12 +51,16 @@
public static final String YES = "Yes";
public static final String NO = "No";
public static final String CLOSE = "Close";
+ public static final String RUN = "Run";
}
public class Shell {
public static final String NEW_JAVA_PROJECT = "New Java Project";
public static final String NEW_JAVA_CLASS = "New Java Class";
- public static final String NEW_HIBERNATE_MAPPING_FILE = "New Hibernate XML Mapping file (hbm.xml)";
+ // JBT
+ // public static final String NEW_HIBERNATE_MAPPING_FILE = "New Hibernate XML Mapping file (hbm.xml)";
+ // JBDS
+ public static final String NEW_HIBERNATE_MAPPING_FILE = "Create Hibernate XML Mapping file (hbm.xml)";
public static final String NEW = "New";
public static final String SAVE_RESOURCE = "Save";
public static final String RENAME_RESOURCE = "Rename";
@@ -108,6 +114,8 @@
public class SelectPerspectiveDialog {
public static final String JAVA = "Java";
public static final String HIBERNATE = "Hibernate";
+ public static final String SEAM = "Seam";
+ public static final String WEB_DEVELOPMENT = "Web Development";
}
/**
@@ -133,6 +141,15 @@
public static final String CREATE_CONSOLE_CONFIGURATION = "Create a console configuration";
}
+ public class HBLaunchConfigurationDialog {
+
+ public static final String MAIN_TAB = "Main";
+ public static final String EXPORTERS_TAB = "Exporters";
+ public static final String REFRESH_TAB = "Refresh";
+ public static final String COMMON_TAB = "Common";
+
+ }
+
public class HBConfigurationWizard {
public static final String FILE_NAME = "File name:";
}
Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/PerspectiveType.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/PerspectiveType.java 2009-12-04 15:01:11 UTC (rev 19053)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/PerspectiveType.java 2009-12-04 15:26:42 UTC (rev 19054)
@@ -16,5 +16,6 @@
*
*/
public enum PerspectiveType {
- SEAM, JAVA, WEB_DEVELOPMENT;
+ SEAM, JAVA, WEB_DEVELOPMENT, HIBERNATE;
}
+
16 years, 4 months
JBoss Tools SVN: r19053 - branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors.
by jbosstools-commits@lists.jboss.org
Author: tfennelly
Date: 2009-12-04 10:01:11 -0500 (Fri, 04 Dec 2009)
New Revision: 19053
Modified:
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/messages.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-5256
Change "Processing" label at top of "Process" page to "Smooks Processing..."
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/messages.properties
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/messages.properties 2009-12-04 14:57:08 UTC (rev 19052)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/messages.properties 2009-12-04 15:01:11 UTC (rev 19053)
@@ -4,8 +4,8 @@
SmooksJavaMappingGraphicalEditor_NullLabel=<NULL>
SmooksProcessGraphicalEditor_AddTaskActionText=Add Task
SmooksProcessGraphicalEditor_FormText=Smooks Processing
-SmooksProcessGraphicalEditor_TaskConfigurationSectionTitle=Task Properties
-SmooksProcessGraphicalEditor_TasksMapSectionTitle=Tasks Map
+SmooksProcessGraphicalEditor_TaskConfigurationSectionTitle=Selected Task Details
+SmooksProcessGraphicalEditor_TasksMapSectionTitle=Processing Tasks
TaskTypeManager_ApplyTemplateTaskLabel=Apply Template
TaskTypeManager_ApplyXSLTemplateTaskLabel=Apply XSL Template
TaskTypeManager_Input=Input
16 years, 4 months