Search in sources :

Example 1 with CreateNewLibraryDialog

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;
}
Also used : CreateNewLibraryDialog(com.intellij.openapi.roots.ui.configuration.libraryEditor.CreateNewLibraryDialog) Module(com.intellij.openapi.module.Module) NewLibraryEditor(com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Module (com.intellij.openapi.module.Module)1 CreateNewLibraryDialog (com.intellij.openapi.roots.ui.configuration.libraryEditor.CreateNewLibraryDialog)1 NewLibraryEditor (com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor)1 Nullable (org.jetbrains.annotations.Nullable)1