Search in sources :

Example 1 with RepositoryAttachDialog

use of org.jetbrains.idea.maven.utils.RepositoryAttachDialog in project intellij-community by JetBrains.

the class RepositoryAttachHandler method chooseLibraryAndDownload.

@Nullable
public static NewLibraryConfiguration chooseLibraryAndDownload(@NotNull final Project project, @Nullable final String initialFilter, JComponent parentComponent) {
    RepositoryAttachDialog dialog = new RepositoryAttachDialog(project, initialFilter);
    dialog.setTitle("Download Library From Maven Repository");
    dialog.show();
    if (dialog.getExitCode() != DialogWrapper.OK_EXIT_CODE) {
        return null;
    }
    String copyTo = dialog.getDirectoryPath();
    String coord = dialog.getCoordinateText();
    boolean attachJavaDoc = dialog.getAttachJavaDoc();
    boolean attachSources = dialog.getAttachSources();
    List<MavenRepositoryInfo> repositories = dialog.getRepositories();
    @Nullable NewLibraryConfiguration configuration = resolveAndDownload(project, coord, attachJavaDoc, attachSources, copyTo, repositories);
    if (configuration == null) {
        Messages.showErrorDialog(parentComponent, ProjectBundle.message("maven.downloading.failed", coord), CommonBundle.getErrorTitle());
    }
    return configuration;
}
Also used : RepositoryAttachDialog(org.jetbrains.idea.maven.utils.RepositoryAttachDialog) Nullable(org.jetbrains.annotations.Nullable) NewLibraryConfiguration(com.intellij.openapi.roots.libraries.NewLibraryConfiguration) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

NewLibraryConfiguration (com.intellij.openapi.roots.libraries.NewLibraryConfiguration)1 Nullable (org.jetbrains.annotations.Nullable)1 RepositoryAttachDialog (org.jetbrains.idea.maven.utils.RepositoryAttachDialog)1