Implement call hierarchy

This commit is contained in:
Alexey Sedunov
2013-09-11 15:23:22 +04:00
parent e4936549ee
commit 41ea7da1e3
61 changed files with 1987 additions and 20 deletions
@@ -102,17 +102,17 @@ public class JetObjectDeclaration extends JetNamedDeclarationStub<PsiJetObjectSt
@Override
@Nullable
public JetModifierList getModifierList() {
PsiElement parent = getParent();
if (isClassObject(parent)) {
if (isClassObject()) {
PsiElement parent = getParent();
assert parent instanceof JetDeclaration;
return ((JetDeclaration)parent).getModifierList();
}
return (JetModifierList) findChildByType(JetNodeTypes.MODIFIER_LIST);
}
private static boolean isClassObject(@NotNull PsiElement parent) {
return parent.getNode().getElementType().equals(JetNodeTypes.CLASS_OBJECT);
public boolean isClassObject() {
PsiElement parent = getParent();
return parent != null && parent.getNode().getElementType().equals(JetNodeTypes.CLASS_OBJECT);
}
@Override
@@ -1021,4 +1021,12 @@ public class JetPsiUtil {
}
}
}
@Nullable
public static String getPackageName(@NotNull JetElement element) {
JetFile file = (JetFile) element.getContainingFile();
JetNamespaceHeader header = PsiTreeUtil.findChildOfType(file, JetNamespaceHeader.class);
return header != null ? header.getQualifiedName() : null;
}
}