當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。