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


Java HgUtil.getNearestHgRoot方法代码示例

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


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

示例1: isVersionedDirectory

import org.zmlx.hg4idea.util.HgUtil; //导入方法依赖的package包/类
@Override
public boolean isVersionedDirectory(VirtualFile dir) {
  return HgUtil.getNearestHgRoot(dir) != null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:HgVcs.java

示例2: actionPerformed

import org.zmlx.hg4idea.util.HgUtil; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  myProject = e.getData(CommonDataKeys.PROJECT);
  if (myProject == null) {
    myProject = ProjectManager.getInstance().getDefaultProject();
  }

  // provide window to select the root directory
  final HgInitDialog hgInitDialog = new HgInitDialog(myProject);
  if (!hgInitDialog.showAndGet()) {
    return;
  }
  final VirtualFile selectedRoot = hgInitDialog.getSelectedFolder();
  if (selectedRoot == null) {
    return;
  }

  // check if the selected folder is not yet under mercurial and provide some options in that case
  final VirtualFile vcsRoot = HgUtil.getNearestHgRoot(selectedRoot);
  VirtualFile mapRoot = selectedRoot;
  boolean needToCreateRepo = false;
  if (vcsRoot != null) {
    final HgInitAlreadyUnderHgDialog dialog = new HgInitAlreadyUnderHgDialog(myProject,
                                                                             selectedRoot.getPresentableUrl(),
                                                                             vcsRoot.getPresentableUrl());
    if (!dialog.showAndGet()) {
      return;
    }

    if (dialog.getAnswer() == HgInitAlreadyUnderHgDialog.Answer.USE_PARENT_REPO) {
      mapRoot = vcsRoot;
    }
    else if (dialog.getAnswer() == HgInitAlreadyUnderHgDialog.Answer.CREATE_REPO_HERE) {
      needToCreateRepo = true;
    }
  }
  else { // no parent repository => creating the repository here.
    needToCreateRepo = true;
  }

  if (needToCreateRepo) {
    createRepository(selectedRoot, mapRoot);
  }
  else {
    updateDirectoryMappings(mapRoot);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:48,代码来源:HgInit.java

示例3: actionPerformed

import org.zmlx.hg4idea.util.HgUtil; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  myProject = e.getData(PlatformDataKeys.PROJECT);
  if (myProject == null) {
    myProject = ProjectManager.getInstance().getDefaultProject();
  }

  // provide window to select the root directory
  final HgInitDialog hgInitDialog = new HgInitDialog(myProject);
  hgInitDialog.show();
  if (!hgInitDialog.isOK()) {
    return;
  }
  final VirtualFile selectedRoot = hgInitDialog.getSelectedFolder();
  if (selectedRoot == null) {
    return;
  }

  // check if the selected folder is not yet under mercurial and provide some options in that case
  final VirtualFile vcsRoot = HgUtil.getNearestHgRoot(selectedRoot);
  VirtualFile mapRoot = selectedRoot;
  boolean needToCreateRepo = false;
  if (vcsRoot != null) {
    final HgInitAlreadyUnderHgDialog dialog = new HgInitAlreadyUnderHgDialog(myProject,
                                                 selectedRoot.getPresentableUrl(), vcsRoot.getPresentableUrl());
    dialog.show();
    if (!dialog.isOK()) {
      return;
    }

    if (dialog.getAnswer() == HgInitAlreadyUnderHgDialog.Answer.USE_PARENT_REPO) {
      mapRoot = vcsRoot;
    } else if (dialog.getAnswer() == HgInitAlreadyUnderHgDialog.Answer.CREATE_REPO_HERE) {
      needToCreateRepo = true;
    }
  } else { // no parent repository => creating the repository here.
    needToCreateRepo = true;
  }

  if (needToCreateRepo) {
    createRepository(selectedRoot, mapRoot); 
  } else {
    updateDirectoryMappings(mapRoot);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:46,代码来源:HgInit.java


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