private void addSelectionSetChildren()

in src/main/com/intellij/lang/jsgraphql/ide/structureView/GraphQLStructureViewTreeElement.java [116:153]


  private void addSelectionSetChildren(List<StructureViewTreeElement> children) {
    GraphQLSelectionSet selectionSet;
    if (childrenBase instanceof GraphQLSelectionSet) {
      selectionSet = (GraphQLSelectionSet)childrenBase;
    }
    else if (childrenBase instanceof GraphQLSelectionSetOperationDefinition) {
      selectionSet = ((GraphQLSelectionSetOperationDefinition)childrenBase).getSelectionSet();
    }
    else if (childrenBase instanceof GraphQLField) {
      selectionSet = ((GraphQLField)childrenBase).getSelectionSet();
    }
    else {
      return;
    }
    for (GraphQLSelection selection : selectionSet.getSelectionList()) {
      final GraphQLField field = selection.getField();
      if (field != null) {
        children.add(new GraphQLStructureViewTreeElement(field, field.getNameIdentifier()));
      }
      else {
        final GraphQLFragmentSelection fragmentSelection = selection.getFragmentSelection();
        if (fragmentSelection != null) {
          GraphQLFragmentSpread fragmentSpread = fragmentSelection.getFragmentSpread();
          if (fragmentSpread != null) {
            children.add(new GraphQLStructureViewTreeElement(fragmentSpread, fragmentSpread.getNameIdentifier()));
          }
          else {
            GraphQLInlineFragment inlineFragment = fragmentSelection.getInlineFragment();
            if (inlineFragment != null && inlineFragment.getSelectionSet() != null) {
              if (inlineFragment.getTypeCondition() != null && inlineFragment.getTypeCondition().getTypeName() != null) {
                children.add(new GraphQLStructureViewTreeElement(inlineFragment.getSelectionSet(), inlineFragment));
              }
            }
          }
        }
      }
    }
  }