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


Java VcsUtil.getVirtualFile方法代码示例

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


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

示例1: GitRepositoryUpdater

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
GitRepositoryUpdater(@NotNull GitRepository repository) {
  myRepository = repository;
  VirtualFile gitDir = repository.getGitDir();
  myWatchRequest = LocalFileSystem.getInstance().addRootToWatch(gitDir.getPath(), true);

  myRepositoryFiles = GitRepositoryFiles.getInstance(gitDir);
  DvcsUtil.visitVcsDirVfs(gitDir, GitRepositoryFiles.getSubDirRelativePaths());
  myHeadsDir = VcsUtil.getVirtualFile(myRepositoryFiles.getRefsHeadsPath());
  myRemotesDir = VcsUtil.getVirtualFile(myRepositoryFiles.getRefsRemotesPath());
  myTagsDir = VcsUtil.getVirtualFile(myRepositoryFiles.getRefsTagsPath());

  Project project = repository.getProject();
  myUpdateQueue = new QueueProcessor<Object>(new DvcsUtil.Updater(repository), project.getDisposed());
  if (!project.isDisposed()) {
    myMessageBusConnection = project.getMessageBus().connect();
    myMessageBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, this);
  }
  else {
    myMessageBusConnection = null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GitRepositoryUpdater.java

示例2: HgRepositoryUpdater

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
HgRepositoryUpdater(@NotNull final HgRepository repository) {
  VirtualFile hgDir = repository.getHgDir();
  myWatchRequest = LocalFileSystem.getInstance().addRootToWatch(hgDir.getPath(), true);
  myRepositoryFiles = HgRepositoryFiles.getInstance(hgDir);
  DvcsUtil.visitVcsDirVfs(hgDir, HgRepositoryFiles.getSubDirRelativePaths());

  myBranchHeadsDir = VcsUtil.getVirtualFile(myRepositoryFiles.getBranchHeadsDirPath());
  myMqDir = VcsUtil.getVirtualFile(myRepositoryFiles.getMQDirPath());

  Project project = repository.getProject();
  myUpdateQueue = new QueueProcessor<Object>(new DvcsUtil.Updater(repository), project.getDisposed());
  myUpdateConfigQueue = new QueueProcessor<Object>(new Consumer<Object>() {
    @Override
    public void consume(Object dummy) {
      repository.updateConfig();
    }
  }, project.getDisposed());
  if (!project.isDisposed()) {
    myMessageBusConnection = project.getMessageBus().connect();
    myMessageBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, this);
  }
  else {
    myMessageBusConnection = null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:HgRepositoryUpdater.java

示例3: updateEverything

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
/**
 * Based on the selected option and entered path to the target directory,
 * enable/disable the 'OK' button, show error text and update mySelectedDir. 
 */
private void updateEverything() {
  if (myShowDialog && myCreateRepositoryForTheRadioButton.isSelected()) {
    enableOKAction();
    mySelectedDir = myProject.getBaseDir();
  } else {
    final VirtualFile vf = VcsUtil.getVirtualFile(myTextFieldBrowser.getText());
    if (vf == null) {
      disableOKAction();
      mySelectedDir = null;
      return;
    }
    vf.refresh(false, false);
    if (vf.exists() && vf.isValid() && vf.isDirectory()) {
      enableOKAction();
      mySelectedDir = vf;
    } else {
      disableOKAction();
      mySelectedDir = null;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:HgInitDialog.java

示例4: unindex

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
/**
 * Remove file paths from index (git remove --cached).
 *
 * @param root  a git root
 * @param files files to remove from index.
 * @param toUnversioned passed true if the file will be unversioned after unindexing, i.e. it was added before the revert operation.
 * @throws VcsException if there is a problem with running git
 */
private void unindex(final VirtualFile root, final List<FilePath> files, boolean toUnversioned) throws VcsException {
  GitFileUtils.delete(myProject, root, files, "--cached", "-f");

  if (toUnversioned) {
    final GitRepository repo = GitUtil.getRepositoryManager(myProject).getRepositoryForRoot(root);
    final GitUntrackedFilesHolder untrackedFilesHolder = (repo == null ? null : repo.getUntrackedFilesHolder());
    for (FilePath path : files) {
      final VirtualFile vf = VcsUtil.getVirtualFile(path.getIOFile());
      if (untrackedFilesHolder != null && vf != null) {
        untrackedFilesHolder.add(vf);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GitRollbackEnvironment.java

示例5: create

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
public static ContentRevision create(@NotNull HgFile hgFile, @NotNull HgRevisionNumber revision) {
  VirtualFile virtualFile = VcsUtil.getVirtualFile(hgFile.getFile());
  if (virtualFile == null) {
    return null;
  }

  if (!virtualFile.getFileType().isBinary()) {
    return new HgCurrentContentRevision(hgFile, revision, virtualFile);
  }

  return new HgCurrentBinaryContentRevision(hgFile, revision);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:HgCurrentContentRevision.java

示例6: getDir

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
@Nullable
public VirtualFile getDir() {
  if (myDir == null) {
    myDir = VcsUtil.getVirtualFile(myDirFixture.getTempDirPath());
  }
  return myDir;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:HgTestRepository.java

示例7: guessRootForVcs

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
@Nullable
private static VirtualFile guessRootForVcs(@NotNull Project project, @Nullable AbstractVcs vcs, @Nullable String defaultRootPathValue) {
  if (project.isDisposed()) return null;
  LOG.debug("Guessing vcs root...");
  ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
  if (vcs == null) {
    LOG.debug("Vcs not found.");
    return null;
  }
  String vcsName = vcs.getDisplayName();
  VirtualFile[] vcsRoots = vcsManager.getRootsUnderVcs(vcs);
  if (vcsRoots.length == 0) {
    LOG.debug("No " + vcsName + " roots in the project.");
    return null;
  }

  if (vcsRoots.length == 1) {
    VirtualFile onlyRoot = vcsRoots[0];
    LOG.debug("Only one " + vcsName + " root in the project, returning: " + onlyRoot);
    return onlyRoot;
  }

  // get remembered last visited repository root
  if (defaultRootPathValue != null) {
    VirtualFile recentRoot = VcsUtil.getVirtualFile(defaultRootPathValue);
    if (recentRoot != null) {
      LOG.debug("Returning the recent root: " + recentRoot);
      return recentRoot;
    }
  }

  // otherwise return the root of the project dir or the root containing the project dir, if there is such
  VirtualFile projectBaseDir = project.getBaseDir();
  if (projectBaseDir == null) {
    VirtualFile firstRoot = vcsRoots[0];
    LOG.debug("Project base dir is null, returning the first root: " + firstRoot);
    return firstRoot;
  }
  VirtualFile rootCandidate;
  for (VirtualFile root : vcsRoots) {
    if (root.equals(projectBaseDir) || VfsUtilCore.isAncestor(root, projectBaseDir, true)) {
      LOG.debug("The best candidate: " + root);
      return root;
    }
  }
  rootCandidate = vcsRoots[0];
  LOG.debug("Returning the best candidate: " + rootCandidate);
  return rootCandidate;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:50,代码来源:DvcsUtil.java

示例8: after

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
@Override
public void after(@NotNull List<? extends VFileEvent> events) {
  // which files in .hg were changed
  boolean branchHeadsChanged = false;
  boolean branchFileChanged = false;
  boolean dirstateFileChanged = false;
  boolean mergeFileChanged = false;
  boolean rebaseFileChanged = false;
  boolean bookmarksFileChanged = false;
  boolean tagsFileChanged = false;
  boolean localTagsFileChanged = false;
  boolean currentBookmarkFileChanged = false;
  boolean mqChanged = false;

  boolean configHgrcChanged = false;
  for (VFileEvent event : events) {
    String filePath = event.getPath();
    if (filePath == null) {
      continue;
    }
    if (myRepositoryFiles.isbranchHeadsFile(filePath)) {
      branchHeadsChanged = true;
    }
    else if (myRepositoryFiles.isBranchFile(filePath)) {
      branchFileChanged = true;
      DvcsUtil.ensureAllChildrenInVfs(myBranchHeadsDir);
    }
    else if (myRepositoryFiles.isDirstateFile(filePath)) {
      dirstateFileChanged = true;
    }
    else if (myRepositoryFiles.isMergeFile(filePath)) {
      mergeFileChanged = true;
    }
    else if (myRepositoryFiles.isRebaseFile(filePath)) {
      rebaseFileChanged = true;
    }
    else if (myRepositoryFiles.isBookmarksFile(filePath)) {
      bookmarksFileChanged = true;
    }
    else if (myRepositoryFiles.isTagsFile(filePath)) {
      tagsFileChanged = true;
    }
    else if (myRepositoryFiles.isLocalTagsFile(filePath)) {
      localTagsFileChanged = true;
    }
    else if (myRepositoryFiles.isCurrentBookmarksFile(filePath)) {
      currentBookmarkFileChanged = true;
    }
    else if (myRepositoryFiles.isMqFile(filePath)) {
      mqChanged = true;
      if (myMqDir == null) {
        myMqDir = VcsUtil.getVirtualFile(myRepositoryFiles.getMQDirPath());
      }
      DvcsUtil.ensureAllChildrenInVfs(myMqDir);
    }
    else if (myRepositoryFiles.isConfigHgrcFile(filePath)) {
      configHgrcChanged = true;
    }
  }

  if (branchHeadsChanged || branchFileChanged || dirstateFileChanged || mergeFileChanged || rebaseFileChanged ||
      bookmarksFileChanged || currentBookmarkFileChanged || tagsFileChanged || localTagsFileChanged ||
      mqChanged) {
    myUpdateQueue.add(Void.TYPE);
  }
  if (configHgrcChanged) {
    myUpdateConfigQueue.add(Void.TYPE);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:70,代码来源:HgRepositoryUpdater.java

示例9: makeFile

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
protected VirtualFile makeFile(File file) throws IOException {
  file.createNewFile();
  VcsDirtyScopeManager.getInstance(myProject).fileDirty(myWorkingCopyDir);
  refreshVfs();
  return VcsUtil.getVirtualFile(file);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:HgTest.java


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