/** * Invokes {@link com.intellij.openapi.diff.DiffManager#getDiffTool()} to show difference between the given revisions of the given file. * @param project project under vcs control. * @param path file which revisions are compared. * @param revision1 first revision - 'before', to the left. * @param revision2 second revision - 'after', to the right. * @throws VcsException * @throws IOException */ public static void showDiff(@NotNull final Project project, @NotNull FilePath path, @NotNull VcsFileRevision revision1, @NotNull VcsFileRevision revision2, @NotNull String title1, @NotNull String title2) throws VcsException, IOException { final byte[] content1 = loadRevisionContent(revision1); final byte[] content2 = loadRevisionContent(revision2); String title = DiffRequestFactoryImpl.getContentTitle(path); DiffContent diffContent1 = createContent(project, content1, revision1, path); DiffContent diffContent2 = createContent(project, content2, revision2, path); final DiffRequest request = new SimpleDiffRequest(title, diffContent1, diffContent2, title1, title2); request.putUserData(REVISIONS_KEY, new VcsFileRevision[]{revision1, revision2}); WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { public void run() { DiffManager.getInstance().showDiff(project, request); } }, null, project); }
public static void showError(final Project project, final String message, final boolean error) { final Application application = ApplicationManager.getApplication(); if (application.isUnitTestMode()) { return; } final String title = VcsBundle.message("patch.apply.dialog.title"); final Runnable messageShower = new Runnable() { @Override public void run() { if (error) { Messages.showErrorDialog(project, message, title); } else { Messages.showInfoMessage(project, message, title); } } }; WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { @Override public void run() { messageShower.run(); } }, null, project); }
private void handleUnknownHost() { final Project project = myRuntime.getVcs().getProject(); final Ref<Integer> answer = new Ref<Integer>(); Runnable command = new Runnable() { @Override public void run() { final ServerSSHDialog dialog = new ServerSSHDialog(project, true, unknownHost, fingerprintAlgorithm, hostFingerprint); dialog.show(); answer.set(dialog.getResult()); } }; // Use ModalityState.any() as currently ssh credentials in terminal mode are requested in the thread that reads output and not in // the thread that started progress WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(command, ModalityState.any()); unknownHost = null; fingerprintAlgorithm = null; hostFingerprint = null; sendData(answer.get() == ISVNAuthenticationProvider.REJECTED ? "no" : "yes"); }
protected void showUpdatedFiles() { //if no files were updated, then there's nothing else to do if (mergeState.getUpdatedFiles().isEmpty()) { return; } final String notificationWithUpdateInfo = new UpdatedFilesNotifier(mergeState.getUpdatedFiles()) .prepareNotificationWithUpdateInfo(); WaitForProgressToShow.runOrInvokeLaterAboveProgress(() -> { final UpdateInfoTree tree = generateUpdateInfoTree(); CommittedChangesCache.getInstance(mergeState.getProject()) .processUpdatedFiles(mergeState.getUpdatedFiles(), tree::setChangeLists); showUpdateTree(tree); VcsBalloonProblemNotifier.showOverChangesView(mergeState.getProject(), "VCS Update Finished" + notificationWithUpdateInfo, MessageType.INFO); }, null, mergeState.getProject()); }
private void showErrorDialogAndMoveToAnotherList(final GeneralCommitProcessor processor, final int errorsSize, final int warningsSize) { WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { public void run() { final String message; if (errorsSize > 0 && warningsSize > 0) { message = VcsBundle.message("message.text.commit.failed.with.errors.and.warnings"); } else if (errorsSize > 0) { message = VcsBundle.message("message.text.commit.failed.with.errors"); } else { message = VcsBundle.message("message.text.commit.finished.with.warnings"); } //new VcsBalloonProblemNotifier(myProject, message, MessageType.ERROR).run(); Messages.showErrorDialog(message, VcsBundle.message("message.title.commit")); if (errorsSize > 0) { processor.afterFailedCheckIn(); } } }, null, myProject); }
public static void showError(final Project project, final String message, final boolean error) { final Application application = ApplicationManager.getApplication(); if (application.isUnitTestMode()) { return; } final String title = VcsBundle.message("patch.apply.dialog.title"); final Runnable messageShower = new Runnable() { public void run() { if (error) { Messages.showErrorDialog(project, message, title); } else { Messages.showInfoMessage(project, message, title); } } }; WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { public void run() { messageShower.run(); } }, null, project); }
private void reportException(final SVNException ex, final String baseUrl) { final SVNErrorCode errorCode = ex.getErrorMessage().getErrorCode(); if (errorCode.equals(SVNErrorCode.RA_ILLEGAL_URL) || errorCode.equals(SVNErrorCode.CLIENT_UNRELATED_RESOURCES) || errorCode.equals(SVNErrorCode.RA_DAV_PATH_NOT_FOUND) || errorCode.equals(SVNErrorCode.FS_NOT_FOUND)) { reportNotFound(baseUrl); } else { WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { public void run() { Messages.showMessageDialog(myProject, ex.getMessage(), SvnBundle.message("compare.with.branch.error.title"), Messages.getErrorIcon()); } }, null, myProject); LOG.info(ex); } }
private static void runAboveAll(@NotNull final Runnable runnable) { ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator(); if (progressIndicator != null && progressIndicator.isModal()) { WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(runnable); } else { Application app = ApplicationManager.getApplication(); if (app.isDispatchThread()) { runnable.run(); } else { app.invokeAndWait(runnable, ModalityState.any()); } } }
public static boolean checkMacros(@NotNull final Project project, @NotNull final Set<String> usedMacros) { usedMacros.removeAll(getDefinedMacros()); // try to lookup values in System properties String pathMacroSystemPrefix = "path.macro."; for (Iterator<String> it = usedMacros.iterator(); it.hasNext();) { String macro = it.next(); String value = System.getProperty(pathMacroSystemPrefix + macro, null); if (value != null) { AccessToken token = WriteAction.start(); try { PathMacros.getInstance().setMacro(macro, value); } finally { token.finish(); } it.remove(); } } if (usedMacros.isEmpty()) { // all macros in configuration files are defined return true; } // there are undefined macros, need to define them before loading components final boolean[] result = new boolean[1]; WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(new Runnable() { @Override public void run() { result[0] = showMacrosConfigurationDialog(project, usedMacros); } }, ModalityState.NON_MODAL); return result[0]; }
public void execute(Collection<Change> changes, String commitMessage) { if (changes.size() > 0 && !ChangesUtil.hasFileChanges(changes)) { WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { public void run() { Messages .showErrorDialog(myProject, VcsBundle.message("shelve.changes.only.directories"), VcsBundle.message("shelve.changes.action")); } }, null, myProject); return; } try { final ShelvedChangeList list = ShelveChangesManager.getInstance(myProject).shelveChanges(changes, commitMessage, true); ShelvedChangesViewManager.getInstance(myProject).activateView(list); Change[] changesArray = changes.toArray(new Change[changes.size()]); // todo better under lock ChangeList changeList = ChangesUtil.getChangeListIfOnlyOne(myProject, changesArray); if (changeList instanceof LocalChangeList) { LocalChangeList localChangeList = (LocalChangeList) changeList; if (localChangeList.getChanges().size() == changes.size() && !localChangeList.isReadOnly() && (! localChangeList.isDefault())) { ChangeListManager.getInstance(myProject).removeChangeList(localChangeList.getName()); } } } catch (final Exception ex) { LOG.info(ex); WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { public void run() { Messages.showErrorDialog(myProject, VcsBundle.message("create.patch.error.title", ex.getMessage()), CommonBundle.getErrorTitle()); } }, ModalityState.NON_MODAL, myProject); } }
private void doRefresh(final Project project, final List<Change> changesToRefresh) { final LocalHistoryAction action = LocalHistory.getInstance().startAction(myOperationName); final Runnable forAwtThread = new Runnable() { public void run() { action.finish(); LocalHistory.getInstance().putSystemLabel(myProject, (myLocalHistoryActionName == null) ? myOperationName : myLocalHistoryActionName, -1); final VcsDirtyScopeManager manager = PeriodicalTasksCloser.getInstance().safeGetComponent(project, VcsDirtyScopeManager.class); VcsGuess vcsGuess = new VcsGuess(myProject); for (Change change : changesToRefresh) { final ContentRevision beforeRevision = change.getBeforeRevision(); final ContentRevision afterRevision = change.getAfterRevision(); if ((!change.isIsReplaced()) && beforeRevision != null && Comparing.equal(beforeRevision, afterRevision)) { manager.fileDirty(beforeRevision.getFile()); } else { markDirty(manager, vcsGuess, beforeRevision); markDirty(manager, vcsGuess, afterRevision); } } myAfterRefresh.run(); } }; RefreshVFsSynchronously.updateChangesForRollback(changesToRefresh); WaitForProgressToShow.runOrInvokeLaterAboveProgress(forAwtThread, null, project); }
private void showErrorDialogAndMoveToAnotherList(final GeneralCommitProcessor processor, final int errorsSize, final int warningsSize, @NotNull final List<VcsException> errors) { WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { public void run() { String message; if (errorsSize > 0 && warningsSize > 0) { message = VcsBundle.message("message.text.commit.failed.with.errors.and.warnings"); } else if (errorsSize > 0) { message = StringUtil.pluralize(VcsBundle.message("message.text.commit.failed.with.error"), errorsSize); } else { message = StringUtil.pluralize(VcsBundle.message("message.text.commit.finished.with.warning"), warningsSize); } message += ":\n" + StringUtil.join(errors, new Function<VcsException, String>() { @Override public String fun(VcsException e) { return e.getMessage(); } }, "\n"); //new VcsBalloonProblemNotifier(myProject, message, MessageType.ERROR).run(); Messages.showErrorDialog(message, VcsBundle.message("message.title.commit")); if (errorsSize > 0) { processor.afterFailedCheckIn(); } } }, null, myProject); }
public void run(@NotNull final ProgressIndicator indicator) { myWaiter.run(indicator); WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { public void run() { myWaiter.onSuccess(); } }, myState == null ? ModalityState.NON_MODAL : myState, myProject); }
private void pingInSourceThread() { while (true) { try { // stop if project is being disposed if (ApplicationManager.getApplication().isDisposed() || ! myProject.isOpen()) return; if (getSuspendFlag()) { mySemaphore.down(); while (getSuspendFlag()) { mySemaphore.waitFor(500); } } final TaskDescriptor current = getNextMatching(); if (current == null) { return; } if (Where.AWT.equals(current.getWhere())) { WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(new Runnable() { @Override public void run() { current.run(SameProgressRunner.this); } }); } else { current.run(this); } } catch (ProcessCanceledException ignored) { } catch (Throwable t) { LOG.error(t); cancelIndicator(); } } }
@Override public void runInDispatchThread(@NotNull Runnable action, Project project) { Application application = ApplicationManager.getApplication(); if (application.isUnitTestMode() || application.isDispatchThread()) { action.run(); } else { WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(action, getCurrentModalityState()); } }
@Override public void apply(MultiMap<VirtualFile, TextFilePatchInProgress> patchGroups, LocalChangeList localList, String fileName, TransparentlyFailedValueI<Map<String, Map<String, CharSequence>>, PatchSyntaxException> additionalInfo) { final FileSaverDialog dialog = FileChooserFactory.getInstance().createSaveFileDialog( new FileSaverDescriptor("Save Patch to", ""), myProject); final VirtualFile baseDir = myProject.getBaseDir(); final VirtualFileWrapper save = dialog.save(baseDir, "TheirsChanges.patch"); if (save != null) { final CommitContext commitContext = new CommitContext(); final VirtualFile baseForPatch = myBaseForPatch == null ? baseDir : myBaseForPatch; try { final List<FilePatch> textPatches = patchGroupsToOneGroup(patchGroups, baseForPatch); commitContext.putUserData(BaseRevisionTextPatchEP.ourPutBaseRevisionTextKey, false); PatchWriter.writePatches(myProject, save.getFile().getPath(), textPatches, commitContext, CharsetToolkit.UTF8_CHARSET); } catch (final IOException e) { LOG.info(e); WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { @Override public void run() { Messages.showErrorDialog(myProject, VcsBundle.message("create.patch.error.title", e.getMessage()), CommonBundle.getErrorTitle()); } }, null, myProject); } } }
@Nullable public String requestSshCredentials(@NotNull final String realm, @NotNull final SimpleCredentialsDialog.Mode mode, @NotNull final String key) { return requestCredentials(realm, StringUtil.toLowerCase(mode.toString()), new Getter<String>() { @Override public String get() { final Ref<String> answer = new Ref<String>(); Runnable command = new Runnable() { public void run() { SimpleCredentialsDialog dialog = new SimpleCredentialsDialog(myVcs.getProject()); dialog.setup(mode, realm, key, true); dialog.setTitle(SvnBundle.message("dialog.title.authentication.required")); dialog.setSaveEnabled(false); if (dialog.showAndGet()) { answer.set(dialog.getPassword()); } } }; // Use ModalityState.any() as currently ssh credentials in terminal mode are requested in the thread that reads output and not in // the thread that started progress WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(command, ModalityState.any()); return answer.get(); } }); }
protected void reportGeneralException(final Exception e) { WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { public void run() { Messages.showMessageDialog(myProject, e.getMessage(), SvnBundle.message("compare.with.branch.error.title"), Messages.getErrorIcon()); } }, null, myProject); LOG.info(e); }
private void reportNotFound() { WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { public void run() { Messages.showMessageDialog(myProject, SvnBundle .message("compare.with.branch.location.error", myVirtualFile.getPresentableUrl(), myBranchUrl), SvnBundle.message("compare.with.branch.error.title"), Messages.getErrorIcon()); } }, null, myProject); }
public void resolveConflicts(final Project project, final ResolveConflictHelper conflictHelper) { WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(new Runnable() { public void run() { final ResolveConflictsController controller = new ResolveConflictsController(project, conflictHelper); controller.showModalDialog(); } }); }
private boolean canOverrideLocalConflictingItem(final GetOperation operation, boolean sourceNotTarget) throws TfsException { if (myDownloadMode == DownloadMode.FORCE || myDownloadMode == DownloadMode.MERGE) { return true; } LocalConflictHandlingType conflictHandlingType = getLocalConflictHandlingType(); if (conflictHandlingType == LocalConflictHandlingType.ERROR) { throw new OperationFailedException("Local conflict detected for " + VersionControlPath.localPathFromTfsRepresentation( sourceNotTarget ? operation.getSlocal() : operation.getTlocal())); } else if (conflictHandlingType == LocalConflictHandlingType.SHOW_MESSAGE) { String path = VersionControlPath.localPathFromTfsRepresentation(sourceNotTarget ? operation.getSlocal() : operation.getTlocal()); final String message = MessageFormat.format("Local conflict detected. Override local item?\n {0}", path); // TODO: more detailed message needed final String title = "Modify Files"; final Ref<Integer> result = new Ref<Integer>(); WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(new Runnable() { public void run() { result.set(Messages.showYesNoDialog(message, title, Messages.getQuestionIcon())); } }); if (result.get() == Messages.YES) { return true; } else { reportLocalConflict(operation, sourceNotTarget); return false; } } else { throw new IllegalArgumentException("Unknown conflict handling type: " + conflictHandlingType); } }
public static boolean checkMacros(final Project project, final Set<String> usedMacros) { final Set<String> defined = getDefinedMacros(); usedMacros.removeAll(defined); // try to lookup values in System properties @NonNls final String pathMacroSystemPrefix = "path.macro."; for (Iterator it = usedMacros.iterator(); it.hasNext();) { final String macro = (String)it.next(); final String value = System.getProperty(pathMacroSystemPrefix + macro, null); if (value != null) { ApplicationManager.getApplication().runWriteAction(new Runnable() { public void run() { PathMacros.getInstance().setMacro(macro, value); } }); it.remove(); } } if (usedMacros.isEmpty()) { return true; // all macros in configuration files are defined } // there are undefined macros, need to define them before loading components final boolean[] result = new boolean[1]; final Runnable r = new Runnable() { public void run() { result[0] = showMacrosConfigurationDialog(project, usedMacros); } }; WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(r, ModalityState.NON_MODAL); return result[0]; }
@Override public void apply(MultiMap<VirtualFile, FilePatchInProgress> patchGroups, LocalChangeList localList, String fileName, TransparentlyFailedValueI<Map<String, Map<String, CharSequence>>, PatchSyntaxException> additionalInfo) { final FileSaverDialog dialog = FileChooserFactory.getInstance().createSaveFileDialog( new FileSaverDescriptor("Save patch to", ""), myProject); final VirtualFile baseDir = myProject.getBaseDir(); final VirtualFileWrapper save = dialog.save(baseDir, "TheirsChanges.patch"); if (save != null && save.getFile() != null) { final CommitContext commitContext = new CommitContext(); final VirtualFile baseForPatch = myBaseForPatch == null ? baseDir : myBaseForPatch; try { final List<FilePatch> textPatches = patchGroupsToOneGroup(patchGroups, baseForPatch); commitContext.putUserData(BaseRevisionTextPatchEP.ourPutBaseRevisionTextKey, false); PatchWriter.writePatches(myProject, save.getFile().getPath(), textPatches, commitContext, CharsetToolkit.UTF8_CHARSET); } catch (final IOException e) { LOG.info(e); WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { public void run() { Messages.showErrorDialog(myProject, VcsBundle.message("create.patch.error.title", e.getMessage()), CommonBundle.getErrorTitle()); } }, null, myProject); } } }
private void reportNotFound(final String baseUrl) { WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { public void run() { Messages.showMessageDialog(myProject, SvnBundle.message("compare.with.branch.location.error", myVirtualFile.getPresentableUrl(), baseUrl), SvnBundle.message("compare.with.branch.error.title"), Messages.getErrorIcon()); } }, null, myProject); }
private static void runAboveAll(@Nonnull final Runnable runnable) { ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator(); if (progressIndicator != null && progressIndicator.isModal()) { WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(runnable); } else { Application app = ApplicationManager.getApplication(); app.invokeAndWait(runnable, ModalityState.any()); } }
private void showErrorDialogAndMoveToAnotherList(final GeneralCommitProcessor processor, final int errorsSize, final int warningsSize, @Nonnull final List<VcsException> errors) { WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { @Override public void run() { String message; if (errorsSize > 0 && warningsSize > 0) { message = VcsBundle.message("message.text.commit.failed.with.errors.and.warnings"); } else if (errorsSize > 0) { message = StringUtil.pluralize(VcsBundle.message("message.text.commit.failed.with.error"), errorsSize); } else { message = StringUtil.pluralize(VcsBundle.message("message.text.commit.finished.with.warning"), warningsSize); } message += ":\n" + StringUtil.join(errors, new Function<VcsException, String>() { @Override public String fun(VcsException e) { return e.getMessage(); } }, "\n"); //new VcsBalloonProblemNotifier(myProject, message, MessageType.ERROR).run(); Messages.showErrorDialog(message, VcsBundle.message("message.title.commit")); if (errorsSize > 0) { processor.afterFailedCheckIn(); } } }, null, myProject); }
/** * Invokes {@link DiffManager#getDiffTool()} to show difference between the given revisions of the given file. * @param project project under vcs control. * @param path file which revisions are compared. * @param revision1 first revision - 'before', to the left. * @param revision2 second revision - 'after', to the right. * @throws VcsException * @throws IOException */ public static void showDiff(@Nonnull final Project project, @Nonnull FilePath path, @Nonnull VcsFileRevision revision1, @Nonnull VcsFileRevision revision2, @Nonnull String title1, @Nonnull String title2) throws VcsException, IOException { final byte[] content1 = loadRevisionContent(revision1); final byte[] content2 = loadRevisionContent(revision2); FilePath path1 = getRevisionPath(revision1); FilePath path2 = getRevisionPath(revision2); String title; if (path1 != null && path2 != null) { title = DiffRequestFactoryImpl.getTitle(path1, path2, " -> "); } else { title = DiffRequestFactoryImpl.getContentTitle(path); } DiffContent diffContent1 = createContent(project, content1, revision1, path); DiffContent diffContent2 = createContent(project, content2, revision2, path); final DiffRequest request = new SimpleDiffRequest(title, diffContent1, diffContent2, title1, title2); diffContent1.putUserData(DiffUserDataKeysEx.REVISION_INFO, getRevisionInfo(revision1)); diffContent2.putUserData(DiffUserDataKeysEx.REVISION_INFO, getRevisionInfo(revision2)); WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { public void run() { DiffManager.getInstance().showDiff(project, request); } }, null, project); }
/** * Shows error message with specified message text and title. * The parent component is the root frame. * * @param project Current project component * @param message information message * @param title Dialog title */ public static void showErrorMessage(final Project project, final String message, final String title) { Runnable task = new Runnable() { public void run() { Messages.showErrorDialog(project, message, title); } }; WaitForProgressToShow.runOrInvokeLaterAboveProgress(task, null, project); }
public void callMe() { WaitForProgressToShow.runOrInvokeLaterAboveProgress(this, myState, myProject); }
private void refreshChangesFromLocation() { myBrowser.reset(); myInLoad = true; myBrowser.setLoading(true); ProgressManager.getInstance().run(new Task.Backgroundable(myProject, "Loading changes", true, BackgroundFromStartOption.getInstance()) { public void run(@NotNull final ProgressIndicator indicator) { try { final AsynchConsumer<List<CommittedChangeList>> appender = new AsynchConsumer<List<CommittedChangeList>>() { public void finished() { } public void consume(final List<CommittedChangeList> list) { new AbstractCalledLater(myProject, ModalityState.stateForComponent(myBrowser)) { public void run() { myBrowser.append(list); } }.callMe(); } }; final BufferedListConsumer<CommittedChangeList> bufferedListConsumer = new BufferedListConsumer<CommittedChangeList>(30, appender,-1); myProvider.loadCommittedChanges(mySettings, myLocation, myMaxCount, new AsynchConsumer<CommittedChangeList>() { public void finished() { bufferedListConsumer.flush(); } public void consume(CommittedChangeList committedChangeList) { if (myDisposed) { indicator.cancel(); } ProgressManager.checkCanceled(); bufferedListConsumer.consumeOne(committedChangeList); } }); } catch (final VcsException e) { LOG.info(e); WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { public void run() { Messages.showErrorDialog(myProject, "Error refreshing view: " + StringUtil.join(e.getMessages(), "\n"), "Committed Changes"); } }, null, myProject); } finally { myInLoad = false; myBrowser.setLoading(false); } } }); }
@SuppressWarnings({"UnnecessaryContinue"}) public void execute() { //for(final File file: myIOFiles) { // ApplicationManager.getApplication().runWriteAction(new Runnable() { // public void run() { // final VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file); // if (virtualFile != null) { // myAllFiles.add(virtualFile); // } // } // }); //} final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject); final CvsEntriesManager cvsEntriesManager = CvsEntriesManager.getInstance(); for (VirtualFile file : myAllFiles) { if (changeListManager.isIgnoredFile(file)) { continue; } else if (!CvsUtil.fileIsUnderCvs(file.getParent())) { continue; } else if (CvsUtil.fileIsLocallyRemoved(file)) { CvsUtil.restoreFile(file); } else if (CvsUtil.fileIsUnderCvs(file)) { continue; } else if (cvsEntriesManager.getCvsConnectionSettingsFor(file.getParent()).isOffline()) { continue; } else if (cvsEntriesManager.fileIsIgnored(file)) { continue; } else { myAddedFiles.add(file); } } if (!myAddedFiles.isEmpty()) { if (CvsVcs2.getInstance(myProject).getAddConfirmation().getValue() != VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY) { final Runnable addRunnable = new Runnable() { public void run() { if (!myCvsStorageComponent.getIsActive()) return; AddFileOrDirectoryAction.createActionToAddNewFileAutomatically() .actionPerformed(createDataContext(myAddedFiles)); } }; if (ApplicationManager.getApplication().isUnitTestMode()) { addRunnable.run(); } else { WaitForProgressToShow.runOrInvokeLaterAboveProgress(addRunnable, null, myProject); } } } }