NodeDescriptor (@NotNull Object element, NodeDescriptor parentDescriptor) { if (element instanceof Application) return new RootDescriptor(myProject); if (element instanceof Project project) return new ProjectDescriptor(myProject, project); if (element instanceof Module module) return new ModuleDescriptor(myProject, parentDescriptor, module); if (element instanceof LibraryTable libraryTable) { return new LibraryTableDescriptor(myProject, parentDescriptor, libraryTable, getLibraryTableWeight(libraryTable), isAutoExpandLibraryTable(libraryTable)); } if (element instanceof Library library) return createLibraryDescriptor(parentDescriptor, library); throw new AssertionError(); }