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


Java AbstractVcs类代码示例

本文整理汇总了Java中com.intellij.openapi.vcs.AbstractVcs的典型用法代码示例。如果您正苦于以下问题:Java AbstractVcs类的具体用法?Java AbstractVcs怎么用?Java AbstractVcs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getCurrentBranch

import com.intellij.openapi.vcs.AbstractVcs; //导入依赖的package包/类
public String getCurrentBranch(Project project) {
    AbstractVcs[] VCS = ProjectLevelVcsManager.getInstance(project).getAllActiveVcss();
    if (VCS.length == 0) {
        return "";
    }

    AbstractVcs currentVersionControl = VCS[0];

    if (currentVersionControl.getName().equalsIgnoreCase("hg4idea")) {
        currentBranch = RepoHelper.getHgBranch(project);
    } else if (currentVersionControl.getName().equalsIgnoreCase("Git")) {
        currentBranch = RepoHelper.getGitBranch(project);
    }

    return currentBranch;
}
 
开发者ID:WesleyElliott,项目名称:IntelliJ-TimeTracker,代码行数:17,代码来源:RepoHelper.java

示例2: findLogProviders

import com.intellij.openapi.vcs.AbstractVcs; //导入依赖的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

示例3: findNewRoots

import com.intellij.openapi.vcs.AbstractVcs; //导入依赖的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

示例4: AnnotatePreviousRevisionAction

import com.intellij.openapi.vcs.AbstractVcs; //导入依赖的package包/类
public AnnotatePreviousRevisionAction(@NotNull FileAnnotation annotation, @NotNull AbstractVcs vcs) {
  super("Annotate Previous Revision", "Annotate successor of selected revision in new tab", AllIcons.Actions.Annotate,
        annotation, vcs);
  List<VcsFileRevision> revisions = annotation.getRevisions();
  if (revisions == null) {
    myRevisions = null;
    return;
  }

  Map<VcsRevisionNumber, VcsFileRevision> map = new HashMap<VcsRevisionNumber, VcsFileRevision>();
  for (int i = 0; i < revisions.size(); i++) {
    VcsFileRevision revision = revisions.get(i);
    VcsFileRevision previousRevision = i + 1 < revisions.size() ? revisions.get(i + 1) : null;
    map.put(revision.getRevisionNumber(), previousRevision);
  }

  myRevisions = new ArrayList<VcsFileRevision>(annotation.getLineCount());
  for (int i = 0; i < annotation.getLineCount(); i++) {
    myRevisions.add(map.get(annotation.getLineRevisionNumber(i)));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:AnnotatePreviousRevisionAction.java

示例5: fillActions

import com.intellij.openapi.vcs.AbstractVcs; //导入依赖的package包/类
protected void fillActions(@Nullable final Project project,
                           @NotNull final DefaultActionGroup group,
                           @NotNull final DataContext dataContext) {

  if (project == null) {
    return;
  }

  final Pair<SupportedVCS, AbstractVcs> typeAndVcs = getActiveVCS(project, dataContext);
  final AbstractVcs vcs = typeAndVcs.getSecond();
  final SupportedVCS popupType = typeAndVcs.getFirst();

  switch (popupType) {
    case VCS:
      fillVcsPopup(project, group, dataContext, vcs);
      break;

    case NOT_IN_VCS:
      fillNonInVcsActions(project, group, dataContext);
      break;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:VcsQuickListPopupAction.java

示例6: fillVcsPopup

import com.intellij.openapi.vcs.AbstractVcs; //导入依赖的package包/类
private void fillVcsPopup(@NotNull final Project project,
                                  @NotNull final DefaultActionGroup group,
                                  @Nullable final DataContext dataContext,
                                  @Nullable final AbstractVcs vcs) {

  if (vcs != null) {
    // replace general vcs actions if necessary

    for (VcsQuickListContentProvider provider : VcsQuickListContentProvider.EP_NAME.getExtensions()) {
      if (provider.replaceVcsActionsFor(vcs, dataContext)) {
        final List<AnAction> actionsToReplace = provider.getVcsActions(project, vcs, dataContext);
        if (actionsToReplace != null) {
          // replace general actions with custom ones:
          addActions(actionsToReplace, group);
          // local history
          addLocalHistoryActions(group);
          return;
        }
      }
    }
  }

  // general list
  fillGeneralVcsPopup(project, group, dataContext, vcs);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:VcsQuickListPopupAction.java

示例7: getActiveVCS

import com.intellij.openapi.vcs.AbstractVcs; //导入依赖的package包/类
private Pair<SupportedVCS, AbstractVcs> getActiveVCS(@NotNull final Project project, @Nullable final DataContext dataContext) {
  final AbstractVcs[] activeVcss = getActiveVCSs(project);
  if (activeVcss.length == 0) {
    // no vcs
    return new Pair<SupportedVCS, AbstractVcs>(SupportedVCS.NOT_IN_VCS, null);
  } else if (activeVcss.length == 1) {
    // get by name
    return Pair.create(SupportedVCS.VCS, activeVcss[0]);
  }

  // by current file
  final VirtualFile file =  dataContext != null ? CommonDataKeys.VIRTUAL_FILE.getData(dataContext) : null;
  if (file != null) {
    final AbstractVcs vscForFile = ProjectLevelVcsManager.getInstance(project).getVcsFor(file);
    if (vscForFile != null) {
      return Pair.create(SupportedVCS.VCS, vscForFile);
    }
  }

  return new Pair<SupportedVCS, AbstractVcs>(SupportedVCS.VCS, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:VcsQuickListPopupAction.java

示例8: processDeletedFile

import com.intellij.openapi.vcs.AbstractVcs; //导入依赖的package包/类
private boolean processDeletedFile(final VirtualFile file) throws IOException {
  if (myInternalDelete) return false;
  final AbstractVcs vcs = ProjectLevelVcsManager.getInstance(myProject).getVcsFor(file);
  if (vcs != CvsVcs2.getInstance(myProject)) return false;
  file.putUserData(CvsStorageSupportingDeletionComponent.FILE_VCS, vcs);
  if (!CvsUtil.fileIsUnderCvs(file)) return false;
  myComponent.getDeleteHandler().addDeletedRoot(file);
  if (file.isDirectory()) {
    myInternalDelete = true;
    try {
      deleteFilesInVFS(file);
    }
    finally {
      myInternalDelete = false;
    }
    return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:CvsFileOperationsHandler.java

示例9: scanForRootsInsideDir

import com.intellij.openapi.vcs.AbstractVcs; //导入依赖的package包/类
@NotNull
private Set<VcsRoot> scanForRootsInsideDir(@NotNull final VirtualFile dir, final int depth) {
  final Set<VcsRoot> roots = new HashSet<VcsRoot>();
  if (depth > MAXIMUM_SCAN_DEPTH) {
    // performance optimization via limitation: don't scan deep though the whole VFS, 2 levels under a content root is enough
    return roots;
  }

  if (myProject.isDisposed() || !dir.isDirectory()) {
    return roots;
  }
  List<AbstractVcs> vcsList = getVcsListFor(dir);
  for (AbstractVcs vcs : vcsList) {
    roots.add(new VcsRoot(vcs, dir));
  }
  for (VirtualFile child : dir.getChildren()) {
    roots.addAll(scanForRootsInsideDir(child, depth + 1));
  }
  return roots;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:VcsRootDetectorImpl.java

示例10: scanForSingleRootAboveDir

import com.intellij.openapi.vcs.AbstractVcs; //导入依赖的package包/类
@NotNull
private List<VcsRoot> scanForSingleRootAboveDir(@NotNull final VirtualFile dir) {
  List<VcsRoot> roots = new ArrayList<VcsRoot>();
  if (myProject.isDisposed()) {
    return roots;
  }

  VirtualFile par = dir.getParent();
  while (par != null) {
    List<AbstractVcs> vcsList = getVcsListFor(par);
    for (AbstractVcs vcs : vcsList) {
      roots.add(new VcsRoot(vcs, par));
    }
    if (!roots.isEmpty()) {
      return roots;
    }
    par = par.getParent();
  }
  return roots;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:VcsRootDetectorImpl.java

示例11: processFiles

import com.intellij.openapi.vcs.AbstractVcs; //导入依赖的package包/类
protected List<VcsException> processFiles(final AbstractVcs vcs, final List<FilePath> files) {
  RollbackEnvironment environment = vcs.getRollbackEnvironment();
  if (environment == null) return Collections.emptyList();
  final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
  if (indicator != null) {
    indicator.setText(vcs.getDisplayName() + ": performing rollback...");
  }
  final List<VcsException> result = new ArrayList<VcsException>(0);
  try {
    environment.rollbackMissingFileDeletion(files, result, new RollbackProgressModifier(files.size(), indicator));
  }
  catch (ProcessCanceledException e) {
    // for files refresh
  }
  LocalFileSystem.getInstance().refreshIoFiles(ChangesUtil.filePathsToFiles(files));
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:RollbackDeletionAction.java

示例12: getRollbackOperationName

import com.intellij.openapi.vcs.AbstractVcs; //导入依赖的package包/类
/**
 * Finds the most appropriate name for the "Rollback" operation for the given VCSs.
 * That is: iterates through the all {@link RollbackEnvironment#getRollbackOperationName() RollbackEnvironments} and picks
 * the operation name if it is equal to all given VCSs.
 * Otherwise picks the {@link DefaultRollbackEnvironment#ROLLBACK_OPERATION_NAME default name}.
 * @param vcses affected VCSs.
 * @return name for the "rollback" operation to be used in the UI.
 */
@NotNull
public static String getRollbackOperationName(@NotNull Collection<AbstractVcs> vcses) {
  String operationName = null;
  for (AbstractVcs vcs : vcses) {
    final RollbackEnvironment rollbackEnvironment = vcs.getRollbackEnvironment();
    if (rollbackEnvironment != null) {
      if (operationName == null) {
        operationName = rollbackEnvironment.getRollbackOperationName();
      }
      else if (!operationName.equals(rollbackEnvironment.getRollbackOperationName())) {
        // if there are different names, use default
        return DefaultRollbackEnvironment.ROLLBACK_OPERATION_NAME;
      }
    }
  }
  return operationName != null ? operationName : DefaultRollbackEnvironment.ROLLBACK_OPERATION_NAME;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:RollbackUtil.java

示例13: calculateInvalidated

import com.intellij.openapi.vcs.AbstractVcs; //导入依赖的package包/类
@NotNull
private VcsInvalidated calculateInvalidated(@NotNull DirtBuilder dirt) {
  MultiMap<AbstractVcs, FilePath> files = dirt.getFilesForVcs();
  MultiMap<AbstractVcs, FilePath> dirs = dirt.getDirsForVcs();
  if (dirt.isEverythingDirty()) {
    dirs.putAllValues(getEverythingDirtyRoots());
  }
  Set<AbstractVcs> keys = ContainerUtil.union(files.keySet(), dirs.keySet());

  Map<AbstractVcs, VcsDirtyScopeImpl> scopes = ContainerUtil.newHashMap();
  for (AbstractVcs key : keys) {
    VcsDirtyScopeImpl scope = new VcsDirtyScopeImpl(key, myProject);
    scopes.put(key, scope);
    scope.addDirtyData(dirs.get(key), files.get(key));
  }

  return new VcsInvalidated(new ArrayList<VcsDirtyScope>(scopes.values()), dirt.isEverythingDirty());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:VcsDirtyScopeManagerImpl.java

示例14: guessRepositoryForFile

import com.intellij.openapi.vcs.AbstractVcs; //导入依赖的package包/类
@Nullable
public static <T extends Repository> T guessRepositoryForFile(@NotNull Project project,
                                                              @NotNull RepositoryManager<T> manager,
                                                              @Nullable AbstractVcs vcs,
                                                              @Nullable VirtualFile file,
                                                              @Nullable String defaultRootPathValue) {
  T repository = manager.getRepositoryForRoot(guessVcsRoot(project, file));
  return repository != null ? repository : manager.getRepositoryForRoot(guessRootForVcs(project, vcs, defaultRootPathValue));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:DvcsUtil.java

示例15: getPushSupport

import com.intellij.openapi.vcs.AbstractVcs; //导入依赖的package包/类
@Nullable
public static PushSupport getPushSupport(@NotNull final AbstractVcs vcs) {
  return ContainerUtil.find(Extensions.getExtensions(PushSupport.PUSH_SUPPORT_EP, vcs.getProject()), new Condition<PushSupport>() {
    @Override
    public boolean value(final PushSupport support) {
      return support.getVcs().equals(vcs);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:DvcsUtil.java


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