use of org.sonarsource.sonarlint.core.client.api.connected.UpdateResult in project sonarlint-core by SonarSource.
the class ConnectedSonarLintEngineImpl method update.
@Override
public UpdateResult update(ServerConfiguration serverConfig, @Nullable ProgressMonitor monitor) {
checkNotNull(serverConfig);
setLogging(null);
return withRwLock(() -> {
stop(false);
changeState(State.UPDATING);
List<SonarAnalyzer> analyzers;
try {
analyzers = runInConnectedContainer(serverConfig, container -> container.update(new ProgressWrapper(monitor)));
} finally {
start();
}
return new UpdateResult(getHandler().getGlobalStorageStatus(), analyzers);
});
}
use of org.sonarsource.sonarlint.core.client.api.connected.UpdateResult in project sonarlint-core by SonarSource.
the class ConnectedModeRequirementsTest method checkMinimalPluginVersionDuringGlobalUpdate.
@Test
public void checkMinimalPluginVersionDuringGlobalUpdate() throws IOException {
UpdateResult update = engine.update(config(), null);
assertThat(update.status().getLastUpdateDate()).isNotNull();
assertThat(engine.getLoadedAnalyzers().stream().map(LoadedAnalyzer::key)).doesNotContain("javascript");
}
use of org.sonarsource.sonarlint.core.client.api.connected.UpdateResult in project sonarlint-intellij by SonarSource.
the class ServerUpdateTask method run.
public void run(@NotNull ProgressIndicator indicator) {
indicator.setText("Fetching data...");
try {
TaskProgressMonitor monitor = new TaskProgressMonitor(indicator);
ServerConfiguration serverConfiguration = SonarLintUtils.getServerConfiguration(server);
if (!onlyModules) {
UpdateResult updateResult = engine.update(serverConfiguration, monitor);
Collection<SonarAnalyzer> tooOld = updateResult.analyzers().stream().filter(SonarAnalyzer::sonarlintCompatible).filter(ServerUpdateTask::tooOld).collect(Collectors.toList());
if (!tooOld.isEmpty()) {
ApplicationManager.getApplication().invokeAndWait(() -> Messages.showWarningDialog(buildMinimumVersionFailMessage(tooOld), "Analyzers Not Loaded"), ModalityState.any());
}
log.log("Server binding '" + server.getName() + "' updated", LogOutput.Level.INFO);
}
updateModules(serverConfiguration, monitor);
} catch (CanceledException e) {
LOGGER.info("Update of server '" + server.getName() + "' was cancelled");
log.log("Update of server '" + server.getName() + "' was cancelled", LogOutput.Level.INFO);
} catch (Exception e) {
LOGGER.info("Error updating from server '" + server.getName() + "'", e);
final String msg = (e.getMessage() != null) ? e.getMessage() : ("Failed to update binding for server configuration '" + server.getName() + "'");
ApplicationManager.getApplication().invokeAndWait(new RunnableAdapter() {
@Override
public void doRun() {
Messages.showErrorDialog((Project) null, msg, "Update Failed");
}
}, ModalityState.any());
}
}
Aggregations