(IDEA-115964) Fix root scanner and errors notification for vcs without RootChecker

This commit is contained in:
Nadya Zabrodina
2013-11-05 14:46:57 +04:00
parent 4a3e4032c5
commit f64c70049e
@@ -60,8 +60,11 @@ public class VcsRootErrorsFinder {
private Collection<VcsRootError> findExtraMappings(@NotNull List<VcsDirectoryMapping> mappings, boolean isEmptyVcsRoots) {
Collection<VcsRootError> errors = new ArrayList<VcsRootError>();
for (VcsDirectoryMapping mapping : mappings) {
if (!hasVcsChecker(mapping.getVcs())) {
continue;
}
if (mapping.isDefaultMapping()) {
if (isEmptyVcsRoots && !StringUtil.isEmptyOrSpaces(mapping.getVcs())) {
if (isEmptyVcsRoots) {
errors.add(new VcsRootError(VcsRootError.Type.EXTRA_MAPPING, VcsDirectoryMapping.PROJECT_CONSTANT, mapping.getVcs()));
}
}
@@ -75,6 +78,19 @@ public class VcsRootErrorsFinder {
return errors;
}
private static boolean hasVcsChecker(String vcs) {
if (StringUtil.isEmptyOrSpaces(vcs)) {
return false;
}
VcsRootChecker[] checkers = Extensions.getExtensions(VcsRootChecker.EXTENSION_POINT_NAME);
for (VcsRootChecker checker : checkers) {
if (vcs.equalsIgnoreCase(checker.getSupportedVcs().getName())) {
return true;
}
}
return false;
}
@NotNull
public static Collection<VirtualFile> vcsRootsToVirtualFiles(@NotNull Collection<VcsRoot> vcsRoots) {
return ContainerUtil.map(vcsRoots, new Function<VcsRoot, VirtualFile>() {