FileStructurePopup (@NotNull Project project, @NotNull FileEditor fileEditor) { PsiDocumentManager.getInstance(project).commitAllDocuments(); StructureViewBuilder builder = fileEditor.getStructureViewBuilder(); if (builder == null) return null; project.getMessageBus().syncPublisher(FileStructurePopupListener.TOPIC).stateChanged(true); StructureView structureView; StructureViewModel treeModel; if (builder instanceof TreeBasedStructureViewBuilder) { structureView = null; treeModel = ((TreeBasedStructureViewBuilder)builder).createStructureViewModel(EditorUtil.getEditorEx(fileEditor)); } else { structureView = builder.createStructureView(fileEditor, project); treeModel = createStructureViewModel(project, fileEditor, structureView); } if (treeModel instanceof PlaceHolder) { //noinspection unchecked ((PlaceHolder)treeModel).setPlace(TreeStructureUtil.PLACE); } FileStructurePopup popup = new FileStructurePopup(project, fileEditor, treeModel); if (structureView != null) Disposer.register(popup, structureView); return popup; }