diff --git a/src/main/com/intellij/lang/jsgraphql/endpoint/ide/structureView/JSGraphQLEndpointStructureViewTreeElement.java b/src/main/com/intellij/lang/jsgraphql/endpoint/ide/structureView/JSGraphQLEndpointStructureViewTreeElement.java index 4fb3c697..baed59d6 100644 --- a/src/main/com/intellij/lang/jsgraphql/endpoint/ide/structureView/JSGraphQLEndpointStructureViewTreeElement.java +++ b/src/main/com/intellij/lang/jsgraphql/endpoint/ide/structureView/JSGraphQLEndpointStructureViewTreeElement.java @@ -43,16 +43,14 @@ public JSGraphQLEndpointStructureViewTreeElement(PsiElement childrenBase, PsiEle public Collection getChildrenBase() { final Collection children = Lists.newArrayList(); if (childrenBase instanceof PsiFile) { - final JSGraphQLEndpointNamedTypeDefinition[] typeDefinitions = PsiTreeUtil.getChildrenOfType( - childrenBase, - JSGraphQLEndpointNamedTypeDefinition.class - ); - if (typeDefinitions != null) { - for (JSGraphQLEndpointNamedTypeDefinition typeDefinition : typeDefinitions) { + for (PsiElement child : childrenBase.getChildren()) { + if (child instanceof JSGraphQLEndpointNamedTypeDefinition) { + final JSGraphQLEndpointNamedTypeDefinition typeDefinition = (JSGraphQLEndpointNamedTypeDefinition) child; children.add(new JSGraphQLEndpointStructureViewTreeElement(typeDefinition, typeDefinition.getNamedTypeDef())); + } else if (child instanceof JSGraphQLEndpointImportDeclaration) { + children.add(new JSGraphQLEndpointStructureViewTreeElement(child, child)); } } - } else if (childrenBase instanceof JSGraphQLEndpointNamedTypeDefinition) { childrenBase.accept(new PsiRecursiveElementVisitor() { @Override @@ -91,6 +89,9 @@ public void visitElement(PsiElement element) { @Nullable @Override public String getPresentableText() { + if(element instanceof JSGraphQLEndpointImportDeclaration) { + return element.getText(); + } final PsiNameIdentifierOwner identifier = PsiTreeUtil.getChildOfType(element, PsiNameIdentifierOwner.class); if (identifier != null) { return identifier.getText(); @@ -99,7 +100,7 @@ public String getPresentableText() { if (astIdentifier != null && astIdentifier.getElementType() == JSGraphQLEndpointTokenTypes.IDENTIFIER) { return astIdentifier.getText(); } - if(element instanceof PsiFile) { + if (element instanceof PsiFile) { return null; } return element.getText(); diff --git a/src/main/com/intellij/lang/jsgraphql/endpoint/psi/JSGraphQLEndpointIconProvider.java b/src/main/com/intellij/lang/jsgraphql/endpoint/psi/JSGraphQLEndpointIconProvider.java index 20365fc1..282b26a8 100644 --- a/src/main/com/intellij/lang/jsgraphql/endpoint/psi/JSGraphQLEndpointIconProvider.java +++ b/src/main/com/intellij/lang/jsgraphql/endpoint/psi/JSGraphQLEndpointIconProvider.java @@ -42,6 +42,9 @@ public Icon getIcon(@NotNull PsiElement element, @Iconable.IconFlags int flags) if (element instanceof JSGraphQLEndpointInputValueDefinition) { return JSGraphQLIcons.Schema.Attribute; } + if(element instanceof JSGraphQLEndpointImportDeclaration) { + return JSGraphQLIcons.Files.GraphQLSchema; + } return null; }