mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-188425 Add getInstance option in completion popup
This commit is contained in:
+8
@@ -364,6 +364,14 @@ public class JavaMemberNameCompletionContributor extends CompletionContributor {
|
||||
.withInsertHandler(ParenthesesInsertHandler.NO_PARAMETERS));
|
||||
}
|
||||
|
||||
if (element instanceof PsiField && ((PsiField)element).hasModifierProperty(PsiModifier.STATIC) &&
|
||||
ourClassParent.equals(PsiUtil.resolveClassInClassTypeOnly(((PsiField)element).getType()))) {
|
||||
set.add(LookupElementBuilder.create("getInstance")
|
||||
.withIcon(PlatformIcons.METHOD_ICON)
|
||||
.withTailText("()")
|
||||
.withInsertHandler(ParenthesesInsertHandler.WITH_PARAMETERS));
|
||||
|
||||
}
|
||||
addLookupItems(set, null, matcher, element.getProject(), getUnresolvedReferences(ourClassParent, true));
|
||||
|
||||
addLookupItems(set, null, matcher, element.getProject(), getPropertiesHandlersNames(
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
public class Util {
|
||||
static Util getI<caret>
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
public class Util {
|
||||
static Util getInstance(<caret>)
|
||||
}
|
||||
+2
@@ -1850,4 +1850,6 @@ class Bar {{
|
||||
doTest('\n')
|
||||
}
|
||||
|
||||
void testSuggestGetInstanceMethodName() { doTest() }
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user