use of org.sonarsource.sonarlint.core.client.api.connected.RemoteModule in project sonarlint-core by SonarSource.
the class AllModulesReader method get.
@Override
public Map<String, RemoteModule> get() {
Map<String, RemoteModule> results = new HashMap<>();
ModuleList readModuleListFromStorage = storageReader.readModuleList();
Map<String, Module> modulesByKey = readModuleListFromStorage.getModulesByKeyMap();
for (Map.Entry<String, Module> entry : modulesByKey.entrySet()) {
results.put(entry.getKey(), new DefaultRemoteModule(entry.getValue()));
}
return results;
}
use of org.sonarsource.sonarlint.core.client.api.connected.RemoteModule in project sonarlint-intellij by SonarSource.
the class SearchProjectKeyDialog method setProjectsInList.
private void setProjectsInList(Collection<RemoteModule> modules) {
Comparator<RemoteModule> moduleComparator = (o1, o2) -> {
int c1 = o1.getName().compareToIgnoreCase(o2.getName());
if (c1 != 0) {
return c1;
}
return o1.getKey().compareToIgnoreCase(o2.getKey());
};
List<RemoteModule> sortedModules = modules.stream().filter(RemoteModule::isRoot).sorted(moduleComparator).collect(Collectors.toList());
RemoteModule selected = null;
if (lastSelectedProjectKey != null) {
selected = sortedModules.stream().filter(module -> lastSelectedProjectKey.equals(module.getKey())).findAny().orElse(null);
}
CollectionListModel<RemoteModule> projectListModel = new CollectionListModel<>(sortedModules);
projectList.setModel(projectListModel);
projectList.setCellRenderer(new ProjectListRenderer());
setSelectedProject(selected);
}
use of org.sonarsource.sonarlint.core.client.api.connected.RemoteModule in project sonarlint-intellij by SonarSource.
the class SearchProjectKeyDialog method createProjectList.
private void createProjectList() {
projectList = new JBList();
projectList.setEmptyText("No projects found in the selected SonarQube Server");
projectList.setCellRenderer(new ProjectListRenderer());
projectList.addListSelectionListener(new ProjectItemListener());
projectList.addMouseListener(new ProjectMouseListener());
projectList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
projectList.setVisibleRowCount(10);
projectList.setBorder(IdeBorderFactory.createBorder());
Convertor<Object, String> convertor = o -> {
RemoteModule module = (RemoteModule) o;
return module.getName() + " " + module.getKey();
};
new ListSpeedSearch(projectList, convertor);
scrollPane = new JBScrollPane(projectList);
}
Aggregations