コード例 #1
0
 @Override
 @Nullable
 public VirtualFile getVcsRootFor(@Nullable final VirtualFile file) {
   final VcsDirectoryMapping mapping = myMappings.getMappingFor(file);
   if (mapping == null) {
     return null;
   }
   final String directory = mapping.getDirectory();
   if (directory.isEmpty()) {
     return myDefaultVcsRootPolicy.getVcsRootFor(file);
   }
   return LocalFileSystem.getInstance().findFileByPath(directory);
 }
コード例 #2
0
 @Override
 @Nullable
 public VcsRoot getVcsRootObjectFor(final VirtualFile file) {
   final VcsDirectoryMapping mapping = myMappings.getMappingFor(file);
   if (mapping == null) {
     return null;
   }
   final String directory = mapping.getDirectory();
   final AbstractVcs vcs = findVcsByName(mapping.getVcs());
   if (directory.isEmpty()) {
     return new VcsRoot(vcs, myDefaultVcsRootPolicy.getVcsRootFor(file));
   }
   return new VcsRoot(vcs, LocalFileSystem.getInstance().findFileByPath(directory));
 }