CompletionProposalLabelProvider: spaces in return type separator, bug 403751
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/CompletionProposalLabelProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/CompletionProposalLabelProvider.java
index 9e46d0b..812dc6f 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/CompletionProposalLabelProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/CompletionProposalLabelProvider.java
@@ -166,11 +166,11 @@
if (!method.isConstructor()) {
String type = method.getType();
if (type != null) {
- buffer.append(": ").append(type);
+ buffer.append(getReturnTypeSeparator()).append(type);
}
IType declaringType = method.getDeclaringType();
if (declaringType != null) {
- buffer.append(" - ").append(
+ buffer.append(getQualifierSeparator()).append(
declaringType.getElementName());
}
}
@@ -230,7 +230,7 @@
final ILocalVariable var = (ILocalVariable) element;
String type = var.getType();
if (type != null) {
- return proposal.getName() + ": " + type;
+ return proposal.getName() + getReturnTypeSeparator() + type;
}
}
return proposal.getName();
@@ -244,7 +244,7 @@
try {
String type = field.getType();
if (type != null) {
- return proposal.getName() + ": " + type;
+ return proposal.getName() + getReturnTypeSeparator() + type;
}
} catch (ModelException e) {
// ignore
@@ -366,8 +366,7 @@
.getFlags()), proposal);
}
- public ImageDescriptor createTypeImageDescriptor(
- CompletionProposal proposal) {
+ public ImageDescriptor createTypeImageDescriptor(CompletionProposal proposal) {
// boolean isInterfaceOrAnnotation= Flags.isInterface(flags) ||
// Flags.isAnnotation(flags);
return decorateImageDescriptor(
@@ -434,4 +433,24 @@
void setContext(CompletionContext context) {
// fContext = context;
}
+
+ /**
+ * Returns an user-readable string for separating the return type (e.g.
+ * " : ").
+ *
+ * @since 5.1
+ */
+ protected String getReturnTypeSeparator() {
+ return ScriptTextMessages.CompletionProposalLabelProvider_returnTypeSeparator;
+ }
+
+ /**
+ * Returns an user-readable string for separating post qualified names (e.g.
+ * " - ").
+ *
+ * @since 5.1
+ */
+ protected String getQualifierSeparator() {
+ return ScriptTextMessages.CompletionProposalLabelProvider_qualifierSeparator;
+ }
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptTextMessages.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptTextMessages.java
index 04cb63b..0e298f3 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptTextMessages.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptTextMessages.java
@@ -51,6 +51,8 @@
public static String CompletionProposalComputerDescriptor_blame_message;
public static String CompletionProposalComputerRegistry_invalid_message;
public static String CompletionProposalComputerRegistry_error_dialog_title;
+ public static String CompletionProposalLabelProvider_qualifierSeparator;
+ public static String CompletionProposalLabelProvider_returnTypeSeparator;
public static String ContentAssistProcessor_defaultProposalCategory;
public static String ContentAssistProcessor_toggle_affordance_press_gesture;
public static String ContentAssistProcessor_toggle_affordance_click_gesture;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptTextMessages.properties b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptTextMessages.properties
index 3ef918e..b4b8d13 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptTextMessages.properties
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptTextMessages.properties
@@ -33,6 +33,8 @@
CompletionProposalComputerDescriptor_blame_message= The ''{0}'' proposal computer from the ''{1}'' plug-in did not complete normally.
# {0} is the identifier of an extension, {1} the contributing plug-in, {2} a required but missing xml attribute
CompletionProposalComputerDescriptor_illegal_attribute_message= The extension ''{0}'' from plug-in ''{1}'' did not specify a value for the required ''{2}'' attribute. Disabling the extension.
+CompletionProposalLabelProvider_qualifierSeparator=\ -\
+CompletionProposalLabelProvider_returnTypeSeparator=\ :\
# {0} is the name of an extension, {1} the id of the extension
ProposalSorterHandle_blame= Found a problem with the ''{0}'' ({1}) extension to the "scriptCompletionProposalSorters" extension point.