use of com.intellij.openapi.roots.ui.configuration.libraryEditor.CreateNewLibraryDialog in project intellij-community by JetBrains.
the class NewLibraryChooser method createLibrary.
@Nullable
public Library createLibrary() {
final NewLibraryConfiguration configuration = CreateNewLibraryAction.createNewLibraryConfiguration(myLibraryType, myParentComponent, myProject);
if (configuration == null)
return null;
final NewLibraryEditor libraryEditor = new NewLibraryEditor(configuration.getLibraryType(), configuration.getProperties());
libraryEditor.setName(configuration.getDefaultLibraryName());
configuration.addRoots(libraryEditor);
final LibraryTablesRegistrar registrar = LibraryTablesRegistrar.getInstance();
List<LibraryTable> tables = Arrays.asList(myRootModel.getModuleLibraryTable(), registrar.getLibraryTable(myProject), registrar.getLibraryTable());
CreateNewLibraryDialog dialog = new CreateNewLibraryDialog(myParentComponent, myContext, libraryEditor, tables, 1);
final Module contextModule = LangDataKeys.MODULE_CONTEXT.getData(DataManager.getInstance().getDataContext(myParentComponent));
dialog.setContextModule(contextModule);
if (dialog.showAndGet()) {
return dialog.createLibrary();
}
return null;
}
Aggregations