mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
GitRootErrorsFinder renamed to VcsRootErrorsFinder, git dependencies removed from RootErrorsFinder for future moving
This commit is contained in:
@@ -36,7 +36,7 @@ public class GitRootChecker implements VcsRootChecker {
|
||||
private final boolean myProjectMappingIsInvalid;
|
||||
|
||||
public GitRootChecker(@NotNull Project project, @NotNull GitPlatformFacade platformFacade) {
|
||||
myErrors = new GitRootErrorsFinder(project, platformFacade).find();
|
||||
myErrors = new VcsRootErrorsFinder(project).find();
|
||||
myProjectMappingIsInvalid = isProjectMappingInvalid();
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class GitRootChecker implements VcsRootChecker {
|
||||
// this information is available in myErrors,
|
||||
// but the method may be called in VcsDirectoryConfigurationPanel after adding a mapping (to highlight errors right away)
|
||||
// in which case ProjectLevelVcsManager#getAllVcsRoots() is not aware of new roots yet,
|
||||
// while GitRootErrorsFinder relies on the set of roots returned from ProjectLevelVcsManager.
|
||||
// while VcsRootErrorsFinder relies on the set of roots returned from ProjectLevelVcsManager.
|
||||
if (mapping.isDefaultMapping()) {
|
||||
return myProjectMappingIsInvalid;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ import static git4idea.GitVcs.MINOR_NOTIFICATION;
|
||||
import static git4idea.Notificator.createNotification;
|
||||
|
||||
/**
|
||||
* Searches for Git roots problems via {@link GitRootErrorsFinder} and notifies about them.
|
||||
* Searches for Git roots problems via {@link VcsRootErrorsFinder} and notifies about them.
|
||||
*
|
||||
* @author Kirill Likhodedov
|
||||
*/
|
||||
@@ -116,7 +116,7 @@ public class GitRootProblemNotifier {
|
||||
|
||||
@NotNull
|
||||
private Collection<VcsRootError> scan() {
|
||||
return new GitRootErrorsFinder(myProject, myPlatformFacade).find();
|
||||
return new VcsRootErrorsFinder(myProject).find();
|
||||
}
|
||||
|
||||
@SuppressWarnings("StringConcatenationInsideStringBufferAppend")
|
||||
|
||||
+5
-11
@@ -23,8 +23,6 @@ import com.intellij.openapi.vcs.VcsDirectoryMapping;
|
||||
import com.intellij.openapi.vcs.VcsRootError;
|
||||
import com.intellij.openapi.vcs.roots.VcsRootDetector;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import git4idea.GitPlatformFacade;
|
||||
import git4idea.GitUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
@@ -37,23 +35,19 @@ import java.util.List;
|
||||
*
|
||||
* @author Kirill Likhodedov
|
||||
*/
|
||||
public class GitRootErrorsFinder {
|
||||
public class VcsRootErrorsFinder {
|
||||
|
||||
private final @NotNull Project myProject;
|
||||
private final @NotNull GitPlatformFacade myPlatformFacade;
|
||||
private final @NotNull ProjectLevelVcsManager myVcsManager;
|
||||
private final AbstractVcs myVcs;
|
||||
|
||||
public GitRootErrorsFinder(@NotNull Project project, @NotNull GitPlatformFacade platformFacade) {
|
||||
public VcsRootErrorsFinder(@NotNull Project project) {
|
||||
myProject = project;
|
||||
myPlatformFacade = platformFacade;
|
||||
myVcsManager = myPlatformFacade.getVcsManager(myProject);
|
||||
myVcs = myPlatformFacade.getVcs(myProject);
|
||||
myVcsManager = ProjectLevelVcsManager.getInstance(project);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Collection<VcsRootError> find() {
|
||||
List<VcsDirectoryMapping> mappings = myVcsManager.getDirectoryMappings(myVcs);
|
||||
List<VcsDirectoryMapping> mappings = myVcsManager.getDirectoryMappings();
|
||||
Collection<VirtualFile> gitRoots = new VcsRootDetector(myProject).detect().getRoots();
|
||||
|
||||
Collection<VcsRootError> errors = new ArrayList<VcsRootError>();
|
||||
@@ -93,7 +87,7 @@ public class GitRootErrorsFinder {
|
||||
}
|
||||
|
||||
private static boolean hasGitDir(String path) {
|
||||
File file = new File(path, GitUtil.DOT_GIT);
|
||||
File file = new File(path, ".git");
|
||||
return file.exists();
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ class GitRootErrorsFinderTest extends AbstractGitRootTest {
|
||||
expected.addAll map.errors.unreg.collect { unreg(it) }
|
||||
expected.addAll map.errors.extra.collect { extra(it) }
|
||||
|
||||
Collection<VcsRootError> actual = new GitRootErrorsFinder(myProject, myPlatformFacade).find()
|
||||
Collection<VcsRootError> actual = new VcsRootErrorsFinder(myProject).find()
|
||||
assertEquals expected.toSet(), actual.toSet()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user