public void updateBinding(ConnectedSonarLintEngine engine) { String projectKey = projectSettings.getProjectKey(); if (projectKey == null) { throw new IllegalStateException("Project is not bound"); } List<String> moduleFiles = collectPathsForModule(); ProjectBinding projectBinding = engine.calculatePathPrefixes(projectKey, moduleFiles); settings.setIdePathPrefix(projectBinding.idePathPrefix()); settings.setSqPathPrefix(projectBinding.sqPathPrefix()); }
@Override public synchronized void updateProjectStorage(String projectKey, IProgressMonitor monitor) { client.updateProject(getConfig(), projectKey, new WrappedProgressMonitor(monitor, "Update configuration from server '" + getId() + "' for project '" + projectKey + "'")); getBoundProjects(projectKey).forEach(p -> { ProjectBinding projectBinding = client.calculatePathPrefixes(projectKey, p.files().stream().map(ISonarLintFile::getProjectRelativePath).collect(toList())); String idePathPrefix = projectBinding.idePathPrefix(); String sqPathPrefix = projectBinding.sqPathPrefix(); SonarLintLogger.get().debug("Detected prefixes for " + p.getName() + ":\n IDE prefix: " + idePathPrefix + "\n Server side prefix: " + sqPathPrefix); SonarLintProjectConfiguration config = SonarLintCorePlugin.loadConfig(p); config.setProjectBinding(new EclipseProjectBinding(getId(), projectKey, sqPathPrefix, idePathPrefix)); SonarLintCorePlugin.saveConfig(p, config); }); // Some prefix/suffix might have been changed notifyAllListeners(); }