Author: vrubezhny
Date: 2010-09-30 10:38:44 -0400 (Thu, 30 Sep 2010)
New Revision: 25333
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/TypeInfoCollector.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
Log:
JBIDE-7168
Code completion inserts methods with parameters.
The method parameters are shown with their types in the CA
The method parameters aren't to be inserted anymore by the CA
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java 2010-09-30
14:27:08 UTC (rev 25332)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java 2010-09-30
14:38:44 UTC (rev 25333)
@@ -719,6 +719,7 @@
if (methodPresentations != null) {
for (MemberPresentation presentation : methodPresentations) {
String presentationString = presentation.getPresentation();
+ String presentationDisplayName = presentation.getPresentationDisplayName();
MemberInfo member = presentation.getMember();
String sourceTypeName = member == null ? null :
member.getDeclaringTypeQualifiedName();
if (sourceTypeName != null && sourceTypeName.indexOf('.') != -1)
@@ -729,7 +730,7 @@
ELTextProposal proposal = new ELTextProposal();
proposal.setReplacementString(presentationString);
- proposal.setLabel(presentationString);
+ proposal.setLabel(presentationDisplayName);
proposal.setImage(getELProposalImage());
proposal.setType(typeName);
proposal.setSourceType(sourceTypeName);
@@ -764,6 +765,7 @@
if (propertyPresentations != null) {
for (MemberPresentation presentation : propertyPresentations) {
String presentationString = presentation.getPresentation();
+ String presentationDisplayName = presentation.getPresentationDisplayName();
MemberInfo member = presentation.getMember();
String sourceTypeName = member == null ? null :
member.getDeclaringTypeQualifiedName();
if (sourceTypeName != null && sourceTypeName.indexOf('.') != -1)
@@ -774,7 +776,7 @@
ELTextProposal proposal = new ELTextProposal();
proposal.setReplacementString(presentationString);
- proposal.setLabel(presentationString);
+ proposal.setLabel(presentationDisplayName);
proposal.setImage(getELProposalImage());
proposal.setType(typeName);
proposal.setSourceType(sourceTypeName);
@@ -862,7 +864,7 @@
ELTextProposal kbProposal = new ELTextProposal();
kbProposal.setReplacementString(proposal.getPresentation().substring(filter.length()));
- kbProposal.setLabel(proposal.getPresentation());
+ kbProposal.setLabel(proposal.getPresentationDisplayName());
kbProposal.setImage(getELProposalImage());
kbProposal.setType(typeName);
kbProposal.setSourceType(sourceTypeName);
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/TypeInfoCollector.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/TypeInfoCollector.java 2010-09-30
14:27:08 UTC (rev 25332)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/TypeInfoCollector.java 2010-09-30
14:38:44 UTC (rev 25333)
@@ -972,12 +972,14 @@
*/
public static class MemberPresentation {
private String presentation;
+ private String displayName;
private MemberInfo member;
private Set<MemberInfo> allMembers = new HashSet<MemberInfo>();
- public MemberPresentation(String presentation, MemberInfo member) {
+ public MemberPresentation(String presentation, String displayName, MemberInfo member)
{
super();
this.presentation = presentation;
+ this.displayName = displayName;
this.member = member;
addMember(member);
}
@@ -986,6 +988,10 @@
return presentation;
}
+ public String getPresentationDisplayName() {
+ return displayName;
+ }
+
public MemberInfo getMember() {
return member;
}
@@ -1069,6 +1075,7 @@
MethodInfo method = (MethodInfo)info;
StringBuffer name = new StringBuffer(method.getName());
+ StringBuffer displayName = new StringBuffer(method.getName());
boolean disabledGettersAndSettersView =
!ELCorePlugin.getDefault().getPreferenceStore().getBoolean(ELContentAssistPreferences.SHOW_GETTERS_AND_SETTERS)
&&
@@ -1082,19 +1089,27 @@
if (isValidating || enabledNonParenthesesView) {
// Add method as 'foo'
- methods.add(new MemberPresentation(name.toString(), method));
+ methods.add(new MemberPresentation(name.toString(), displayName.toString(),
method));
}
- // As requirement of JBIDE-7168: Add method as 'foo()' (do not extract the
parameters)
+ // As requirement of JBIDE-7168: Add method as 'foo()' (do not extract the
parameters),
+ // but show the method parameters with their types
name.append('(');
-// String[] mParams = method.getParameterNames();
-// for (int j = 0; mParams != null && j < mParams.length; j++) {
-// if (j > 0) name.append(", "); //$NON-NLS-1$
-// name.append(mParams[j]);
-// }
+ displayName.append('(');
+ String[] mParams = method.getParameterNames();
+ String[] mTypes = method.getParameterTypeNames();
+ for (int j = 0; mParams != null && j < mParams.length; j++) {
+ String typeName = mTypes[j] == null ? "" : mTypes[j]; //$NON-NLS-1$
+ if (typeName.indexOf('.') != -1)
+ typeName = typeName.substring(typeName.lastIndexOf('.') + 1);
+
+ if (j > 0) displayName.append(", "); //$NON-NLS-1$
+ displayName.append(typeName).append(' ').append(mParams[j]);
+ }
name.append(')');
+ displayName.append(')');
- methods.add(new MemberPresentation(name.toString(), method));
+ methods.add(new MemberPresentation(name.toString(), displayName.toString(), method));
}
return methods;
}
@@ -1195,7 +1210,7 @@
name.setCharAt(0, Character.toLowerCase(name.charAt(0)));
}
String propertyName = name.toString();
- MemberPresentation pr = new MemberPresentation(propertyName, m);
+ MemberPresentation pr = new MemberPresentation(propertyName, propertyName, m);
if(!properties.contains(pr)) {
properties.add(pr);
presentations.put(pr.getPresentation(), pr);
@@ -1219,7 +1234,7 @@
}
}
} else {
- MemberPresentation pr = new MemberPresentation(info.getName(), info);
+ MemberPresentation pr = new MemberPresentation(info.getName(), info.getName(),
info);
properties.add(pr);
presentations.put(pr.getPresentation(), pr);
}
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 2010-09-30
14:27:08 UTC (rev 25332)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2010-09-30
14:38:44 UTC (rev 25333)
@@ -212,7 +212,7 @@
protected void filterSingularMember(TypeInfoCollector.MemberInfo mbr,
Set<TypeInfoCollector.MemberPresentation> proposalsToFilter) {
Collection<String> keys = ((MessagesInfo)mbr).getKeys();
for (String key : keys) {
- proposalsToFilter.add(new TypeInfoCollector.MemberPresentation(key, mbr));
+ proposalsToFilter.add(new TypeInfoCollector.MemberPresentation(key, key, mbr));
}
}