Author: akazakov
Date: 2008-02-14 15:55:44 -0500 (Thu, 14 Feb 2008)
New Revision: 6319
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamExpressionResolver.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/TypeInfoCollector.java
Log:
JBIDE-999
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2008-02-14
17:06:42 UTC (rev 6318)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2008-02-14
20:55:44 UTC (rev 6319)
@@ -108,22 +108,22 @@
Map<String, TypeInfoCollector.MethodInfo> unpairedGettersOrSetters;
Set<String> proposals;
private ELOperandToken lastResolvedToken;
- private boolean isMapOrBundleAmoungTheTokens = false;
+ private boolean isMapOrCollectionOrBundleAmoungTheTokens = false;
public SeamELOperandResolveStatus(List<ELOperandToken> tokens) {
this.tokens = tokens;
}
- public boolean isMapOrBundleAmoungTheTokens() {
- return this.isMapOrBundleAmoungTheTokens;
+ public boolean isMapOrCollectionOrBundleAmoungTheTokens() {
+ return this.isMapOrCollectionOrBundleAmoungTheTokens;
}
- public void setMapOrBundleAmoungTheTokens() {
- this.isMapOrBundleAmoungTheTokens = true;
+ public void setMapOrCollectionOrBundleAmoungTheTokens() {
+ this.isMapOrCollectionOrBundleAmoungTheTokens = true;
}
public boolean isOK() {
- return !getProposals().isEmpty() || isMapOrBundleAmoungTheTokens();
+ return !getProposals().isEmpty() || isMapOrCollectionOrBundleAmoungTheTokens();
}
public boolean isError() {
@@ -365,9 +365,9 @@
List<TypeInfoCollector.MemberInfo> newMembers = new
ArrayList<TypeInfoCollector.MemberInfo>();
for (TypeInfoCollector.MemberInfo mbr : members) {
if (mbr.getMemberType() == null) continue;
- TypeInfoCollector infos =
SeamExpressionResolver.collectTypeInfo(mbr.getMemberType());
- if (TypeInfoCollector.isMap(mbr.getMemberType()) ||
TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
- status.setMapOrBundleAmoungTheTokens();
+ TypeInfoCollector infos = SeamExpressionResolver.collectTypeInfo(mbr);
+ if (TypeInfoCollector.isMapOrNotParameterizedCollection(mbr.getMemberType()) ||
TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
+ status.setMapOrCollectionOrBundleAmoungTheTokens();
}
List<TypeInfoCollector.MemberInfo> properties = infos.getProperties();
for (TypeInfoCollector.MemberInfo property : properties) {
@@ -394,9 +394,9 @@
List<TypeInfoCollector.MemberInfo> newMembers = new
ArrayList<TypeInfoCollector.MemberInfo>();
for (TypeInfoCollector.MemberInfo mbr : members) {
if (mbr.getMemberType() == null) continue;
- TypeInfoCollector infos =
SeamExpressionResolver.collectTypeInfo(mbr.getMemberType());
- if (TypeInfoCollector.isMap(mbr.getMemberType()) ||
TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
- status.setMapOrBundleAmoungTheTokens();
+ TypeInfoCollector infos = SeamExpressionResolver.collectTypeInfo(mbr);
+ if (TypeInfoCollector.isMapOrNotParameterizedCollection(mbr.getMemberType()) ||
TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
+ status.setMapOrCollectionOrBundleAmoungTheTokens();
}
List<TypeInfoCollector.MemberInfo> methods = infos.getMethods();
for (TypeInfoCollector.MemberInfo method : methods) {
@@ -415,9 +415,9 @@
// return all the methods + properties
for (TypeInfoCollector.MemberInfo mbr : members) {
if (mbr.getMemberType() == null) continue;
- TypeInfoCollector infos =
SeamExpressionResolver.collectTypeInfo(mbr.getMemberType());
- if (TypeInfoCollector.isMap(mbr.getMemberType()) ||
TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
- status.setMapOrBundleAmoungTheTokens();
+ TypeInfoCollector infos = SeamExpressionResolver.collectTypeInfo(mbr);
+ if (TypeInfoCollector.isMapOrNotParameterizedCollection(mbr.getMemberType()) ||
TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
+ status.setMapOrCollectionOrBundleAmoungTheTokens();
}
proposals.addAll(infos.getMethodPresentations());
proposals.addAll(infos.getPropertyPresentations(status.getUnpairedGettersOrSetters()));
@@ -429,9 +429,9 @@
Set<String> proposalsToFilter = new
TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
for (TypeInfoCollector.MemberInfo mbr : members) {
if (mbr.getMemberType() == null) continue;
- TypeInfoCollector infos =
SeamExpressionResolver.collectTypeInfo(mbr.getMemberType());
- if (TypeInfoCollector.isMap(mbr.getMemberType()) ||
TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
- status.setMapOrBundleAmoungTheTokens();
+ TypeInfoCollector infos = SeamExpressionResolver.collectTypeInfo(mbr);
+ if (TypeInfoCollector.isMapOrNotParameterizedCollection(mbr.getMemberType()) ||
TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
+ status.setMapOrCollectionOrBundleAmoungTheTokens();
}
proposalsToFilter.addAll(infos.getMethodPresentations());
proposalsToFilter.addAll(infos.getPropertyPresentations(status.getUnpairedGettersOrSetters()));
@@ -748,7 +748,7 @@
String name = token.getText();
List<TypeInfoCollector.MemberInfo> newMembers = new
ArrayList<TypeInfoCollector.MemberInfo>();
for (TypeInfoCollector.MemberInfo mbr : members) {
- TypeInfoCollector infos =
SeamExpressionResolver.collectTypeInfo(mbr.getMemberType());
+ TypeInfoCollector infos = SeamExpressionResolver.collectTypeInfo(mbr);
List<TypeInfoCollector.MemberInfo> properties = infos.getProperties();
for (TypeInfoCollector.MemberInfo property : properties) {
StringBuffer propertyName = new StringBuffer(property.getName());
@@ -771,7 +771,7 @@
}
List<TypeInfoCollector.MemberInfo> newMembers = new
ArrayList<TypeInfoCollector.MemberInfo>();
for (TypeInfoCollector.MemberInfo mbr : members) {
- TypeInfoCollector infos =
SeamExpressionResolver.collectTypeInfo(mbr.getMemberType());
+ TypeInfoCollector infos = SeamExpressionResolver.collectTypeInfo(mbr);
List<TypeInfoCollector.MemberInfo> methods = infos.getMethods();
for (TypeInfoCollector.MemberInfo method : methods) {
if (method instanceof TypeInfoCollector.MethodInfo
@@ -790,7 +790,7 @@
// return filtered methods + properties
Set<TypeInfoCollector.MemberInfo> javaElementInfosToFilter = new
HashSet<TypeInfoCollector.MemberInfo>();
for (TypeInfoCollector.MemberInfo mbr : members) {
- TypeInfoCollector infos =
SeamExpressionResolver.collectTypeInfo(mbr.getMemberType());
+ TypeInfoCollector infos = SeamExpressionResolver.collectTypeInfo(mbr);
javaElementInfosToFilter.addAll(infos.getMethods());
javaElementInfosToFilter.addAll(infos.getProperties());
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamExpressionResolver.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamExpressionResolver.java 2008-02-14
17:06:42 UTC (rev 6318)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamExpressionResolver.java 2008-02-14
20:55:44 UTC (rev 6319)
@@ -16,7 +16,6 @@
import java.util.Set;
import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IType;
import org.jboss.tools.seam.core.IBijectedAttribute;
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamComponentMethod;
@@ -216,10 +215,9 @@
return member;
}
- public static TypeInfoCollector collectTypeInfo(IType type) {
- TypeInfoCollector typeInfo = new TypeInfoCollector(type);
+ public static TypeInfoCollector collectTypeInfo(TypeInfoCollector.MemberInfo member) {
+ TypeInfoCollector typeInfo = new TypeInfoCollector(member);
typeInfo.collectInfo();
return typeInfo;
}
-
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/TypeInfoCollector.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/TypeInfoCollector.java 2008-02-14
17:06:42 UTC (rev 6318)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/TypeInfoCollector.java 2008-02-14
20:55:44 UTC (rev 6319)
@@ -24,9 +24,10 @@
public class TypeInfoCollector {
IType fType;
+ MemberInfo fMember;
List<MethodInfo> fMethods;
List<FieldInfo> fFields;
-
+
public abstract static class MemberInfo {
private String fDeclaringTypeQualifiedName;
private String fName;
@@ -45,15 +46,15 @@
public void setSourceType(IType sourceType) {
fSourceType = sourceType;
}
-
+
public IType getSourceType() {
return fSourceType;
}
-
+
protected void setName (String name) {
this.fName = name;
}
-
+
public String getName() {
return fName;
}
@@ -61,7 +62,7 @@
protected void setDeclaringTypeQualifiedName (String declaringTypeQualifiedName) {
this.fDeclaringTypeQualifiedName = declaringTypeQualifiedName;
}
-
+
public String getDeclaringTypeQualifiedName() {
return fDeclaringTypeQualifiedName;
}
@@ -69,11 +70,11 @@
protected void setModifiers (int modifiers) {
this.fModifiers = modifiers;
}
-
+
public int getModifiers() {
return fModifiers;
}
-
+
public boolean isPublic() {
return Modifier.isPublic(fModifiers);
}
@@ -81,25 +82,24 @@
public boolean isStatic() {
return Modifier.isStatic(fModifiers);
}
-
+
public boolean isJavaLangObject() {
return "java.lang.Object".equals(getDeclaringTypeQualifiedName());
}
-
+
abstract public IType getMemberType();
-
+
abstract public IJavaElement getJavaElement();
-
}
public static class TypeInfo extends MemberInfo {
IType fType;
-
+
public TypeInfo(IType type) throws JavaModelException {
super(type.getDeclaringType(), (type.getDeclaringType() == null ? null :
type.getDeclaringType().getFullyQualifiedName()), type.getFullyQualifiedName(),
type.getFlags());
this.fType = type;
}
-
+
public IType getType() {
return fType;
}
@@ -114,40 +114,45 @@
return getType();
}
}
-
+
public static class FieldInfo extends MemberInfo {
-
private String fTypeQualifiedName;
+ private String[] fParametersOfReturnType;
+ private IType fType;
- public FieldInfo(IType sourceType, String declaringTypeQualifiedName, String name, int
modifiers, String typeQualifiedName) {
+ public FieldInfo(IType sourceType, String declaringTypeQualifiedName, String name, int
modifiers, String typeQualifiedName, String[] parametersOfReturnType) {
super(sourceType, declaringTypeQualifiedName, name, modifiers);
setTypeQualifiedName(typeQualifiedName);
+ setParametersOfReturnType(parametersOfReturnType);
}
-
+
public FieldInfo(IField field) throws JavaModelException {
this (field.getDeclaringType(), (field.getDeclaringType() == null ? null :
field.getDeclaringType().getFullyQualifiedName()),
field.getElementName(),
field.getFlags(),
- EclipseJavaUtil.getMemberTypeAsString(field));
+ Signature.toString(Signature.getTypeErasure(field.getTypeSignature())),
+ getQualifiedClassNamesFromSignatureArray(Signature.getTypeArguments(field.getTypeSignature())));
}
-
+
protected void setTypeQualifiedName(String typeQualifiedName) {
fTypeQualifiedName = typeQualifiedName;
}
-
+
public String getTypeQualifiedName() {
return fTypeQualifiedName;
}
-
+
public IType getType() {
- try {
- return getSourceType().getJavaProject().findType(getTypeQualifiedName());
- } catch (JavaModelException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- return null;
+ if(fType==null) {
+ try {
+ fType = getSourceType().getJavaProject().findType(getTypeQualifiedName());
+ } catch (JavaModelException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
}
+ return fType;
}
-
+
public IJavaElement getJavaElement () {
try {
IType declType =
getSourceType().getJavaProject().findType(getDeclaringTypeQualifiedName());
@@ -163,37 +168,58 @@
return getType();
}
+ public String[] getParametersOfReturnType() {
+ return fParametersOfReturnType;
+ }
+
+ protected void setParametersOfReturnType(String[] parametersOfReturnType) {
+ fParametersOfReturnType = parametersOfReturnType;
+ }
}
-
+
public static class MethodInfo extends MemberInfo {
- String[] fParameterTypeQualifiedNames;
- String[] fParameterNames;
- String fReturnTypeQualifiedName;
+ private String[] fParameterTypeQualifiedNames;
+ private String[] fParameterNames;
+ private String fReturnTypeQualifiedName;
+ private String[] fParametersOfReturnType;
+ private MemberInfo fParentMember;
+ private String[] fParametersOfDeclaringType;
+ private IType fReturnType;
public MethodInfo(IType sourceType, String declaringTypeQualifiedName, String name,
int modifiers, String[] parameterTypeQualifiedNames,
String[] parameterNames,
- String returnTypeQualifiedName) {
+ String returnTypeQualifiedName,
+ String[] parametersOfReturnType) {
super(sourceType, declaringTypeQualifiedName, name, modifiers);
setParameterTypeQualifiedNames(parameterTypeQualifiedNames);
setParameterNames(parameterNames);
setReturnTypeQualifiedName(returnTypeQualifiedName);
+ setParametersOfReturnType(parametersOfReturnType);
}
- public MethodInfo(IMethod method) throws JavaModelException {
+ public MethodInfo(IMethod method, MemberInfo parentMember) throws JavaModelException {
this (method.getDeclaringType(), (method.getDeclaringType() == null ? null :
method.getDeclaringType().getFullyQualifiedName()),
method.getElementName(),
method.getFlags(),
resolveSignatures(method.getDeclaringType(), method.getParameterTypes()),
method.getParameterNames(),
- EclipseJavaUtil.getMemberTypeAsString(method));
+ null,
+ null);
+ String returnTypeSignature = Signature.getReturnType(method.getSignature());
+// String[] signaturesOfParametersOfReturnType =
Signature.getTypeArguments(returnTypeSignature);
+// String[] parametersOfReturnType =
getQualifiedClassNamesFromSignatureArray(signaturesOfParametersOfReturnType);
+ setReturnTypeQualifiedName(Signature.toString(returnTypeSignature));
+ setParametersOfReturnType(Signature.getTypeArguments(method.getReturnType()));
+ this.fParentMember = parentMember;
+ this.fParametersOfDeclaringType =
getTypeErasureFromSignatureArray(method.getDeclaringType().getTypeParameterSignatures());
}
protected void setParameterTypeQualifiedNames(String[] parameterTypeQualifiedNames) {
fParameterTypeQualifiedNames = (parameterTypeQualifiedNames == null ?
new String[0] : parameterTypeQualifiedNames);
}
-
+
public String[] getParameterTypeQualifiedNames() {
return fParameterTypeQualifiedNames;
}
@@ -218,21 +244,22 @@
public int getNumberOfParameters() {
return (getParameterNames() == null ? 0 : getParameterNames().length);
}
-
+
public IType getReturnType() {
- try {
- IType result =
getSourceType().getJavaProject().findType(getReturnTypeQualifiedName());
- return result;
- } catch (JavaModelException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- return null;
+ if(fReturnType==null) {
+ try {
+ fReturnType =
getSourceType().getJavaProject().findType(getReturnTypeQualifiedName());
+ } catch (JavaModelException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
}
+ return fReturnType;
}
-
+
public boolean isConstructor () {
return getDeclaringTypeQualifiedName().equals(getName());
}
-
+
public boolean isGetter() {
return (getName().startsWith("get") &&
!getName().equals("get")) || getName().startsWith("is");
}
@@ -246,13 +273,21 @@
return getReturnType();
}
+ public String[] getParametersOfReturnType() {
+ return fParametersOfReturnType;
+ }
+
+ protected void setParametersOfReturnType(String[] parametersOfReturnType) {
+ fParametersOfReturnType = parametersOfReturnType;
+ }
+
@Override
public IJavaElement getJavaElement () {
try {
IType declType =
getSourceType().getJavaProject().findType(getDeclaringTypeQualifiedName());
-
+
IMethod[] allMethods = declType.getMethods();
-
+
// filter methods by name
List<IMethod> methods = new ArrayList<IMethod>();
for (int i = 0; allMethods != null && i < allMethods.length; i++) {
@@ -264,7 +299,7 @@
return null;
if (methods.size() == 1)
return methods.get(0);
-
+
// filter methods by number of parameters
List<IMethod> filteredMethods = new ArrayList<IMethod>();
for (IMethod method : methods) {
@@ -275,9 +310,9 @@
return null;
if (filteredMethods.size() == 1)
return filteredMethods.get(0);
-
+
methods = filteredMethods;
-
+
// filter methods by parameter types
for(IMethod method : methods) {
String[] methodParameterTypes =
@@ -316,31 +351,44 @@
case CompletionProposal.FIELD_REF:
{
char[] declarationSignature = proposal.getDeclarationSignature();
- char[] signature = proposal.getSignature();
- String type = String.valueOf(Signature.toCharArray(signature));
String declarationType =
String.valueOf(Signature.toCharArray(declarationSignature));
+
+ char[] fullSignature = proposal.getSignature();
+ String type =
String.valueOf(Signature.toCharArray(Signature.getTypeErasure(fullSignature)));
+ char[][] signaturesOfParametersOfType = Signature.getTypeArguments(fullSignature);
+ String[] parametersOfType =
getQualifiedClassNameFromCharArray(signaturesOfParametersOfType);
+
FieldInfo info = new FieldInfo(TypeInfoCollector.this.fType,
declarationType,
String.valueOf(proposal.getName()), proposal.getFlags(),
- type);
+ type,
+ parametersOfType);
fFields.add(info);
}
break;
case CompletionProposal.METHOD_REF:
{
- char[][] parameterNames = proposal.findParameterNames(null);
+ String[] parameterNames = convertToStringArray(proposal.findParameterNames(null));
+
char[] declarationSignature = proposal.getDeclarationSignature();
+ String declarationType =
String.valueOf(Signature.toCharArray(Signature.getTypeErasure(declarationSignature)));
+
char[] signature = proposal.getSignature();
char[][] parametesSignatures = Signature.getParameterTypes(signature);
- String returnType =
String.valueOf(Signature.toCharArray(Signature.getReturnType(signature)));
- String declarationType =
String.valueOf(Signature.toCharArray(declarationSignature));
+ String[] parametersTypes =
getQualifiedClassNameFromCharArray(parametesSignatures);
+ char[] fullReturnTypeSignature = Signature.getReturnType(signature);
+ String returnType =
String.valueOf(Signature.toCharArray(Signature.getTypeErasure(fullReturnTypeSignature)));
+ char[][] signaturesOfParametersOfReturnType =
Signature.getTypeArguments(fullReturnTypeSignature);
+ String[] parametersOfReturnType =
getQualifiedClassNameFromCharArray(signaturesOfParametersOfReturnType);
+
MethodInfo info = new MethodInfo(TypeInfoCollector.this.fType,
declarationType,
String.valueOf(proposal.getName()), proposal.getFlags(),
- getQualifiedClassNameFromCharArray(parametesSignatures),
- convertToStringArray(parameterNames),
- returnType);
+ parametersTypes,
+ parameterNames,
+ returnType,
+ parametersOfReturnType);
fMethods.add(info);
}
break;
@@ -358,14 +406,15 @@
}
};
- public TypeInfoCollector(IType type) {
- this.fType = type;
+ public TypeInfoCollector(MemberInfo member) {
+ this.fMember = member;
+ this.fType = member.getMemberType();
}
-
+
public IType getType() {
return this.fType;
}
-
+
public void collectInfo() {
if (fMethods == null) {
fMethods = new ArrayList<MethodInfo>();
@@ -383,7 +432,6 @@
return;
try {
fType.codeComplete("".toCharArray(), -1, 0, new char[0][0], new char[0][0],
new int[0], false, fRequestor);
-
IType binType = fType;
while (binType != null) {
IMethod[] binMethods = binType.getMethods();
@@ -391,7 +439,7 @@
if (binMethods[i].isConstructor()) continue;
MethodInfo[] infos = findMethodInfos(binMethods[i]);
if (infos == null || infos.length == 0) {
- fMethods.add(new MethodInfo(binMethods[i]));
+ fMethods.add(new MethodInfo(binMethods[i], fMember));
}
}
binType = getSuperclass(binType);
@@ -421,9 +469,10 @@
}
}
- public static boolean isMap(IType type) {
+ public static boolean isMapOrNotParameterizedCollection(IType type) {
try {
- return isInstanceofType(type, "java.util.Map");
+ String name = type.getFullyQualifiedParameterizedName();
+ return isInstanceofType(type, "java.util.Map") || (isInstanceofType(type,
"java.util.Collection") && name.indexOf('<')==-1);
} catch (JavaModelException e) {
return false;
}
@@ -451,13 +500,15 @@
"size", Modifier.PUBLIC,
new String[0],
new String[0],
- "int"));
+ "int",
+ new String[0]));
fMethods.add(new MethodInfo(fType,
fType.getFullyQualifiedName(),
"isEmpty", Modifier.PUBLIC,
new String[0],
new String[0],
- "boolean"));
+ "boolean",
+ new String[0]));
}
private static IType getSuperclass(IType type) throws JavaModelException {
@@ -476,7 +527,6 @@
return null;
}
-
public MethodInfo[] findMethodInfos(IMethod iMethod) {
List<MethodInfo> methods = new ArrayList<MethodInfo>();
@@ -489,9 +539,11 @@
if (methods.isEmpty())
return new MethodInfo[0];
+ EclipseJavaUtil.getMemberTypeAsString(iMethod);
+
if (methods.size() == 1)
return methods.toArray(new MethodInfo[0]);
-
+
// filter methods by number of parameters
List<MethodInfo> filteredMethods = new ArrayList<MethodInfo>();
for (MethodInfo method : methods) {
@@ -502,9 +554,9 @@
return new MethodInfo[0];
if (filteredMethods.size() == 1)
return filteredMethods.toArray(new MethodInfo[0]);
-
+
methods = filteredMethods;
-
+
// filter methods by parameter types
filteredMethods = new ArrayList<MethodInfo>();
for(MethodInfo method : methods) {
@@ -530,7 +582,7 @@
}
return filteredMethods.toArray(new MethodInfo[0]);
}
-
+
/**
* Returns the methods for the type specified
*
@@ -546,7 +598,7 @@
}
return methods;
}
-
+
/**
* Returns the method presentation strings for the type specified
*
@@ -561,7 +613,7 @@
continue;
MethodInfo method = (MethodInfo)info;
-
+
StringBuffer name = new StringBuffer(method.getName());
// Add method as 'foo'
@@ -594,7 +646,7 @@
&& (info.isGetter() || info.isSetter()))
properties.add(info);
}
-
+
/*
* The following code was excluded due to the following issue:
*
@@ -607,11 +659,10 @@
properties.add(info);
}
*/
-
+
return properties;
}
-
-
+
/**
* Returns the property presentation strings for the type specified
*
@@ -620,7 +671,7 @@
public Set<String> getPropertyPresentations() {
return getPropertyPresentations(null);
}
-
+
/**
* Returns the property presentation strings for the type specified
*
@@ -669,34 +720,33 @@
}
return properties;
}
-
+
public static MemberInfo createMemberInfo(IMember member) {
-
try {
if (member instanceof IType)
return new TypeInfo((IType)member);
else if (member instanceof IField)
return new FieldInfo((IField)member);
else if (member instanceof IMethod)
- return new MethodInfo((IMethod)member);
+ return new MethodInfo((IMethod)member, null);
} catch (JavaModelException e) {
SeamCorePlugin.getPluginLog().logError(e);
}
-
+
return null;
}
-
+
static String[] resolveSignatures (IType type, String[] signatures) {
if (signatures == null || signatures.length == 0)
return new String[0];
-
+
String[] resolvedSignatures = new String[signatures.length];
for (int i = 0; i < signatures.length; i++) {
resolvedSignatures[i] = EclipseJavaUtil.resolveTypeAsString(type, signatures[i]);
}
return resolvedSignatures;
}
-
+
static String[] convertToStringArray(char[][] names) {
if (names == null || names.length == 0)
return new String[0];
@@ -707,24 +757,24 @@
return sNames;
}
- static String[] getClassNameFromCharArray (char[][] packageNames, char[][] classNames)
{
- if (packageNames == null || packageNames.length == 0)
+ static String[] getTypeErasureFromSignatureArray(String[] signatures) {
+ if (signatures == null || signatures.length == 0)
return new String[0];
- String[] qualifiedNames = new String[packageNames.length];
- for (int i = 0; i < qualifiedNames.length; i++) {
- qualifiedNames[i] = getQualifiedClassNameFromChars(packageNames[i], classNames[i]);
+ String[] result = new String[signatures.length];
+ for (int i = 0; i < signatures.length; i++) {
+ result[i] = Signature.getTypeErasure(signatures[i]);
}
- return qualifiedNames;
+ return result;
}
- static String[] getQualifiedClassNameFromCharArray (char[][] packageNames, char[][]
classNames) {
- if (packageNames == null || packageNames.length == 0)
+ static String[] getQualifiedClassNamesFromSignatureArray(String[] signatureTypes) {
+ if (signatureTypes == null || signatureTypes.length == 0)
return new String[0];
- String[] qualifiedNames = new String[packageNames.length];
- for (int i = 0; i < qualifiedNames.length; i++) {
- qualifiedNames[i] = getQualifiedClassNameFromChars(packageNames[i], classNames[i]);
+ String[] qualifiedTypes = new String[signatureTypes.length];
+ for (int i = 0; i < signatureTypes.length; i++) {
+ qualifiedTypes[i] = Signature.toString(signatureTypes[i]);
}
- return qualifiedNames;
+ return qualifiedTypes;
}
static String[] getQualifiedClassNameFromCharArray(char[][] signatureTypes) {
@@ -736,20 +786,4 @@
}
return qualifiedTypes;
}
-
- public static String getQualifiedClassNameFromChars (char[] packageName, char[]
className) {
- StringBuffer qualifiedName = new StringBuffer();
- if (packageName != null && packageName.length > 0)
- qualifiedName.append(packageName).append('.');
- qualifiedName.append(className);
- return qualifiedName.toString();
- }
-
- public static String getQualifiedClassName (String packageName, String className) {
- StringBuffer qualifiedName = new StringBuffer();
- if (packageName != null && packageName.length() > 0)
- qualifiedName.append(packageName).append('.');
- qualifiedName.append(className);
- return qualifiedName.toString();
- }
}
\ No newline at end of file