Search in sources :

Example 1 with ServerDownloadProjectTask

use of org.sonarlint.intellij.tasks.ServerDownloadProjectTask in project sonarlint-intellij by SonarSource.

the class SonarLintProjectBindPanel method downloadProjectList.

/**
 * Assumes that it's bound and a server is selected
 */
@CheckForNull
private Map<String, RemoteModule> downloadProjectList() {
    ApplicationManager.getApplication().assertIsDispatchThread();
    SonarQubeServer selectedServer = getSelectedServer();
    String storageId = getSelectedStorageId();
    if (selectedServer == null || storageId == null) {
        return null;
    }
    SonarLintEngineManager core = SonarLintUtils.get(SonarLintEngineManager.class);
    ConnectedSonarLintEngine engine = core.getConnectedEngine(storageId);
    ServerDownloadProjectTask downloadTask = new ServerDownloadProjectTask(project, engine, selectedServer);
    try {
        ProgressManager.getInstance().run(downloadTask);
        return downloadTask.getResult();
    } catch (Exception e) {
        String msg = e.getMessage() != null ? e.getMessage() : "Failed to download list of projects";
        Messages.showErrorDialog(rootPanel, msg, "Error Downloading Project List");
        return null;
    }
}
Also used : SonarQubeServer(org.sonarlint.intellij.config.global.SonarQubeServer) ServerDownloadProjectTask(org.sonarlint.intellij.tasks.ServerDownloadProjectTask) SonarLintEngineManager(org.sonarlint.intellij.core.SonarLintEngineManager) ConnectedSonarLintEngine(org.sonarsource.sonarlint.core.client.api.connected.ConnectedSonarLintEngine) CheckForNull(javax.annotation.CheckForNull)

Aggregations

CheckForNull (javax.annotation.CheckForNull)1 SonarQubeServer (org.sonarlint.intellij.config.global.SonarQubeServer)1 SonarLintEngineManager (org.sonarlint.intellij.core.SonarLintEngineManager)1 ServerDownloadProjectTask (org.sonarlint.intellij.tasks.ServerDownloadProjectTask)1 ConnectedSonarLintEngine (org.sonarsource.sonarlint.core.client.api.connected.ConnectedSonarLintEngine)1