Search in sources :

Example 1 with VcsRootChecker

use of com.intellij.openapi.vcs.VcsRootChecker in project intellij-community by JetBrains.

the class VcsRootPlatformTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    myProjectFixture = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(getTestName(true)).getFixture();
    myProjectFixture.setUp();
    myProject = myProjectFixture.getProject();
    myProjectRoot = myProject.getBaseDir();
    cd(myProjectRoot);
    Module module = doCreateRealModuleIn("foo", myProject, EmptyModuleType.getInstance());
    myRootModel = ((ModuleRootManagerImpl) ModuleRootManager.getInstance(module)).getRootModel();
    mkdir(myRepositoryFolderName);
    myProjectRoot.refresh(false, true);
    myRepository = myProjectRoot.findChild(myRepositoryFolderName);
    myVcs = new MockAbstractVcs(myProject);
    myVcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(myProject);
    ExtensionPoint<VcsRootChecker> point = getExtensionPoint();
    myExtension = new VcsRootChecker() {

        @NotNull
        @Override
        public VcsKey getSupportedVcs() {
            return myVcs.getKeyInstanceMethod();
        }

        @Override
        public boolean isRoot(@NotNull String path) {
            return new File(path, DOT_MOCK).exists();
        }

        @Override
        public boolean isVcsDir(@NotNull String path) {
            return path.toLowerCase().endsWith(DOT_MOCK);
        }
    };
    point.registerExtension(myExtension);
    myVcsManager.registerVcs(myVcs);
    myVcsName = myVcs.getName();
    myRepository.refresh(false, true);
}
Also used : VcsKey(com.intellij.openapi.vcs.VcsKey) VcsRootChecker(com.intellij.openapi.vcs.VcsRootChecker) MockAbstractVcs(com.intellij.openapi.vcs.changes.committed.MockAbstractVcs) Module(com.intellij.openapi.module.Module) NotNull(org.jetbrains.annotations.NotNull) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Aggregations

Module (com.intellij.openapi.module.Module)1 VcsKey (com.intellij.openapi.vcs.VcsKey)1 VcsRootChecker (com.intellij.openapi.vcs.VcsRootChecker)1 MockAbstractVcs (com.intellij.openapi.vcs.changes.committed.MockAbstractVcs)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 File (java.io.File)1 NotNull (org.jetbrains.annotations.NotNull)1