Search in sources :

Example 1 with InformationFetchTask

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

the class AuthStep method fetchInformation.

private void fetchInformation() throws CommitStepException {
    SonarQubeServer tmpServer = model.createServerWithoutOrganization();
    InformationFetchTask task = new InformationFetchTask(tmpServer);
    ProgressManager.getInstance().run(task);
    if (task.getException() == null) {
        model.setOrganizationList(task.organizations());
        if (task.organizations().size() == 1) {
            model.setOrganization(task.organizations().iterator().next().getKey());
        } else if (task.organizations().isEmpty()) {
            model.setOrganization(null);
        }
        model.setNotificationsSupported(task.notificationsSupported());
        return;
    }
    String msg = "Failed to fetch information from the server. Please check the configuration and try again.";
    if (task.getException().getMessage() != null) {
        msg = msg + " Error: " + task.getException().getMessage();
    }
    throw new CommitStepException(msg);
}
Also used : InformationFetchTask(org.sonarlint.intellij.tasks.InformationFetchTask) CommitStepException(com.intellij.ide.wizard.CommitStepException) SonarQubeServer(org.sonarlint.intellij.config.global.SonarQubeServer)

Aggregations

CommitStepException (com.intellij.ide.wizard.CommitStepException)1 SonarQubeServer (org.sonarlint.intellij.config.global.SonarQubeServer)1 InformationFetchTask (org.sonarlint.intellij.tasks.InformationFetchTask)1