don't advertise class-name completion in lookups

This commit is contained in:
peter
2012-06-27 18:06:22 +02:00
parent a0377d60ef
commit 37e35440ac
7 changed files with 15 additions and 16 deletions
@@ -471,9 +471,9 @@ public class JavaCompletionContributor extends CompletionContributor {
PsiElement position = parameters.getPosition();
if (psiElement().withParent(psiReferenceExpression().withFirstChild(psiReferenceExpression().referencing(psiClass()))).accepts(position)) {
if (CompletionUtil.shouldShowFeature(parameters, JavaCompletionFeatures.GLOBAL_MEMBER_NAME)) {
final String shortcut = getActionShortcut(IdeActions.ACTION_CLASS_NAME_COMPLETION);
final String shortcut = getActionShortcut(IdeActions.ACTION_CODE_COMPLETION);
if (shortcut != null) {
return "Pressing " + shortcut + " without a class qualifier would show all accessible static methods";
return "Pressing " + shortcut + " twice without a class qualifier would show all accessible static methods";
}
}
}
@@ -490,7 +490,7 @@ public class JavaCompletionContributor extends CompletionContributor {
if (parameters.getCompletionType() != CompletionType.CLASS_NAME && shouldSuggestClassNameCompletion(parameters.getPosition())) {
if (CompletionUtil.shouldShowFeature(parameters, CodeCompletionFeatures.EDITING_COMPLETION_CLASSNAME)) {
final String shortcut = getActionShortcut(IdeActions.ACTION_CLASS_NAME_COMPLETION);
final String shortcut = getActionShortcut(IdeActions.ACTION_CODE_COMPLETION);
if (shortcut != null) {
return CompletionBundle.message("completion.class.name.hint", shortcut);
}
@@ -68,10 +68,9 @@ public class FilePathCompletionContributor extends CompletionContributor {
@NotNull CompletionResultSet result) {
final PsiReference psiReference = parameters.getPosition().getContainingFile().findReferenceAt(parameters.getOffset());
if (getReference(psiReference) != null) {
final String shortcut = getActionShortcut(IdeActions.ACTION_CLASS_NAME_COMPLETION);
final CompletionService service = CompletionService.getCompletionService();
if (/*StringUtil.isEmpty(service.getAdvertisementText()) &&*/ shortcut != null) {
service.setAdvertisementText(CodeInsightBundle.message("class.completion.file.path", shortcut));
final String shortcut = getActionShortcut(IdeActions.ACTION_CODE_COMPLETION);
if (shortcut != null) {
CompletionService.getCompletionService().setAdvertisementText(CodeInsightBundle.message("class.completion.file.path", shortcut));
}
}
}
@@ -166,10 +165,10 @@ public class FilePathCompletionContributor extends CompletionContributor {
}
if (set.getSuitableFileTypes().length > 0 && parameters.getInvocationCount() == 1) {
final String shortcut = getActionShortcut(IdeActions.ACTION_CLASS_NAME_COMPLETION);
final CompletionService service = CompletionService.getCompletionService();
final String shortcut = getActionShortcut(IdeActions.ACTION_CODE_COMPLETION);
if (shortcut != null) {
service.setAdvertisementText(CodeInsightBundle.message("class.completion.file.path.all.variants", shortcut));
CompletionService.getCompletionService()
.setAdvertisementText(CodeInsightBundle.message("class.completion.file.path.all.variants", shortcut));
}
}
@@ -67,7 +67,7 @@ public interface IdeActions {
@NonNls String ACTION_SHOW_INTENTION_ACTIONS = "ShowIntentionActions";
@NonNls String ACTION_CODE_COMPLETION = "CodeCompletion";
@NonNls String ACTION_SMART_TYPE_COMPLETION = "SmartTypeCompletion";
@NonNls String ACTION_CLASS_NAME_COMPLETION = "ClassNameCompletion";
@Deprecated @NonNls String ACTION_CLASS_NAME_COMPLETION = "ClassNameCompletion";
@NonNls String ACTION_CHOOSE_LOOKUP_ITEM = "EditorChooseLookupItem";
@NonNls String ACTION_CHOOSE_LOOKUP_ITEM_ALWAYS = "EditorChooseLookupItemAlways";
@NonNls String ACTION_CHOOSE_LOOKUP_ITEM_REPLACE = "EditorChooseLookupItemReplace";
@@ -468,7 +468,7 @@ i18nize.empty.file.path=Please specify properties file path
choose.type.popup.title=Choose Type
cast.expression=Cast expression
cast.to.0=Cast to ''{0}''
class.completion.file.path=Press {0} to search for all matching project files
class.completion.file.path=Press {0} again to search for all matching project files
class.completion.file.path.all.variants=Press {0} to search for matching files of any type
property.has.more.parameters.than.passed=Property ''{0}'' expected {1} {1, choice, 1#parameter|2#parameters}, passed {2}
create.file.family=Create File
@@ -239,9 +239,9 @@ public class GroovyCompletionContributor extends CompletionContributor {
if (CompletionService.getCompletionService().getAdvertisementText() == null && parameters.getInvocationCount() > 0 &&
CompletionUtil.shouldShowFeature(parameters, JavaCompletionFeatures.GLOBAL_MEMBER_NAME)) {
final String shortcut = getActionShortcut(IdeActions.ACTION_CLASS_NAME_COMPLETION);
final String shortcut = getActionShortcut(IdeActions.ACTION_CODE_COMPLETION);
if (shortcut != null) {
CompletionService.getCompletionService().setAdvertisementText("Pressing " + shortcut + " without a class qualifier would show all accessible static methods");
CompletionService.getCompletionService().setAdvertisementText("Pressing " + shortcut + " twice without a class qualifier would show all accessible static methods");
}
}
@@ -6,5 +6,5 @@ completion.smart.hint=Press {0} to show only variants that are suitable by type
completion.smart.chain.hint=Press {0} once more to search across chained method calls
completion.smart.toar.hint=Press {0} once more to find collections of {1}
completion.smart.aslist.hint=Press {0} once more to find arrays of {1}
completion.class.name.hint=Press {0} to view all accessible classes
completion.class.name.hint=Press {0} again to view all accessible classes
completion.class.name.hint.2=Press {0} once more to ignore module dependencies while searching
@@ -193,7 +193,7 @@ public class XmlCompletionContributor extends CompletionContributor {
public String advertise(@NotNull final CompletionParameters parameters) {
if (isXmlNameCompletion(parameters) && parameters.getCompletionType() == CompletionType.BASIC) {
if (FeatureUsageTracker.getInstance().isToBeAdvertisedInLookup(TAG_NAME_COMPLETION_FEATURE, parameters.getPosition().getProject())) {
final String shortcut = getActionShortcut(IdeActions.ACTION_CLASS_NAME_COMPLETION);
final String shortcut = getActionShortcut(IdeActions.ACTION_CODE_COMPLETION);
if (shortcut != null) {
return XmlBundle.message("tag.name.completion.hint", shortcut);
}