Search in sources :

Example 1 with ModalityContext

use of com.intellij.cvsSupport2.cvsExecution.ModalityContext in project intellij-community by JetBrains.

the class UpdateHandler method onOperationFinished.

@Override
protected void onOperationFinished(ModalityContext modalityContext) {
    if (myUpdateSettings.getPruneEmptyDirectories()) {
        final IOFilesBasedDirectoryPruner pruner = new IOFilesBasedDirectoryPruner(ProgressManager.getInstance().getProgressIndicator());
        for (FilePath file : myFiles) {
            pruner.addFile(file.getIOFile());
        }
        pruner.execute();
    }
    if (!myCorruptedFiles.isEmpty()) {
        final int showOptions = CvsConfiguration.getInstance(myProject).SHOW_CORRUPTED_PROJECT_FILES;
        if (showOptions == Options.PERFORM_ACTION_AUTOMATICALLY) {
            for (final MergedWithConflictProjectOrModuleFile myCorruptedFile : myCorruptedFiles) {
                myCorruptedFile.setShouldBeCheckedOut();
            }
        } else if (showOptions == Options.SHOW_DIALOG) {
            modalityContext.runInDispatchThread(() -> new CorruptedProjectFilesDialog(myProject, myCorruptedFiles).show(), myProject);
        }
        final VcsKey vcsKey = CvsVcs2.getKey();
        for (final MergedWithConflictProjectOrModuleFile myCorruptedFile : myCorruptedFiles) {
            if (myCorruptedFile.shouldBeCheckedOut()) {
                addFileToCheckout(myCorruptedFile.getOriginal());
            } else {
                myUpdatedFiles.getGroupById(FileGroup.MODIFIED_ID).add(myCorruptedFile.getOriginal().getPath(), vcsKey, null);
            }
        }
    }
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) VcsKey(com.intellij.openapi.vcs.VcsKey) CorruptedProjectFilesDialog(com.intellij.cvsSupport2.cvsoperations.cvsUpdate.ui.CorruptedProjectFilesDialog) MergedWithConflictProjectOrModuleFile(com.intellij.cvsSupport2.cvsoperations.cvsUpdate.MergedWithConflictProjectOrModuleFile)

Example 2 with ModalityContext

use of com.intellij.cvsSupport2.cvsExecution.ModalityContext in project intellij-community by JetBrains.

the class CvsCheckoutProvider method doCheckout.

public void doCheckout(@NotNull final Project project, final CheckoutProvider.Listener listener) {
    final CheckoutWizard checkoutWizard = new CheckoutWizard(project);
    if (!checkoutWizard.showAndGet()) {
        return;
    }
    final boolean useAlternateCheckoutPath = checkoutWizard.useAlternativeCheckoutLocation();
    final File checkoutDirectory = checkoutWizard.getCheckoutDirectory();
    final CvsElement[] selectedElements = checkoutWizard.getSelectedElements();
    final CvsHandler checkoutHandler = CommandCvsHandler.createCheckoutHandler(checkoutWizard.getConfigurationWithDateOrRevisionSettings(), collectCheckoutPaths(selectedElements), checkoutDirectory, useAlternateCheckoutPath, CvsApplicationLevelConfiguration.getInstance().MAKE_CHECKED_OUT_FILES_READONLY, VcsConfiguration.getInstance(project).getCheckoutOption());
    final CvsOperationExecutor executor = new CvsOperationExecutor(null);
    executor.performActionSync(checkoutHandler, new CvsOperationExecutorCallback() {

        public void executionFinished(boolean successfully) {
            if (!executor.hasNoErrors()) {
                Messages.showErrorDialog(CvsBundle.message("message.error.checkout", executor.getResult().composeError().getLocalizedMessage()), CvsBundle.message("operation.name.check.out.project"));
            }
            refreshAfterCheckout(listener, selectedElements, checkoutDirectory, useAlternateCheckoutPath);
        }

        public void executionFinishedSuccessfully() {
        }

        public void executeInProgressAfterAction(ModalityContext modaityContext) {
        }
    });
}
Also used : CvsHandler(com.intellij.cvsSupport2.cvshandlers.CvsHandler) CommandCvsHandler(com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler) CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor) CvsElement(com.intellij.cvsSupport2.cvsBrowser.CvsElement) ModalityContext(com.intellij.cvsSupport2.cvsExecution.ModalityContext) File(java.io.File) CvsOperationExecutorCallback(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutorCallback) CheckoutWizard(com.intellij.cvsSupport2.ui.experts.checkout.CheckoutWizard)

Aggregations

CvsElement (com.intellij.cvsSupport2.cvsBrowser.CvsElement)1 CvsOperationExecutor (com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor)1 CvsOperationExecutorCallback (com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutorCallback)1 ModalityContext (com.intellij.cvsSupport2.cvsExecution.ModalityContext)1 CommandCvsHandler (com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler)1 CvsHandler (com.intellij.cvsSupport2.cvshandlers.CvsHandler)1 MergedWithConflictProjectOrModuleFile (com.intellij.cvsSupport2.cvsoperations.cvsUpdate.MergedWithConflictProjectOrModuleFile)1 CorruptedProjectFilesDialog (com.intellij.cvsSupport2.cvsoperations.cvsUpdate.ui.CorruptedProjectFilesDialog)1 CheckoutWizard (com.intellij.cvsSupport2.ui.experts.checkout.CheckoutWizard)1 FilePath (com.intellij.openapi.vcs.FilePath)1 VcsKey (com.intellij.openapi.vcs.VcsKey)1 File (java.io.File)1