本文整理汇总了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;
}
示例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);
}
}
示例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);
}
}