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


Java VfsUtil.markDirty方法代码示例

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


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

示例1: runFinalTasks

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
protected final void runFinalTasks(@NotNull final Project project,
                                   @NotNull final GitVcs vcs,
                                   @NotNull final Set<VirtualFile> affectedRoots,
                                   @NotNull final String actionName,
                                   @NotNull final List<VcsException> exceptions) {
  VfsUtil.markDirty(true, false, ArrayUtil.toObjectArray(affectedRoots, VirtualFile.class));
  LocalFileSystem.getInstance().refreshFiles(affectedRoots, true, true, new Runnable() {
    @Override
    public void run() {
      VcsFileUtil.markFilesDirty(project, affectedRoots);
      for (TransactionRunnable task : myDelayedTasks) {
        task.run(exceptions);
      }
      myDelayedTasks.clear();
      vcs.showErrors(exceptions, actionName);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GitRepositoryAction.java

示例2: rollbackModifiedWithoutEditing

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
private static void rollbackModifiedWithoutEditing(final Project project, final LinkedHashSet<VirtualFile> modifiedWithoutEditing) {
  final String operationName = StringUtil.decapitalize(UIUtil.removeMnemonic(RollbackUtil.getRollbackOperationName(project)));
  String message = (modifiedWithoutEditing.size() == 1)
                   ? VcsBundle.message("rollback.modified.without.editing.confirm.single",
                                       operationName, modifiedWithoutEditing.iterator().next().getPresentableUrl())
                   : VcsBundle.message("rollback.modified.without.editing.confirm.multiple",
                                       operationName, modifiedWithoutEditing.size());
  int rc = showYesNoDialog(project, message, VcsBundle.message("changes.action.rollback.title", operationName), getQuestionIcon());
  if (rc != Messages.YES) {
    return;
  }
  final List<VcsException> exceptions = new ArrayList<VcsException>();

  final ProgressManager progressManager = ProgressManager.getInstance();
  final Runnable action = new Runnable() {
    public void run() {
      final ProgressIndicator indicator = progressManager.getProgressIndicator();
      try {
        ChangesUtil.processVirtualFilesByVcs(project, modifiedWithoutEditing, new ChangesUtil.PerVcsProcessor<VirtualFile>() {
          public void process(final AbstractVcs vcs, final List<VirtualFile> items) {
            final RollbackEnvironment rollbackEnvironment = vcs.getRollbackEnvironment();
            if (rollbackEnvironment != null) {
              if (indicator != null) {
                indicator.setText(vcs.getDisplayName() +
                                  ": performing " + UIUtil.removeMnemonic(rollbackEnvironment.getRollbackOperationName()).toLowerCase() + "...");
                indicator.setIndeterminate(false);
              }
              rollbackEnvironment
                .rollbackModifiedWithoutCheckout(items, exceptions, new RollbackProgressModifier(items.size(), indicator));
              if (indicator != null) {
                indicator.setText2("");
              }
            }
          }
        });
      }
      catch (ProcessCanceledException e) {
        // for files refresh  
      }
      if (!exceptions.isEmpty()) {
        AbstractVcsHelper.getInstance(project).showErrors(exceptions, VcsBundle.message("rollback.modified.without.checkout.error.tab",
                                                                                        operationName));
      }

      VfsUtil.markDirty(true, false, VfsUtilCore.toVirtualFileArray(modifiedWithoutEditing));

      VirtualFileManager.getInstance().asyncRefresh(new Runnable() {
        public void run() {
          for (VirtualFile virtualFile : modifiedWithoutEditing) {
            VcsDirtyScopeManager.getInstance(project).fileDirty(virtualFile);
          }
        }
      });
    }
  };
  progressManager.runProcessWithProgressSynchronously(action, operationName, true, project);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:58,代码来源:RollbackAction.java


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