当前位置: 首页>>代码示例>>Java>>正文


Java VcsRoot.getVcs方法代码示例

本文整理汇总了Java中com.intellij.openapi.vcs.VcsRoot.getVcs方法的典型用法代码示例。如果您正苦于以下问题:Java VcsRoot.getVcs方法的具体用法?Java VcsRoot.getVcs怎么用?Java VcsRoot.getVcs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.vcs.VcsRoot的用法示例。


在下文中一共展示了VcsRoot.getVcs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findLogProviders

import com.intellij.openapi.vcs.VcsRoot; //导入方法依赖的package包/类
@NotNull
public static Map<VirtualFile, VcsLogProvider> findLogProviders(@NotNull Collection<VcsRoot> roots, @NotNull Project project) {
  Map<VirtualFile, VcsLogProvider> logProviders = ContainerUtil.newHashMap();
  VcsLogProvider[] allLogProviders = Extensions.getExtensions(LOG_PROVIDER_EP, project);
  for (VcsRoot root : roots) {
    AbstractVcs vcs = root.getVcs();
    VirtualFile path = root.getPath();
    if (vcs == null || path == null) {
      LOG.error("Skipping invalid VCS root: " + root);
      continue;
    }

    for (VcsLogProvider provider : allLogProviders) {
      if (provider.getSupportedVcs().equals(vcs.getKeyInstanceMethod())) {
        logProviders.put(path, provider);
        break;
      }
    }
  }
  return logProviders;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:VcsLogManager.java

示例2: findNewRoots

import com.intellij.openapi.vcs.VcsRoot; //导入方法依赖的package包/类
@NotNull
private Map<VirtualFile, Repository> findNewRoots(@NotNull Set<VirtualFile> knownRoots) {
  Map<VirtualFile, Repository> newRootsMap = ContainerUtil.newHashMap();
  for (VcsRoot root : myVcsManager.getAllVcsRoots()) {
    VirtualFile rootPath = root.getPath();
    if (rootPath != null && !knownRoots.contains(rootPath)) {
      AbstractVcs vcs = root.getVcs();
      VcsRepositoryCreator repositoryCreator = getRepositoryCreator(vcs);
      if (repositoryCreator == null) continue;
      Repository repository = repositoryCreator.createRepositoryIfValid(rootPath);
      if (repository != null) {
        newRootsMap.put(rootPath, repository);
      }
    }
  }
  return newRootsMap;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:VcsRepositoryManager.java

示例3: createVcsHandler

import com.intellij.openapi.vcs.VcsRoot; //导入方法依赖的package包/类
@NotNull
@Override
protected CheckinHandler createVcsHandler(final CheckinProjectPanel panel) {
  return new CheckinHandler() {
    @Nullable
    public RefreshableOnComponent getAfterCheckinConfigurationPanel(Disposable parentDisposable) {
      final Project project = panel.getProject();
      final CvsVcs2 cvs = CvsVcs2.getInstance(project);
      final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
      final Collection<VirtualFile> roots = panel.getRoots();
      final Collection<FilePath> files = new HashSet<FilePath>();
      for (VirtualFile root : roots) {
        final VcsRoot vcsRoot = vcsManager.getVcsRootObjectFor(root);
        if (vcsRoot == null || vcsRoot.getVcs() != cvs) {
          continue;
        }
        files.add(VcsContextFactory.SERVICE.getInstance().createFilePathOn(root));
      }
      return new AdditionalOptionsPanel(CvsConfiguration.getInstance(project), files, project);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:CvsCheckinHandlerFactory.java

示例4: create

import com.intellij.openapi.vcs.VcsRoot; //导入方法依赖的package包/类
@Nullable
public static VcsWatchRequest create(@NotNull VcsRoot root) {
    AbstractVcs vcs = root.getVcs();
    if (vcs == null || root.getPath() == null) {
        return null;
    }

    if (Utils.isPluginEnabled("Git4Idea") && vcs instanceof GitVcs) {
        return new GitWatchRequest(vcs, root.getPath());
    } else if (Utils.isPluginEnabled("hg4idea") && vcs instanceof HgVcs) {
        return new HgWatchRequest(vcs, root.getPath());
    } else if (Utils.isPluginEnabled("Subversion") && vcs instanceof SvnVcs) {
        return new SvnWatchRequest(vcs, root.getPath());
    }

    return null;
}
 
开发者ID:hsz,项目名称:idea-vcswatch,代码行数:18,代码来源:VcsWatchRequestFactory.java

示例5: showInVcsRoot

import com.intellij.openapi.vcs.VcsRoot; //导入方法依赖的package包/类
private boolean showInVcsRoot(final Project project, final VcsRoot root, Entity changeset) throws VcsException {
    final AbstractVcs vcs = root.getVcs();
    if(vcs == null) {
        return false;
    }
    final VcsRevisionNumber revision = createRevision(vcs.getName(), changeset.getPropertyValue("rev"));
    if(revision == null) {
        return false;
    }
    CommittedChangesProvider committedChangesProvider = vcs.getCommittedChangesProvider();
    if(committedChangesProvider == null) {
        return false;
    }
    Pair oneList = committedChangesProvider.getOneList(root.getPath(), revision);
    if(oneList != null && oneList.getFirst() != null) {
        UIUtil.invokeAndWaitIfNeeded(new Runnable() {
            @Override
            public void run() {
                ShowAllAffectedGenericAction.showSubmittedFiles(project, revision, root.getPath(), vcs.getKeyInstanceMethod());
            }
        });
        return true;
    } else {
        return false;
    }
}
 
开发者ID:janotav,项目名称:ali-idea-plugin,代码行数:27,代码来源:ShowAffectedPathsAction.java

示例6: findRepository

import com.intellij.openapi.vcs.VcsRoot; //导入方法依赖的package包/类
private VcsRoot findRepository(Project project, Entity repository) {
    String location = repository.getPropertyValue("location");
    String alias = repository.getPropertyValue("alias");

    VcsRoot[] vcsRoots = ProjectLevelVcsManager.getInstance(project).getAllVcsRoots();
    for(VcsRoot root: vcsRoots) {
        AbstractVcs vcs = root.getVcs();
        if(vcs == null) {
            continue;
        }
        RevisionFactory revisionFactory = findFactory(vcs.getName());
        if(revisionFactory != null && revisionFactory.matches(root, location, alias)) {
            return root;
        }
    }

    return null;
}
 
开发者ID:janotav,项目名称:ali-idea-plugin,代码行数:19,代码来源:ShowAffectedPathsAction.java

示例7: findLogProviders

import com.intellij.openapi.vcs.VcsRoot; //导入方法依赖的package包/类
@Nonnull
public static Map<VirtualFile, VcsLogProvider> findLogProviders(@Nonnull Collection<VcsRoot> roots, @Nonnull Project project) {
  Map<VirtualFile, VcsLogProvider> logProviders = ContainerUtil.newHashMap();
  VcsLogProvider[] allLogProviders = Extensions.getExtensions(LOG_PROVIDER_EP, project);
  for (VcsRoot root : roots) {
    AbstractVcs vcs = root.getVcs();
    VirtualFile path = root.getPath();
    if (vcs == null || path == null) {
      LOG.error("Skipping invalid VCS root: " + root);
      continue;
    }

    for (VcsLogProvider provider : allLogProviders) {
      if (provider.getSupportedVcs().equals(vcs.getKeyInstanceMethod())) {
        logProviders.put(path, provider);
        break;
      }
    }
  }
  return logProviders;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:VcsLogManager.java

示例8: findNewRoots

import com.intellij.openapi.vcs.VcsRoot; //导入方法依赖的package包/类
@Nonnull
private Map<VirtualFile, Repository> findNewRoots(@Nonnull Set<VirtualFile> knownRoots) {
  Map<VirtualFile, Repository> newRootsMap = ContainerUtil.newHashMap();
  for (VcsRoot root : myVcsManager.getAllVcsRoots()) {
    VirtualFile rootPath = root.getPath();
    if (rootPath != null && !knownRoots.contains(rootPath)) {
      AbstractVcs vcs = root.getVcs();
      VcsRepositoryCreator repositoryCreator = getRepositoryCreator(vcs);
      if (repositoryCreator == null) continue;
      Repository repository = repositoryCreator.createRepositoryIfValid(rootPath);
      if (repository != null) {
        newRootsMap.put(rootPath, repository);
      }
    }
  }
  return newRootsMap;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:VcsRepositoryManager.java

示例9: revisionsConvertor

import com.intellij.openapi.vcs.VcsRoot; //导入方法依赖的package包/类
public static List<BeforeAfter<AirContentRevision>> revisionsConvertor(final Project project, final List<Change> changes) throws VcsException {
  final List<BeforeAfter<AirContentRevision>> result = new ArrayList<BeforeAfter<AirContentRevision>>(changes.size());

  final Convertor<Change, FilePath> beforePrefferingConvertor = new Convertor<Change, FilePath>() {
    public FilePath convert(Change o) {
      final FilePath before = ChangesUtil.getBeforePath(o);
      return before == null ? ChangesUtil.getAfterPath(o) : before;
    }
  };
  final MultiMap<VcsRoot,Change> byRoots = new SortByVcsRoots<Change>(project, beforePrefferingConvertor).sort(changes);

  for (VcsRoot root : byRoots.keySet()) {
    final Collection<Change> rootChanges = byRoots.get(root);
    if (root.getVcs() == null || root.getVcs().getOutgoingChangesProvider() == null) {
      addConvertChanges(rootChanges, result);
      continue;
    }
    final VcsOutgoingChangesProvider<?> provider = root.getVcs().getOutgoingChangesProvider();
    final Collection<Change> basedOnLocal = provider.filterLocalChangesBasedOnLocalCommits(rootChanges, root.getPath());
    rootChanges.removeAll(basedOnLocal);
    addConvertChanges(rootChanges, result);

    for (Change change : basedOnLocal) {
      // dates are here instead of numbers
      result.add(new BeforeAfter<AirContentRevision>(convertRevision(change.getBeforeRevision(), provider),
                                                     convertRevision(change.getAfterRevision(), provider)));
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:IdeaTextPatchBuilder.java

示例10: fromDiffProvider

import com.intellij.openapi.vcs.VcsRoot; //导入方法依赖的package包/类
private VcsRevisionNumber fromDiffProvider(final VirtualFile vf) {
  final VcsRoot vcsRoot = myVcsManager.getVcsRootObjectFor(vf);
  DiffProvider diffProvider;
  if (vcsRoot != null && vcsRoot.getVcs() != null && (diffProvider = vcsRoot.getVcs().getDiffProvider()) != null) {
    return diffProvider.getCurrentRevision(vf);
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:VcsAnnotationLocalChangesListenerImpl.java

示例11: run

import com.intellij.openapi.vcs.VcsRoot; //导入方法依赖的package包/类
/**
 * Rebuilds {@link #confirmedIgnoredFiles} map.
 *
 * @param silent propagate {@link IgnoreManager.TrackedIgnoredListener#TRACKED_IGNORED} event
 */
public void run(boolean silent) {
    if (!settings.isInformTrackedIgnored()) {
        return;
    }

    final ConcurrentMap<VirtualFile, VcsRoot> result = ContainerUtil.newConcurrentMap();
    for (VcsRoot vcsRoot : vcsRoots) {
        if (!(vcsRoot.getVcs() instanceof GitVcs) || vcsRoot.getPath() == null) {
            continue;
        }
        final VirtualFile root = vcsRoot.getPath();
        for (String path : ExternalExec.getIgnoredFiles(vcsRoot)) {
            final VirtualFile file = root.findFileByRelativePath(path);
            if (file != null) {
                result.put(file, vcsRoot);
            }
        }
    }

    if (!silent && !result.isEmpty()) {
        myProject.getMessageBus().syncPublisher(TRACKED_IGNORED).handleFiles(result);
    }
    confirmedIgnoredFiles.clear();
    confirmedIgnoredFiles.putAll(result);
    notConfirmedIgnoredFiles.clear();
    debouncedStatusesChanged.run();

    for (AbstractProjectViewPane pane : Extensions.getExtensions(AbstractProjectViewPane.EP_NAME, myProject)) {
        if (pane.getTreeBuilder() != null) {
            pane.getTreeBuilder().queueUpdate();
        }
    }
}
 
开发者ID:hsz,项目名称:idea-gitignore,代码行数:39,代码来源:IgnoreManager.java

示例12: revisionsConvertor

import com.intellij.openapi.vcs.VcsRoot; //导入方法依赖的package包/类
public static List<BeforeAfter<AirContentRevision>> revisionsConvertor(final Project project, final List<Change> changes) throws VcsException {
  final List<BeforeAfter<AirContentRevision>> result = new ArrayList<BeforeAfter<AirContentRevision>>(changes.size());

  final Convertor<Change, FilePath> beforePrefferingConvertor = new Convertor<Change, FilePath>() {
    @Override
    public FilePath convert(Change o) {
      final FilePath before = ChangesUtil.getBeforePath(o);
      return before == null ? ChangesUtil.getAfterPath(o) : before;
    }
  };
  final MultiMap<VcsRoot,Change> byRoots = new SortByVcsRoots<Change>(project, beforePrefferingConvertor).sort(changes);

  for (VcsRoot root : byRoots.keySet()) {
    final Collection<Change> rootChanges = byRoots.get(root);
    if (root.getVcs() == null || root.getVcs().getOutgoingChangesProvider() == null) {
      addConvertChanges(rootChanges, result);
      continue;
    }
    final VcsOutgoingChangesProvider<?> provider = root.getVcs().getOutgoingChangesProvider();
    final Collection<Change> basedOnLocal = provider.filterLocalChangesBasedOnLocalCommits(rootChanges, root.getPath());
    rootChanges.removeAll(basedOnLocal);
    addConvertChanges(rootChanges, result);

    for (Change change : basedOnLocal) {
      // dates are here instead of numbers
      result.add(new BeforeAfter<AirContentRevision>(convertRevision(change.getBeforeRevision(), provider),
                                                     convertRevision(change.getAfterRevision(), provider)));
    }
  }
  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:32,代码来源:IdeaTextPatchBuilder.java

示例13: belongsTo

import com.intellij.openapi.vcs.VcsRoot; //导入方法依赖的package包/类
@Override
public boolean belongsTo(final FilePath path, final Consumer<AbstractVcs> vcsConsumer) {
  if (myProject.isDisposed()) return false;
  final VcsRoot rootObject = myVcsManager.getVcsRootObjectFor(path);
  if (vcsConsumer != null && rootObject != null) {
    vcsConsumer.consume(rootObject.getVcs());
  }
  if (rootObject == null || rootObject.getVcs() != myVcs) {
    return false;
  }

  final VirtualFile vcsRoot = rootObject.getPath();
  if (vcsRoot != null) {
    for (VirtualFile contentRoot : myAffectedContentRoots) {
      // since we don't know exact dirty mechanics, maybe we have 3 nested mappings like:
      // /root -> vcs1, /root/child -> vcs2, /root/child/inner -> vcs1, and we have file /root/child/inner/file,
      // mapping is detected as vcs1 with root /root/child/inner, but we could possibly have in scope
      // "affected root" -> /root with scope = /root recursively
      if (VfsUtilCore.isAncestor(contentRoot, vcsRoot, false)) {
        THashSet<FilePath> dirsByRoot = myDirtyDirectoriesRecursively.get(contentRoot);
        if (dirsByRoot != null) {
          for (FilePath filePath : dirsByRoot) {
            if (path.isUnder(filePath, false)) return true;
          }
        }
      }
    }
  }

  if (!myDirtyFiles.isEmpty()) {
    FilePath parent = path.getParentPath();
    return isInDirtyFiles(path) || isInDirtyFiles(parent);
  }

  return false;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:37,代码来源:VcsDirtyScopeImpl.java

示例14: FilePathUnderVcs

import com.intellij.openapi.vcs.VcsRoot; //导入方法依赖的package包/类
FilePathUnderVcs(final VcsRoot root) {
  myPath = new FilePathImpl(root.getPath());
  myVcs = root.getVcs();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:5,代码来源:FilePathUnderVcs.java

示例15: matches

import com.intellij.openapi.vcs.VcsRoot; //导入方法依赖的package包/类
@Override
public boolean matches(VcsRoot vcsRoot, String location, String alias) {
    SvnVcs svnVcs = (SvnVcs) vcsRoot.getVcs();
    String url = svnVcs.getInfo(vcsRoot.getPath()).getRepositoryRootURL().toString();
    return url.equals(location) || url.equals(alias);
}
 
开发者ID:janotav,项目名称:ali-idea-plugin,代码行数:7,代码来源:SubversionRevisionFactory.java


注:本文中的com.intellij.openapi.vcs.VcsRoot.getVcs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。