Fix for KT-1479 Can't see children of class object in structure view
This commit is contained in:
committed by
Nikolay Krasko
parent
190e539365
commit
52dcbb565f
@@ -47,7 +47,7 @@ public class JetStructureViewElement implements StructureViewTreeElement {
|
|||||||
// For file context will be updated after each construction
|
// For file context will be updated after each construction
|
||||||
// For other tree sub-elements it's immutable.
|
// For other tree sub-elements it's immutable.
|
||||||
private BindingContext context;
|
private BindingContext context;
|
||||||
|
|
||||||
private String elementText;
|
private String elementText;
|
||||||
|
|
||||||
public JetStructureViewElement(NavigatablePsiElement element, BindingContext context) {
|
public JetStructureViewElement(NavigatablePsiElement element, BindingContext context) {
|
||||||
@@ -78,7 +78,7 @@ public class JetStructureViewElement implements StructureViewTreeElement {
|
|||||||
public boolean canNavigateToSource() {
|
public boolean canNavigateToSource() {
|
||||||
return myElement.canNavigateToSource();
|
return myElement.canNavigateToSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemPresentation getPresentation() {
|
public ItemPresentation getPresentation() {
|
||||||
return new ItemPresentation() {
|
return new ItemPresentation() {
|
||||||
@@ -103,12 +103,12 @@ public class JetStructureViewElement implements StructureViewTreeElement {
|
|||||||
myElement,
|
myElement,
|
||||||
open ? Iconable.ICON_FLAG_OPEN : Iconable.ICON_FLAG_CLOSED);
|
open ? Iconable.ICON_FLAG_OPEN : Iconable.ICON_FLAG_CLOSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TreeElement[] getChildren() {
|
public TreeElement[] getChildren() {
|
||||||
if (myElement instanceof JetFile) {
|
if (myElement instanceof JetFile) {
|
||||||
@@ -132,6 +132,13 @@ public class JetStructureViewElement implements StructureViewTreeElement {
|
|||||||
else if (myElement instanceof JetClassOrObject) {
|
else if (myElement instanceof JetClassOrObject) {
|
||||||
return wrapDeclarations(((JetClassOrObject) myElement).getDeclarations());
|
return wrapDeclarations(((JetClassOrObject) myElement).getDeclarations());
|
||||||
}
|
}
|
||||||
|
else if (myElement instanceof JetClassObject) {
|
||||||
|
JetObjectDeclaration objectDeclaration = ((JetClassObject) myElement).getObjectDeclaration();
|
||||||
|
if (objectDeclaration != null) {
|
||||||
|
return wrapDeclarations(objectDeclaration.getDeclarations());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new TreeElement[0];
|
return new TreeElement[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,7 +172,7 @@ public class JetStructureViewElement implements StructureViewTreeElement {
|
|||||||
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TreeElement[] wrapDeclarations(List<JetDeclaration> declarations) {
|
private TreeElement[] wrapDeclarations(List<JetDeclaration> declarations) {
|
||||||
TreeElement[] result = new TreeElement[declarations.size()];
|
TreeElement[] result = new TreeElement[declarations.size()];
|
||||||
for (int i = 0; i < declarations.size(); i++) {
|
for (int i = 0; i < declarations.size(); i++) {
|
||||||
@@ -173,7 +180,7 @@ public class JetStructureViewElement implements StructureViewTreeElement {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getDescriptorTreeText(@NotNull DeclarationDescriptor descriptor) {
|
public static String getDescriptorTreeText(@NotNull DeclarationDescriptor descriptor) {
|
||||||
StringBuilder textBuilder;
|
StringBuilder textBuilder;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user