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