use of org.sonarlint.intellij.trigger.SonarLintSubmitter in project sonarlint-intellij by SonarSource.
the class SonarAnalyzeFilesAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
Project project = e.getProject();
VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
if (project == null || project.isDisposed() || files == null || files.length == 0) {
return;
}
boolean hasProject = Arrays.stream(files).anyMatch(f -> f.getPath().equals(project.getBasePath()));
if (hasProject && !SonarAnalyzeAllFilesAction.showWarning()) {
return;
}
List<VirtualFile> fileList = Arrays.stream(files).flatMap(f -> {
if (f.isDirectory()) {
return VfsUtil.collectChildrenRecursively(f).stream();
} else {
return Stream.of(f);
}
}).distinct().collect(Collectors.toList());
SonarLintSubmitter submitter = SonarLintUtils.get(project, SonarLintSubmitter.class);
AnalysisCallback callback;
if (SonarLintToolWindowFactory.TOOL_WINDOW_ID.equals(e.getPlace())) {
callback = new ShowCurrentFileCallable(project);
} else {
callback = new ShowAnalysisResultsCallable(project, fileList, whatAnalyzed(fileList.size()));
}
submitter.submitFiles(fileList, TriggerType.ACTION, callback, executeBackground(e));
}
use of org.sonarlint.intellij.trigger.SonarLintSubmitter in project sonarlint-intellij by SonarSource.
the class SonarAnalyzeAllFilesAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
Project project = e.getProject();
if (project == null || ActionPlaces.PROJECT_VIEW_POPUP.equals(e.getPlace()) || !showWarning()) {
return;
}
SonarLintSubmitter submitter = SonarLintUtils.get(project, SonarLintSubmitter.class);
Collection<VirtualFile> allFiles = getAllFiles(project);
AnalysisCallback callback = new ShowAnalysisResultsCallable(project, allFiles, "all project files");
submitter.submitFiles(allFiles, TriggerType.ALL, callback, false);
}
use of org.sonarlint.intellij.trigger.SonarLintSubmitter in project sonarlint-intellij by SonarSource.
the class SonarAnalyzeChangedFilesAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
Project project = e.getProject();
if (project == null || ActionPlaces.PROJECT_VIEW_POPUP.equals(e.getPlace())) {
return;
}
SonarLintSubmitter submitter = SonarLintUtils.get(project, SonarLintSubmitter.class);
ChangeListManager changeListManager = ChangeListManager.getInstance(project);
List<VirtualFile> affectedFiles = changeListManager.getAffectedFiles();
AnalysisCallback callback = new ShowAnalysisResultsCallable(project, affectedFiles, "SCM changed files");
submitter.submitFiles(affectedFiles, TriggerType.CHANGED_FILES, callback, false);
}
use of org.sonarlint.intellij.trigger.SonarLintSubmitter in project sonarlint-intellij by SonarSource.
the class ServerUpdateTask method analyzeOpenFiles.
private static void analyzeOpenFiles(Project project) {
if (!project.isDisposed()) {
SonarLintConsole console = SonarLintConsole.get(project);
console.info("Clearing all issues because binding was updated");
IssueManager store = SonarLintUtils.get(project, IssueManager.class);
store.clear();
SonarLintSubmitter submitter = SonarLintUtils.get(project, SonarLintSubmitter.class);
submitter.submitOpenFilesAuto(TriggerType.BINDING_UPDATE);
}
}
Aggregations