a completion hint advising to press left arrow
authorpeter <peter.gromov@jetbrains.com>
Sat, 28 Aug 2010 16:21:56 +0000 (17:21 +0100)
committerpeter <peter.gromov@jetbrains.com>
Sun, 29 Aug 2010 08:40:15 +0000 (09:40 +0100)
java/java-impl/src/com/intellij/codeInsight/completion/JavaGlobalMemberNameCompletionContributor.java

index 0ffc2b4f448cee9359def3f29b79fff047ec19a2..eae285258414f478232ddcbdd430b4eafbe48ef6 100644 (file)
@@ -76,6 +76,7 @@ public class JavaGlobalMemberNameCompletionContributor extends CompletionContrib
         return namesCache.getAllMethodNames();
       }
     });
+    final boolean[] hintShown = {false};
     for (final String methodName : methodNames) {
       if (matcher.prefixMatches(methodName)) {
         final PsiMethod[] methods = ApplicationManager.getApplication().runReadAction(new Computable<PsiMethod[]>() {
@@ -90,6 +91,11 @@ public class JavaGlobalMemberNameCompletionContributor extends CompletionContrib
                 final PsiClass containingClass = method.getContainingClass();
                 if (containingClass != null) {
                   if (!JavaCompletionUtil.isInExcludedPackage(containingClass) && !StaticImportMethodFix.isExcluded(method)) {
+                    if (!hintShown[0] && CompletionService.getCompletionService().getAdvertisementText() == null) {
+                      CompletionService.getCompletionService().setAdvertisementText("To import the method statically, press Left");
+                      hintShown[0] = true;
+                    }
+
                     result.addElement(new JavaGlobalMemberLookupElement(method, containingClass, qualifiedInsert, importInsert));
                   }