mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
prefer class to its members
This commit is contained in:
@@ -94,13 +94,19 @@ public class JavaCompletionSorting {
|
||||
}
|
||||
Object object = shorterElement.getObject();
|
||||
if (object instanceof PsiClass) {
|
||||
PsiFile file = ((PsiClass)object).getContainingFile();
|
||||
PsiClass psiClass = (PsiClass)object;
|
||||
PsiFile file = psiClass.getContainingFile();
|
||||
if (file != null) {
|
||||
VirtualFile vFile = file.getOriginalFile().getVirtualFile();
|
||||
if (vFile != null && fileIndex.isInSource(vFile)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Object longerObject = longerElement.getObject();
|
||||
if (longerObject instanceof PsiMember &&
|
||||
psiClass.getManager().areElementsEquivalent(psiClass, ((PsiMember)longerObject).getContainingClass())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import java.util.Calendar;
|
||||
|
||||
class Util {
|
||||
void foo() {
|
||||
Calendar.getInstance().get(Cale<caret>x)
|
||||
}
|
||||
|
||||
}
|
||||
+4
@@ -366,4 +366,8 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase {
|
||||
assertPreferredItems 0, 'get', 'getClass'
|
||||
}
|
||||
|
||||
public void testPreferClassToItsConstants() {
|
||||
checkPreferredItems 0, 'Calendar', 'Calendar.FIELD_COUNT'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user