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


Java VfsUtil.markDirtyAndRefresh方法代码示例

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


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

示例1: findFiles

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
@NotNull
public static List<VirtualFile> findFiles(@NotNull List<String> filePaths, @Nullable String currentDirectory) throws Exception {
  List<VirtualFile> files = new ArrayList<VirtualFile>();

  for (String path : filePaths) {
    VirtualFile virtualFile = findFile(path, currentDirectory);
    if (virtualFile == null) throw new Exception("Can't find file " + path);
    files.add(virtualFile);
  }

  VfsUtil.markDirtyAndRefresh(false, false, false, VfsUtilCore.toVirtualFileArray(files));

  for (int i = 0; i < filePaths.size(); i++) {
    if (!files.get(i).isValid()) throw new Exception("Can't find file " + filePaths.get(i));
  }

  return files;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ApplicationStarterBase.java

示例2: createTemporalFile

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
@NotNull
public static VirtualFile createTemporalFile(@Nullable Project project,
                                             @NotNull String prefix,
                                             @NotNull String suffix,
                                             @NotNull byte[] content) throws IOException {
  File tempFile = FileUtil.createTempFile(PathUtil.suggestFileName(prefix + "_", true, false),
                                          PathUtil.suggestFileName("_" + suffix, true, false), true);
  if (content.length != 0) {
    FileUtil.writeToFile(tempFile, content);
  }
  VirtualFile file = VfsUtil.findFileByIoFile(tempFile, true);
  if (file == null) {
    throw new IOException("Can't create temp file for revision content");
  }
  VfsUtil.markDirtyAndRefresh(true, true, true, file);
  return file;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:DiffContentFactoryImpl.java

示例3: loadRoot

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
/**
 * Returns true if the root was loaded with conflict.
 * False is returned in all other cases: in the case of success and in case of some other error.
 */
private boolean loadRoot(final VirtualFile root) {
  LOG.info("loadRoot " + root);
  myProgressIndicator.setText(GitHandlerUtil.formatOperationName("Unstashing changes to", root));

  GitRepository repository = myRepositoryManager.getRepositoryForRoot(root);
  if (repository == null) {
    LOG.error("Repository is null for root " + root);
    return false;
  }

  GitSimpleEventDetector conflictDetector = new GitSimpleEventDetector(GitSimpleEventDetector.Event.MERGE_CONFLICT_ON_UNSTASH);
  GitCommandResult result = myGit.stashPop(repository, conflictDetector);
  VfsUtil.markDirtyAndRefresh(false, true, false, root);
  if (result.success()) {
    return false;
  }
  else if (conflictDetector.hasHappened()) {
    return true;
  }
  else {
    LOG.info("unstash failed " + result.getErrorOutputAsJoinedString());
    GitUIUtil.notifyImportantError(myProject, "Couldn't unstash", "<br/>" + result.getErrorOutputAsHtmlString());
    return false;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:GitStashChangesSaver.java

示例4: refreshFiles

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
@NotNull
public static Collection<VirtualFile> refreshFiles(@NotNull Collection<File> files) {
  Collection<VirtualFile> filesToRefresh = ContainerUtil.newHashSet();
  for (File file : files) {
    VirtualFile vf = findFirstValidVirtualParent(file);
    if (vf != null) {
      filesToRefresh.add(vf);
    }
  }
  VfsUtil.markDirtyAndRefresh(false, false, false, ArrayUtil.toObjectArray(filesToRefresh, VirtualFile.class));
  return filesToRefresh;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:RefreshVFsSynchronously.java

示例5: refreshDeletedOrReplaced

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
private static void refreshDeletedOrReplaced(@NotNull Collection<File> deletedOrReplaced) {
  Collection<VirtualFile> filesToRefresh = ContainerUtil.newHashSet();
  for (File file : deletedOrReplaced) {
    File parent = file.getParentFile();
    VirtualFile vf = findFirstValidVirtualParent(parent);
    if (vf != null) {
      filesToRefresh.add(vf);
    }
  }
  VfsUtil.markDirtyAndRefresh(false, true, false, ArrayUtil.toObjectArray(filesToRefresh, VirtualFile.class));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:RefreshVFsSynchronously.java

示例6: showMergeDialog

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
@Override
@NotNull
public List<VirtualFile> showMergeDialog(@NotNull List<VirtualFile> files,
                                         @NotNull MergeProvider provider,
                                         @NotNull MergeDialogCustomizer mergeDialogCustomizer) {
  if (files.isEmpty()) return Collections.emptyList();
  VfsUtil.markDirtyAndRefresh(false, false, false, ArrayUtil.toObjectArray(files, VirtualFile.class));
  final MultipleFileMergeDialog fileMergeDialog = new MultipleFileMergeDialog(myProject, files, provider, mergeDialogCustomizer);
  fileMergeDialog.show();
  return fileMergeDialog.getProcessedFiles();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:AbstractVcsHelperImpl.java

示例7: getScripts

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
@NotNull
private static List<VirtualFile> getScripts() {
  VirtualFile root = getScriptsRootDirectory();
  if (root == null) return ContainerUtil.emptyList();

  VfsUtil.markDirtyAndRefresh(false, true, true, root);
  List<VirtualFile> scripts = VfsUtil.collectChildrenRecursively(root);
  scripts = ContainerUtil.filter(scripts, ExtensionsRootType.regularFileFilter());
  ContainerUtil.sort(scripts, new FileNameComparator());
  return scripts;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:IdeStartupScripts.java

示例8: execute

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
public void execute() {
  saveAllDocuments();
  AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
  Map<GitRepository, GitCommandResult> results = ContainerUtil.newHashMap();
  try {
    for (Map.Entry<GitRepository, VcsFullCommitDetails> entry : myCommits.entrySet()) {
      GitRepository repository = entry.getKey();
      VirtualFile root = repository.getRoot();
      String target = entry.getValue().getId().asString();
      GitLocalChangesWouldBeOverwrittenDetector detector = new GitLocalChangesWouldBeOverwrittenDetector(root, RESET);

      GitCommandResult result = myGit.reset(repository, myMode, target, detector);
      if (!result.success() && detector.wasMessageDetected()) {
        GitCommandResult smartResult = proposeSmartReset(detector, repository, target);
        if (smartResult != null) {
          result = smartResult;
        }
      }
      results.put(repository, result);
      repository.update();
      VfsUtil.markDirtyAndRefresh(true, true, false, root);
      VcsDirtyScopeManager.getInstance(myProject).dirDirtyRecursively(root);
    }
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(myProject, token);
  }
  notifyResult(results);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:GitResetOperation.java

示例9: fetch

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
/**
 * Invokes 'git fetch'.
 * @return true if fetch was successful, false in the case of error.
 */
public GitFetchResult fetch(@NotNull GitRepository repository) {
  // TODO need to have a fair compound result here
  GitFetchResult fetchResult = GitFetchResult.success();
  if (myFetchAll) {
    fetchResult = fetchAll(repository, fetchResult);
  }
  else {
    return fetchCurrentRemote(repository);
  }

  VfsUtil.markDirtyAndRefresh(false, true, false, repository.getGitDir());
  return fetchResult;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GitFetcher.java

示例10: handleResult

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
private void handleResult(GitCommandResult result,
                          Project project,
                          GitSimpleEventDetector mergeConflictDetector,
                          GitLocalChangesWouldBeOverwrittenDetector localChangesDetector,
                          GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector,
                          GitRepository repository,
                          GitRevisionNumber currentRev,
                          Set<VirtualFile> affectedRoots,
                          Label beforeLabel) {
  GitRepositoryManager repositoryManager = GitUtil.getRepositoryManager(project);
  VirtualFile root = repository.getRoot();
  if (result.success() || mergeConflictDetector.hasHappened()) {
    VfsUtil.markDirtyAndRefresh(false, true, false, root);
    List<VcsException> exceptions = new ArrayList<VcsException>();
    GitMergeUtil.showUpdates(this, project, exceptions, root, currentRev, beforeLabel, getActionName(), ActionInfo.UPDATE);
    repositoryManager.updateRepository(root);
    runFinalTasks(project, GitVcs.getInstance(project), affectedRoots, getActionName(), exceptions);
  }
  else if (localChangesDetector.wasMessageDetected()) {
    LocalChangesWouldBeOverwrittenHelper.showErrorNotification(project, repository.getRoot(), getActionName(),
                                                               localChangesDetector.getRelativeFilePaths());
  }
  else if (untrackedFilesDetector.wasMessageDetected()) {
    GitUntrackedFilesHelper.notifyUntrackedFilesOverwrittenBy(project, root, untrackedFilesDetector.getRelativeFilePaths(),
                                                              getActionName(), null);
  }
  else {
    GitUIUtil.notifyError(project, "Git " + getActionName() + " Failed", result.getErrorOutputAsJoinedString(), true, null);
    repositoryManager.updateRepository(root);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:GitMergeAction.java

示例11: refreshAndConfigureVcsMappings

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
public static void refreshAndConfigureVcsMappings(final Project project, final VirtualFile root, final String path) {
  VfsUtil.markDirtyAndRefresh(false, true, false, root);
  ProjectLevelVcsManager manager = ProjectLevelVcsManager.getInstance(project);
  manager.setDirectoryMappings(VcsUtil.addMapping(manager.getDirectoryMappings(), path, GitVcs.NAME));
  manager.updateActiveVcss();
  VcsDirtyScopeManager.getInstance(project).dirDirtyRecursively(root);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:GitInit.java

示例12: refreshExecRoot

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
private static void refreshExecRoot(BlazeProjectData blazeProjectData) {
  // recursive refresh of the blaze execution root. This is required because our blaze aspect
  // can't yet tell us exactly which genfiles are required to resolve the project.
  VirtualFile execRoot =
      VirtualFileSystemProvider.getInstance()
          .getSystem()
          .refreshAndFindFileByIoFile(blazeProjectData.blazeInfo.getExecutionRoot());
  if (execRoot != null) {
    VfsUtil.markDirtyAndRefresh(false, true, true, execRoot);
  }
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:12,代码来源:BlazePythonSyncPlugin.java

示例13: execute

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
@Nullable
public HgCommandResult execute() {
  List<String> arguments = new LinkedList<String>();
  if (clean) {
    arguments.add("--clean");
  }

  if (!StringUtil.isEmptyOrSpaces(revision)) {
    arguments.add("--rev");
    arguments.add(revision);
  }

  final HgPromptCommandExecutor executor = new HgPromptCommandExecutor(project);
  executor.setShowOutput(true);
  HgCommandResult result;
  AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
  try {
    result =
      executor.executeInCurrentThread(repo, "update", arguments);
    if (!clean && hasUncommittedChangesConflict(result)) {
      final String message = "<html>Your uncommitted changes couldn't be merged into the requested changeset.<br>" +
                             "Would you like to perform force update and discard them?";
      if (showDiscardChangesConfirmation(project, message) == Messages.OK) {
        arguments.add("-C");
        result = executor.executeInCurrentThread(repo, "update", arguments);
      }
    }
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(project, token);
  }

  VfsUtil.markDirtyAndRefresh(true, true, false, repo);
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:HgUpdateCommand.java

示例14: refreshManifests

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
public void refreshManifests(Collection<File> manifestFiles) {
  List<VirtualFile> manifestVirtualFiles =
      manifestFiles
          .stream()
          .map(file -> VfsUtil.findFileByIoFile(file, false))
          .filter(Objects::nonNull)
          .collect(Collectors.toList());

  VfsUtil.markDirtyAndRefresh(
      false, false, false, ArrayUtil.toObjectArray(manifestVirtualFiles, VirtualFile.class));
  ApplicationManager.getApplication()
      .invokeAndWait(
          () -> PsiDocumentManager.getInstance(project).commitAllDocuments(),
          ModalityState.any());
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:16,代码来源:ManifestParser.java

示例15: hardRefresh

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
@Override
public void hardRefresh(@NotNull VirtualFile root) {
  VfsUtil.markDirtyAndRefresh(true, true, false, root);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:DvcsPlatformFacadeImpl.java


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