use of org.sonarsource.sonarlint.core.client.api.connected.ConnectedSonarLintEngine in project sonarlint-intellij by SonarSource.
the class SonarLintEngineManager method getConnectedEngine.
public synchronized ConnectedSonarLintEngine getConnectedEngine(String serverId) {
if (!engines.containsKey(serverId)) {
ConnectedSonarLintEngine engine = engineFactory.createEngine(serverId);
engines.put(serverId, engine);
}
return engines.get(serverId);
}
use of org.sonarsource.sonarlint.core.client.api.connected.ConnectedSonarLintEngine 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;
}
}
use of org.sonarsource.sonarlint.core.client.api.connected.ConnectedSonarLintEngine in project sonarlint-intellij by SonarSource.
the class SonarLintProjectConfigurable method onSave.
/**
* When we save the binding, we need to:
* - Send a message for listeners interested in it
* - If we are bound to a module, update it (even if we detected no changes)
* - Clear all issues and submit an analysis on all open files
*/
private void onSave() {
SonarLintProjectNotifications.get(project).reset();
ProjectConfigurationListener projectListener = project.getMessageBus().syncPublisher(ProjectConfigurationListener.TOPIC);
if (projectSettings.isBindingEnabled() && projectSettings.getProjectKey() != null && projectSettings.getServerId() != null) {
ProjectBindingManager bindingManager = SonarLintUtils.get(project, ProjectBindingManager.class);
try {
SonarQubeServer server = bindingManager.getSonarQubeServer();
ConnectedSonarLintEngine engine = bindingManager.getConnectedEngineSkipChecks();
String moduleKey = projectSettings.getProjectKey();
ServerUpdateTask task = new ServerUpdateTask(engine, server, Collections.singletonMap(moduleKey, Collections.singletonList(project)), true);
ProgressManager.getInstance().run(task.asModal());
} catch (InvalidBindingException e) {
// nothing to do, SonarLintEngineManager should have already shown a warning
}
}
projectListener.changed(projectSettings);
}
use of org.sonarsource.sonarlint.core.client.api.connected.ConnectedSonarLintEngine in project sonarlint-core by SonarSource.
the class ServerIssueTrackerTest method should_download_issues_from_engine.
@Test
public void should_download_issues_from_engine() {
String moduleKey = "dummy module";
String filePath = "dummy file";
ConnectedSonarLintEngine engine = mock(ConnectedSonarLintEngine.class);
ServerConfiguration serverConfiguration = mock(ServerConfiguration.class);
ServerIssueTracker tracker = new ServerIssueTracker(mock(Logger.class), mock(Console.class), mock(CachingIssueTracker.class));
tracker.update(serverConfiguration, engine, moduleKey, Collections.singleton(filePath));
verify(engine).downloadServerIssues(serverConfiguration, moduleKey, filePath);
verifyNoMoreInteractions(engine);
}
use of org.sonarsource.sonarlint.core.client.api.connected.ConnectedSonarLintEngine in project sonarlint-intellij by SonarSource.
the class ProjectBindingManager method getFacade.
public synchronized SonarLintFacade getFacade(boolean logDetails) throws InvalidBindingException {
if (projectSettings.isBindingEnabled()) {
String serverId = projectSettings.getServerId();
String projectKey = projectSettings.getProjectKey();
checkBindingStatus(notifications, serverId, projectKey);
if (logDetails) {
console.info(String.format("Using configuration of '%s' in server '%s'", projectKey, serverId));
}
ConnectedSonarLintEngine engine = engineManager.getConnectedEngine(notifications, serverId, projectKey);
return new ConnectedSonarLintFacade(engine, projectSettings, console, myProject, projectKey);
}
return new StandaloneSonarLintFacade(projectSettings, console, myProject, engineManager.getStandaloneEngine());
}
Aggregations