com.intellij.openapi.progress.ProgressIndicator Java Examples

The following examples show how to use com.intellij.openapi.progress.ProgressIndicator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DisconnectServerAction.java    From saros with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void execute() {
  ProgressManager.getInstance()
      .run(
          new Task.Modal(project, "Disconnecting...", false) {

            @Override
            public void run(@NotNull ProgressIndicator indicator) {

              log.info(
                  "Disconnecting current connection: " + connectionHandler.getConnectionID());

              indicator.setIndeterminate(true);

              try {
                connectionHandler.disconnect();
              } finally {
                indicator.stop();
              }
            }
          });
}
 
Example #2
Source File: InjectedLanguageUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static BooleanRunnable reparse(@Nonnull PsiFile injectedPsiFile,
                                      @Nonnull DocumentWindow injectedDocument,
                                      @Nonnull PsiFile hostPsiFile,
                                      @Nonnull Document hostDocument,
                                      @Nonnull FileViewProvider hostViewProvider,
                                      @Nonnull ProgressIndicator indicator,
                                      @Nonnull ASTNode oldRoot,
                                      @Nonnull ASTNode newRoot,
                                      @Nonnull PsiDocumentManagerBase documentManager) {
  LanguageVersion languageVersion = injectedPsiFile.getLanguageVersion();
  InjectedFileViewProvider provider = (InjectedFileViewProvider)injectedPsiFile.getViewProvider();
  VirtualFile oldInjectedVFile = provider.getVirtualFile();
  VirtualFile hostVirtualFile = hostViewProvider.getVirtualFile();
  BooleanRunnable runnable = InjectionRegistrarImpl
          .reparse(languageVersion, (DocumentWindowImpl)injectedDocument, injectedPsiFile, (VirtualFileWindow)oldInjectedVFile, hostVirtualFile, hostPsiFile, (DocumentEx)hostDocument, indicator, oldRoot,
                   newRoot, documentManager);
  if (runnable == null) {
    EditorWindowImpl.disposeEditorFor(injectedDocument);
  }
  return runnable;
}
 
Example #3
Source File: DefaultSdksModel.java    From consulo with Apache License 2.0 6 votes vote down vote up
@RequiredUIAccess
private void setupSdk(Sdk newSdk, Consumer<Sdk> callback) {
  UIAccess uiAccess = UIAccess.current();

  new Task.ConditionalModal(null, "Setuping SDK...", false, PerformInBackgroundOption.DEAF) {
    @Override
    public void run(@Nonnull ProgressIndicator indicator) {
      SdkType sdkType = (SdkType)newSdk.getSdkType();
      sdkType.setupSdkPaths(newSdk);

      uiAccess.give(() -> {
        if (newSdk.getVersionString() == null) {
          String home = newSdk.getHomePath();
          Messages.showMessageDialog(ProjectBundle.message("sdk.java.corrupt.error", home), ProjectBundle.message("sdk.java.corrupt.title"), Messages.getErrorIcon());
        }

        doAdd(newSdk, callback);
      });
    }
  }.queue();
}
 
Example #4
Source File: InspectionEngine.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static Map<String, List<ProblemDescriptor>> inspectEx(@Nonnull final List<LocalInspectionToolWrapper> toolWrappers,
                                                             @Nonnull final PsiFile file,
                                                             @Nonnull final InspectionManager iManager,
                                                             final boolean isOnTheFly,
                                                             boolean failFastOnAcquireReadAction,
                                                             @Nonnull final ProgressIndicator indicator) {
  if (toolWrappers.isEmpty()) return Collections.emptyMap();


  TextRange range = file.getTextRange();
  List<Divider.DividedElements> allDivided = new ArrayList<>();
  Divider.divideInsideAndOutsideAllRoots(file, range, range, Conditions.alwaysTrue(), new CommonProcessors.CollectProcessor<>(allDivided));

  List<PsiElement> elements = ContainerUtil.concat(
          (List<List<PsiElement>>)ContainerUtil.map(allDivided, d -> ContainerUtil.concat(d.inside, d.outside, d.parents)));

  return inspectElements(toolWrappers, file, iManager, isOnTheFly, failFastOnAcquireReadAction, indicator, elements,
                         calcElementDialectIds(elements));
}
 
Example #5
Source File: Unity3dProjectImportUtil.java    From consulo-unity3d with Apache License 2.0 6 votes vote down vote up
private static Module createAssemblyUnityScriptModuleFirstPass(Project project,
															   ModifiableModuleModel newModel,
															   Sdk unityBundle,
															   MultiMap<Module, VirtualFile> virtualFilesByModule,
															   ProgressIndicator progressIndicator,
															   UnityProjectImportContext context)
{
	if(isVersionHigherOrEqual(unityBundle, "2018.2"))
	{
		Module module = newModel.findModuleByName(ASSEMBLY_UNITYSCRIPT_FIRSTPASS);
		if(module != null)
		{
			newModel.disposeModule(module);
		}
		return null;
	}
	else
	{
		return createAndSetupModule(ASSEMBLY_UNITYSCRIPT_FIRSTPASS, project, newModel, FIRST_PASS_PATHS, unityBundle, null, "unity3d-unityscript-child", JavaScriptFileType.INSTANCE,
				virtualFilesByModule, progressIndicator, context);
	}
}
 
Example #6
Source File: PassExecutorService.java    From consulo with Apache License 2.0 6 votes vote down vote up
static void log(ProgressIndicator progressIndicator, TextEditorHighlightingPass pass, @NonNls @Nonnull Object... info) {
  if (LOG.isDebugEnabled()) {
    CharSequence docText = pass == null || pass.getDocument() == null ? "" : ": '" + StringUtil.first(pass.getDocument().getCharsSequence(), 10, true) + "'";
    synchronized (PassExecutorService.class) {
      String infos = StringUtil.join(info, Functions.TO_STRING(), " ");
      String message = StringUtil.repeatSymbol(' ', getThreadNum() * 4) +
                       " " +
                       pass +
                       " " +
                       infos +
                       "; progress=" +
                       (progressIndicator == null ? null : progressIndicator.hashCode()) +
                       " " +
                       (progressIndicator == null ? "?" : progressIndicator.isCanceled() ? "X" : "V") +
                       docText;
      LOG.debug(message);
      //System.out.println(message);
    }
  }
}
 
Example #7
Source File: HaxeUtil.java    From intellij-haxe with Apache License 2.0 6 votes vote down vote up
public static void reparseProjectFiles(@NotNull final Project project) {
  Task.Backgroundable task = new Task.Backgroundable(project, HaxeBundle.message("haxe.project.reparsing"), false) {
    public void run(@NotNull ProgressIndicator indicator) {
      final Collection<VirtualFile> haxeFiles = new ArrayList<VirtualFile>();
      final VirtualFile baseDir = project.getBaseDir();
      if (baseDir != null) {
        FileBasedIndex.getInstance().iterateIndexableFiles(new ContentIterator() {
          public boolean processFile(VirtualFile file) {
            if (HaxeFileType.HAXE_FILE_TYPE == file.getFileType()) {
              haxeFiles.add(file);
            }
            return true;
          }
        }, project, indicator);
      }
      ApplicationManager.getApplication().invokeAndWait(new Runnable() {
        public void run() {
          FileContentUtil.reparseFiles(project, haxeFiles, !project.isDefault());
        }
      }, ModalityState.NON_MODAL);
    }
  };
  ProgressManager.getInstance().run(task);
}
 
Example #8
Source File: MoveMethodPanel.java    From IntelliJDeodorant with MIT License 6 votes vote down vote up
private static void openDefinition(@Nullable PsiMember unit, AnalysisScope scope) {
    new Task.Backgroundable(scope.getProject(), "Search Definition") {
        private PsiElement result;

        @Override
        public void run(@NotNull ProgressIndicator indicator) {
            indicator.setIndeterminate(true);
            result = unit;
        }

        @Override
        public void onSuccess() {
            if (result != null) {
                EditorHelper.openInEditor(result);
            }
        }
    }.queue();
}
 
Example #9
Source File: NoPolTask.java    From nopol with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void run(@NotNull ProgressIndicator progressIndicator) {
	if (ActorManager.runNopolLocally && !ActorManager.nopolIsRunning) {
		ActorManager.launchNopol();
	}
	Timeout timeout = new Timeout(scala.concurrent.duration.Duration.fromNanos(20*1000000000));// nano = 10^9
	EventSender.send(EventSender.Event.REPAIR_ATTEMPT);
	try {
		ConfigActor configActor = new ConfigActorImpl(nopolContext, Files.readAllBytes(Paths.get(outputZip)));
		this.future = Patterns.ask(ActorManager.remoteActor, configActor, timeout);
		if (Plugin.enableFancyRobot) {
			ApplicationManager.getApplication().invokeLater(runnerFancyRobot);
		}
		this.response = Await.result(future, timeout.duration());
	} catch (Exception e) {
		onError(e);
	}
}
 
Example #10
Source File: TranslatingCompilerFilesMonitorImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void ensureInitializationCompleted(Project project, ProgressIndicator indicator) {
  final int id = getProjectId(project);
  synchronized (myAsyncScanLock) {
    while (myInitInProgress.containsKey(id)) {
      if (!project.isOpen() || project.isDisposed() || (indicator != null && indicator.isCanceled())) {
        // makes no sense to continue waiting
        break;
      }
      try {
        myAsyncScanLock.wait(500);
      }
      catch (InterruptedException ignored) {
        break;
      }
    }
  }
}
 
Example #11
Source File: IdeaMMDPrintPanelAdaptor.java    From netbeans-mmd-plugin with Apache License 2.0 6 votes vote down vote up
@Override
public void startBackgroundTask(@Nonnull final MMDPrintPanel source, @Nonnull final String taskName, @Nonnull final Runnable task) {
  final Task.Backgroundable backgroundTask = new Task.Backgroundable(this.project, taskName) {
    @Override
    public void run(@Nonnull final ProgressIndicator indicator) {
      try {
        indicator.setIndeterminate(true);
        task.run();
        IdeaUtils.showPopup(String.format("%s has been sent to the printer", taskName), MessageType.INFO);
      } catch (Exception ex) {
        LOGGER.error("Print error", ex);
        IdeaUtils.showPopup("Print error! See the log!", MessageType.ERROR);
      } finally {
        indicator.stop();
      }
    }
  };
  ProgressManager.getInstance().run(backgroundTask);
}
 
Example #12
Source File: BuckBuildManager.java    From Buck-IntelliJ-Plugin with Apache License 2.0 6 votes vote down vote up
/**
 * Run handler in the current thread.
 *
 * @param handler              a handler to run
 * @param indicator            a progress manager
 * @param setIndeterminateFlag if true handler is configured as indeterminate
 * @param operationName
 */
public void runInCurrentThread(
    final BuckCommandHandler handler,
    final ProgressIndicator indicator,
    final boolean setIndeterminateFlag,
    @Nullable final String operationName) {
  runInCurrentThread(handler, new Runnable() {
    public void run() {
      if (indicator != null) {
        indicator.setText(operationName);
        indicator.setText2("");
        if (setIndeterminateFlag) {
          indicator.setIndeterminate(true);
        }
      }
    }
  });
}
 
Example #13
Source File: AndroidModuleLibraryManager.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void init41(@Nullable ProgressIndicator indicator) {
  boolean finished = false;
  try {
    //ProjectManagerImpl.initProject(path, this, true, null, null);
    Method method = ReflectionUtil
      .getDeclaredMethod(ProjectManagerImpl.class, "initProject", Path.class, ProjectImpl.class, boolean.class, Project.class,
                         ProgressIndicator.class);
    assert (method != null);
    try {
      method.invoke(null, path, this, true, null, null);
    }
    catch (IllegalAccessException | InvocationTargetException e) {
      throw new RuntimeException(e);
    }
    finished = true;
  }
  finally {
    if (!finished) {
      TransactionGuard.submitTransaction(this, () -> WriteAction.run(() -> Disposer.dispose(this)));
    }
  }
}
 
Example #14
Source File: AndroidModuleLibraryManager.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void init41(@Nullable ProgressIndicator indicator) {
  boolean finished = false;
  try {
    //ProjectManagerImpl.initProject(path, this, true, null, null);
    Method method = ReflectionUtil
      .getDeclaredMethod(ProjectManagerImpl.class, "initProject", Path.class, ProjectImpl.class, boolean.class, Project.class,
                         ProgressIndicator.class);
    assert (method != null);
    try {
      method.invoke(null, path, this, true, null, null);
    }
    catch (IllegalAccessException | InvocationTargetException e) {
      throw new RuntimeException(e);
    }
    finished = true;
  }
  finally {
    if (!finished) {
      TransactionGuard.submitTransaction(this, () -> WriteAction.run(() -> Disposer.dispose(this)));
    }
  }
}
 
Example #15
Source File: ApplierCompleter.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void wrapInReadActionAndIndicator(@Nonnull final Runnable process) {
  Runnable toRun = runInReadAction ? () -> {
    if (!ApplicationManagerEx.getApplicationEx().tryRunReadAction(process)) {
      failedSubTasks.add(this);
      doComplete(throwable);
    }
  } : process;
  ProgressIndicator existing = ProgressManager.getInstance().getProgressIndicator();
  if (existing == progressIndicator) {
    // we are already wrapped in an indicator - most probably because we came here from helper which steals children tasks
    toRun.run();
  }
  else {
    ProgressManager.getInstance().executeProcessUnderProgress(toRun, progressIndicator);
  }
}
 
Example #16
Source File: ProgressableTextEditorHighlightingPass.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public final void doCollectInformation(@Nonnull final ProgressIndicator progress) {
  if (!(progress instanceof DaemonProgressIndicator)) {
    throw new IncorrectOperationException("Highlighting must be run under DaemonProgressIndicator, but got: " + progress);
  }
  myFinished = false;
  if (myFile != null) {
    myHighlightingSession = HighlightingSessionImpl.getOrCreateHighlightingSession(myFile, (DaemonProgressIndicator)progress, getColorsScheme());
  }
  try {
    collectInformationWithProgress(progress);
  }
  finally {
    if (myFile != null) {
      sessionFinished();
    }
  }
}
 
Example #17
Source File: AsyncHelper.java    From r2m-plugin-android with Apache License 2.0 6 votes vote down vote up
private void performFileOperation() {
    project.save();
    FileDocumentManager.getInstance().saveAllDocuments();
    ProjectManagerEx.getInstanceEx().blockReloadingProjectOnExternalChanges();
    ProgressManager.getInstance().run(new Task.Backgroundable(project, MESSAGE_GENERATING_SERVICE, false) {
        public void run(@NotNull ProgressIndicator progressIndicator) {
            getGenerator().makeFilePerformance(progressIndicator);
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    onActionSuccess(GenerateActions.FILE_OPERATION_SUCCESS);
                }
            });
        }
    });
}
 
Example #18
Source File: ProgressSuspender.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void close() {
  synchronized (myLock) {
    myClosed = true;
    mySuspended = false;
    ((ProgressManagerImpl)ProgressManager.getInstance()).removeCheckCanceledHook(myHook);
  }
  for (ProgressIndicator progress : myProgresses) {
    ((UserDataHolder)progress).putUserData(PROGRESS_SUSPENDER, null);
  }
}
 
Example #19
Source File: Unity3dProjectImportUtil.java    From consulo-unity3d with Apache License 2.0 5 votes vote down vote up
private static Module createAssemblyCSharpModuleFirstPass(Project project,
														  ModifiableModuleModel newModel,
														  Sdk unityBundle,
														  MultiMap<Module, VirtualFile> virtualFilesByModule,
														  ProgressIndicator progressIndicator,
														  UnityProjectImportContext context)
{
	return createAndSetupModule("Assembly-CSharp-firstpass", project, newModel, FIRST_PASS_PATHS, unityBundle, null, "unity3d-csharp-child", CSharpFileType.INSTANCE, virtualFilesByModule,
			progressIndicator, context);
}
 
Example #20
Source File: DiffUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static List<LineFragment> compare(@Nonnull DiffRequest request,
                                         @Nonnull CharSequence text1,
                                         @Nonnull CharSequence text2,
                                         @Nonnull DiffConfig config,
                                         @Nonnull ProgressIndicator indicator) {
  indicator.checkCanceled();

  DiffUserDataKeysEx.DiffComputer diffComputer = request.getUserData(DiffUserDataKeysEx.CUSTOM_DIFF_COMPUTER);

  List<LineFragment> fragments;
  if (diffComputer != null) {
    fragments = diffComputer.compute(text1, text2, config.policy, config.innerFragments, indicator);
  }
  else {
    if (config.innerFragments) {
      fragments = ComparisonManager.getInstance().compareLinesInner(text1, text2, config.policy, indicator);
    }
    else {
      fragments = ComparisonManager.getInstance().compareLines(text1, text2, config.policy, indicator);
    }
  }

  indicator.checkCanceled();
  return ComparisonManager.getInstance().processBlocks(fragments, text1, text2,
                                                       config.policy, config.squashFragments, config.trimFragments);
}
 
Example #21
Source File: ByWord.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static List<DiffFragment> compare(@Nonnull CharSequence text1, @Nonnull List<InlineChunk> words1,
                                         @Nonnull CharSequence text2, @Nonnull List<InlineChunk> words2,
                                         @Nonnull ComparisonPolicy policy,
                                         @Nonnull ProgressIndicator indicator) {
  FairDiffIterable wordChanges = diff(words1, words2, indicator);
  wordChanges = optimizeWordChunks(text1, text2, words1, words2, wordChanges, indicator);

  FairDiffIterable delimitersIterable = matchAdjustmentDelimiters(text1, text2, words1, words2, wordChanges, indicator);
  DiffIterable iterable = matchAdjustmentWhitespaces(text1, text2, delimitersIterable, policy, indicator);

  return convertIntoDiffFragments(iterable);
}
 
Example #22
Source File: Generator.java    From r2m-plugin-android with Apache License 2.0 5 votes vote down vote up
private static void displayIndicatorMessage(ProgressIndicator progressIndicator,
                                            String message,
                                            int value)
        throws InterruptedException {
    if (null == progressIndicator) {
        return;
    }
    progressIndicator.setFraction((((double) value) / 100));
    progressIndicator.setText(message);
    Thread.sleep(1000);
}
 
Example #23
Source File: ProgressHelper.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Start a progress task.
 *
 * @param log the title of the progress task
 */
public void start(String log) {
  synchronized (myTasks) {
    myTasks.add(log);
    myTasks.notifyAll();

    if (myTask == null) {
      myTask = new Task.Backgroundable(myProject, log, false) {
        @Override
        public void run(@NotNull ProgressIndicator indicator) {
          indicator.setText(log);

          synchronized (myTasks) {
            while (!myTasks.isEmpty()) {
              indicator.setText(myTasks.get(myTasks.size() - 1));

              try {
                myTasks.wait();
              }
              catch (InterruptedException e) {
                // ignore

              }
              myTask = null;
            }
          }
        }
      };

      ApplicationManager.getApplication().invokeLater(() -> {
        synchronized (myTasks) {
          if (myTask != null && !myProject.isDisposed()) {
            ProgressManager.getInstance().run(myTask);
          }
        }
      });
    }
  }
}
 
Example #24
Source File: JoinLinesHandler.java    From consulo with Apache License 2.0 5 votes vote down vote up
JoinLineProcessor(@Nonnull DocumentEx doc, @Nonnull PsiFile file, int line, @Nonnull ProgressIndicator indicator) {
  myDoc = doc;
  myFile = file;
  myLine = line;
  myIndicator = indicator;
  Project project = file.getProject();
  myManager = PsiDocumentManager.getInstance(project);
  myStyleManager = CodeStyleManager.getInstance(project);
}
 
Example #25
Source File: ProgressIndicatorUtils.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static ReadTask.Continuation runUnderProgress(@Nonnull final ProgressIndicator progressIndicator, @Nonnull final ReadTask task) {
  return ProgressManager.getInstance().runProcess(() -> {
    try {
      return task.runBackgroundProcess(progressIndicator);
    }
    catch (ProcessCanceledException ignore) {
      return null;
    }
  }, progressIndicator);
}
 
Example #26
Source File: HTMLExporter.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void writeFileImpl(String folder, @NonNls String fileName, CharSequence buf) throws IOException {
  ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
  final String fullPath = folder + File.separator + fileName;

  if (indicator != null) {
    ProgressManager.checkCanceled();
    indicator.setText(InspectionsBundle.message("inspection.export.generating.html.for", fullPath));
  }

  FileWriter writer = null;
  try {
    File folderFile = new File(folder);
    folderFile.mkdirs();
    new File(fullPath).getParentFile().mkdirs();
    writer = new FileWriter(fullPath);
    writer.write(buf.toString().toCharArray());
  }
  finally {
    if (writer != null) {
      try {
        writer.close();
      }
      catch (IOException e) {
        //Cannot do anything in case of exception
      }
    }
  }
}
 
Example #27
Source File: SequentialModalProgressTask.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void run(@Nonnull ProgressIndicator indicator) {
  try {
    doRun(indicator);
  }
  catch (Exception e) {
    LOG.info("Unexpected exception occurred during processing sequential task '" + myTitle + "'", e);
  }
  finally {
    indicator.stop();
  }
}
 
Example #28
Source File: ByWord.java    From consulo with Apache License 2.0 5 votes vote down vote up
public MergeTrimSpacesCorrector(@Nonnull List<MergeRange> iterable,
                                @Nonnull CharSequence text1,
                                @Nonnull CharSequence text2,
                                @Nonnull CharSequence text3,
                                @Nonnull ProgressIndicator indicator) {
  myIterable = iterable;
  myText1 = text1;
  myText2 = text2;
  myText3 = text3;
  myIndicator = indicator;

  myChanges = new ArrayList<>();
}
 
Example #29
Source File: StopAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
private static Pair<List<HandlerItem>, HandlerItem> getItemsList(List<Pair<TaskInfo, ProgressIndicator>> tasks,
                                                                 List<RunContentDescriptor> descriptors,
                                                                 RunContentDescriptor toSelect) {
  if (tasks.isEmpty() && descriptors.isEmpty()) {
    return null;
  }

  List<HandlerItem> items = new ArrayList<>(tasks.size() + descriptors.size());
  HandlerItem selected = null;
  for (final RunContentDescriptor descriptor : descriptors) {
    final ProcessHandler handler = descriptor.getProcessHandler();
    if (handler != null) {
      HandlerItem item = new HandlerItem(descriptor.getDisplayName(), TargetAWT.to(descriptor.getIcon()), false) {
        @Override
        void stop() {
          ExecutionManagerImpl.stopProcess(descriptor);
        }
      };
      items.add(item);
      if (descriptor == toSelect) {
        selected = item;
      }
    }
  }

  boolean hasSeparator = true;
  for (final Pair<TaskInfo, ProgressIndicator> eachPair : tasks) {
    items.add(new HandlerItem(eachPair.first.getTitle(), AllIcons.Process.Step_passive, hasSeparator) {
      @Override
      void stop() {
        eachPair.second.cancel();
      }
    });
    hasSeparator = false;
  }
  return Pair.create(items, selected);
}
 
Example #30
Source File: ResolveConflictHelperTest.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
@Test
public void testAcceptChange_Happy() {
    when(CommandUtils.getConflicts(any(ServerContext.class), anyString(), any(MergeResults.class))).thenReturn(Arrays.asList(CONFLICT_RENAME, CONFLICT_CONTEXT));
    when(CommandUtils.resolveConflictsByConflict(any(ServerContext.class), eq(Arrays.asList(CONFLICT_CONTEXT)), eq(ResolveConflictsCommand.AutoResolveType.TakeTheirs))).thenReturn(Arrays.asList(CONFLICT_CONTEXT));
    when(CommandUtils.resolveConflictsByConflict(any(ServerContext.class), eq(Arrays.asList(CONFLICT_RENAME)), eq(ResolveConflictsCommand.AutoResolveType.TakeTheirs))).thenReturn(Arrays.asList(CONFLICT_RENAME));
    helper.acceptChange(Arrays.asList(CONFLICT_RENAME, CONFLICT_CONTEXT), mock(ProgressIndicator.class), mockProject, ResolveConflictsCommand.AutoResolveType.TakeTheirs, mockResolveConflictsModel);

    verify(mockResolveConflictsModel, never()).addError(any(ModelValidationInfo.class));
    verify(mockUpdatedFiles, times(2)).getGroupById(FileGroup.UPDATED_ID);
    verify(mockFileGroup).add(((RenameConflict) CONFLICT_RENAME).getServerPath(), TFSVcs.getKey(), null);
    verify(mockFileGroup).add(CONFLICT_CONTEXT.getLocalPath(), TFSVcs.getKey(), null);
}