Object (@NotNull Project project, @NotNull FileEditor editor, @NotNull StructureViewBuilder builder) { if (builder instanceof TreeBasedStructureViewBuilder) { return getElementFromStructureTreeView(editor, (TreeBasedStructureViewBuilder)builder); } StructureView structureView = builder.createStructureView(editor, project); Object selectorInFile = structureView.getTreeModel().getCurrentEditorElement(); Disposer.dispose(structureView); return selectorInFile; }