StructureViewModel (@Nullable Editor editor) { List<StructureViewComposite.StructureViewDescriptor> viewDescriptors = new ArrayList<>(); for (Language language : myLanguageToBuilderMap.keySet()) { StructureViewBuilder builder = myLanguageToBuilderMap.get(language); if (!(builder instanceof TreeBasedStructureViewBuilder)) continue; StructureViewModel model = ((TreeBasedStructureViewBuilder)builder).createStructureViewModel(editor); String title = language.getDisplayName(); Icon icon = ObjectUtils.notNull(LanguageUtil.getLanguageFileType(language), FileTypes.UNKNOWN).getIcon(); viewDescriptors.add(new StructureViewComposite.StructureViewDescriptor(title, model, icon)); } PsiFile psiFile = Objects.requireNonNull(PsiManager.getInstance(myProject).findFile(myVirtualFile)); return new StructureViewCompositeModel(psiFile, editor, viewDescriptors); }