• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VcsRoot类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



VcsRoot类属于com.intellij.openapi.vcs包,在下文中一共展示了VcsRoot类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: detect

import com.intellij.openapi.vcs.VcsRoot; //导入依赖的package包/类
@NotNull
public Collection<VcsRoot> detect(@Nullable VirtualFile startDir) {
  if (startDir == null || myCheckers.length == 0) {
    return Collections.emptyList();
  }

  final Set<VcsRoot> roots = scanForRootsInsideDir(startDir);
  roots.addAll(scanForRootsInContentRoots());
  for (VcsRoot root : roots) {
    if (startDir.equals(root.getPath())) {
      return roots;
    }
  }
  List<VcsRoot> rootsAbove = scanForSingleRootAboveDir(startDir);
  roots.addAll(rootsAbove);
  return roots;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:VcsRootDetectorImpl.java


示例4: scanForRootsInContentRoots

import com.intellij.openapi.vcs.VcsRoot; //导入依赖的package包/类
@NotNull
private Set<VcsRoot> scanForRootsInContentRoots() {
  Set<VcsRoot> vcsRoots = new HashSet<VcsRoot>();
  if (myProject.isDisposed()) return vcsRoots;

  VirtualFile[] roots = myProjectManager.getContentRoots();
  for (VirtualFile contentRoot : roots) {

    Set<VcsRoot> rootsInsideRoot = scanForRootsInsideDir(contentRoot);
    boolean shouldScanAbove = true;
    for (VcsRoot root : rootsInsideRoot) {
      if (contentRoot.equals(root.getPath())) {
        shouldScanAbove = false;
      }
    }
    if (shouldScanAbove) {
      List<VcsRoot> rootsAbove = scanForSingleRootAboveDir(contentRoot);
      rootsInsideRoot.addAll(rootsAbove);
    }
    vcsRoots.addAll(rootsInsideRoot);
  }
  return vcsRoots;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:VcsRootDetectorImpl.java


示例5: scanForRootsInsideDir

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


示例6: scanForSingleRootAboveDir

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


示例7: getRootForPath

import com.intellij.openapi.vcs.VcsRoot; //导入依赖的package包/类
@Nullable
private VirtualFile getRootForPath(@NotNull FilePath file, @NotNull Collection<VirtualFile> rootsToSave) {
  final VirtualFile vf = ChangesUtil.findValidParentUnderReadAction(file);
  if (vf == null) {
    return null;
  }
  VirtualFile rootCandidate = null;
  for (VcsRoot root : myRoots) {
    if (VfsUtilCore.isAncestor(root.getPath(), vf, false)) {
      if (rootCandidate == null || VfsUtil.isAncestor(rootCandidate, root.getPath(), true)) { // in the case of nested roots choose the closest root
        rootCandidate = root.getPath();
      }
    }
  }
  if (! rootsToSave.contains(rootCandidate)) return null;
  return rootCandidate;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:LocalChangesUnderRoots.java


示例8: 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


示例9: 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


示例10: fileDirty

import com.intellij.openapi.vcs.VcsRoot; //导入依赖的package包/类
public void fileDirty(@NotNull final VirtualFile file) {
  try {
    final AbstractVcs vcs = myGuess.getVcsForDirty(file);
    if (vcs == null) return;
    if (LOG.isDebugEnabled()) {
      LOG.debug("file dirty: " + file + "; " + ReflectionUtil.findCallerClass(2));
    }
    final VcsRoot root = new VcsRoot(vcs, file);
    takeDirt(new Consumer<DirtBuilder>() {
      public void consume(DirtBuilder dirtBuilder) {
        dirtBuilder.addDirtyFile(root);
      }
    });
  } catch (ProcessCanceledException ignore) {
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:VcsDirtyScopeManagerImpl.java


示例11: dirDirtyRecursively

import com.intellij.openapi.vcs.VcsRoot; //导入依赖的package包/类
public void dirDirtyRecursively(final VirtualFile dir) {
  try {
    final AbstractVcs vcs = myGuess.getVcsForDirty(dir);
    if (vcs == null) return;
    if (LOG.isDebugEnabled()) {
      LOG.debug("dir dirty recursively: " + dir + "; " + ReflectionUtil.findCallerClass(2));
    }
    final VcsRoot root = new VcsRoot(vcs, dir);
    takeDirt(new Consumer<DirtBuilder>() {
      public void consume(DirtBuilder dirtBuilder) {
        dirtBuilder.addDirtyDirRecursively(root);
      }
    });
  } catch (ProcessCanceledException ignore) {
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:VcsDirtyScopeManagerImpl.java


示例12: createDirectoryNodes

import com.intellij.openapi.vcs.VcsRoot; //导入依赖的package包/类
/**
 * Builds recursively nested {@link FileTreeNode} nodes structure.
 *
 * @param file    current {@link VirtualFile} instance
 * @param vcsRoot {@link VcsRoot} of given file
 * @return leaf
 */
@NotNull
private FileTreeNode createDirectoryNodes(@NotNull VirtualFile file, @Nullable VcsRoot vcsRoot) {
    final FileTreeNode node = nodes.get(file);
    if (node != null) {
        return node;
    }

    final FileTreeNode newNode = new FileTreeNode(project, file, vcsRoot);
    nodes.put(file, newNode);

    if (nodes.size() != 1) {
        final VirtualFile parent = file.getParent();
        if (parent != null) {
            createDirectoryNodes(parent, null).add(newNode);
        }
    }

    return newNode;
}
 
开发者ID:hsz,项目名称:idea-gitignore,代码行数:27,代码来源:UntrackFilesDialog.java


示例13: createTreeScrollPanel

import com.intellij.openapi.vcs.VcsRoot; //导入依赖的package包/类
/**
 * Creates scroll panel with templates tree in it.
 *
 * @return scroll panel
 */
private JScrollPane createTreeScrollPanel() {
    for (Map.Entry<VirtualFile, VcsRoot> entry : files.entrySet()) {
        createDirectoryNodes(entry.getKey(), entry.getValue());
    }

    final FileTreeRenderer renderer = new FileTreeRenderer();

    tree = new CheckboxTree(renderer, root);
    tree.setCellRenderer(renderer);
    tree.setRootVisible(true);
    tree.setShowsRootHandles(false);
    UIUtil.setLineStyleAngled(tree);
    TreeUtil.installActions(tree);

    final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(tree);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    TreeUtil.expandAll(tree);

    tree.getModel().addTreeModelListener(treeModelListener);
    treeExpander = new DefaultTreeExpander(tree);

    return scrollPane;
}
 
开发者ID:hsz,项目名称:idea-gitignore,代码行数:29,代码来源:UntrackFilesDialog.java


示例14: handleFiles

import com.intellij.openapi.vcs.VcsRoot; //导入依赖的package包/类
/**
 * {@link IgnoreManager.TrackedIgnoredListener} method implementation to handle incoming files.
 *
 * @param files tracked and ignored files list
 */
@Override
public void handleFiles(@NotNull final ConcurrentMap<VirtualFile, VcsRoot> files) {
    if (!settings.isInformTrackedIgnored() || notificationShown || myProject.getBaseDir() == null) {
        return;
    }

    notificationShown = true;
    Notify.show(
            myProject,
            IgnoreBundle.message("notification.untrack.title", Utils.getVersion()),
            IgnoreBundle.message("notification.untrack.content"),
            NotificationType.INFORMATION,
            new NotificationListener() {
                @Override
                public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
                    if (DISABLE_ACTION.equals(event.getDescription())) {
                        settings.setInformTrackedIgnored(false);
                    } else {
                        new UntrackFilesDialog(myProject, files).show();
                    }
                    notification.expire();
                }
            }
    );
}
 
开发者ID:hsz,项目名称:idea-gitignore,代码行数:31,代码来源:TrackedIgnoredFilesComponent.java


示例15: 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


示例16: 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


示例17: VcsLogManager

import com.intellij.openapi.vcs.VcsRoot; //导入依赖的package包/类
public VcsLogManager(@Nonnull Project project,
                     @Nonnull VcsLogTabsProperties uiProperties,
                     @Nonnull Collection<VcsRoot> roots,
                     boolean scheduleRefreshImmediately,
                     @Nullable Runnable recreateHandler) {
  myProject = project;
  myUiProperties = uiProperties;
  myRecreateMainLogHandler = recreateHandler;

  Map<VirtualFile, VcsLogProvider> logProviders = findLogProviders(roots, myProject);
  myLogData = new VcsLogData(myProject, logProviders, new MyFatalErrorsHandler());
  myPostponableRefresher = new PostponableLogRefresher(myLogData);
  myTabsLogRefresher = new VcsLogTabsWatcher(myProject, myPostponableRefresher, myLogData);

  refreshLogOnVcsEvents(logProviders, myPostponableRefresher, myLogData);

  myColorManager = new VcsLogColorManagerImpl(logProviders.keySet());

  if (scheduleRefreshImmediately) {
    scheduleInitialization();
  }

  Disposer.register(project, this);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:VcsLogManager.java


示例18: 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


示例19: 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


示例20: detect

import com.intellij.openapi.vcs.VcsRoot; //导入依赖的package包/类
@Nonnull
public Collection<VcsRoot> detect(@Nullable VirtualFile startDir) {
  if (startDir == null || myCheckers.length == 0) {
    return Collections.emptyList();
  }

  final Set<VcsRoot> roots = scanForRootsInsideDir(startDir);
  roots.addAll(scanForRootsInContentRoots());
  for (VcsRoot root : roots) {
    if (startDir.equals(root.getPath())) {
      return roots;
    }
  }
  List<VcsRoot> rootsAbove = scanForSingleRootAboveDir(startDir);
  roots.addAll(rootsAbove);
  return roots;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:VcsRootDetectorImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GetAliasesRequest类代码示例发布时间:2022-05-23
下一篇:
Java TDTDReader类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap