Search in sources :

Example 31 with CvsHandler

use of com.intellij.cvsSupport2.cvshandlers.CvsHandler in project intellij-community by JetBrains.

the class ImportAction method createCheckoutAction.

private AbstractAction createCheckoutAction(final boolean makeNewFilesReadOnly) {
    return new AbstractAction(false) {

        protected String getTitle(VcsContext context) {
            return CvsBundle.message("operation.name.check.out.project");
        }

        protected CvsHandler getCvsHandler(CvsContext context) {
            final Project project = context.getProject();
            return CommandCvsHandler.createCheckoutHandler(myImportDetails.getCvsRoot(), new String[] { myImportDetails.getModuleName() }, myImportDetails.getBaseImportDirectory(), true, makeNewFilesReadOnly, project == null ? null : VcsConfiguration.getInstance(project).getCheckoutOption());
        }

        protected void onActionPerformed(CvsContext context, CvsTabbedWindow tabbedWindow, boolean successfully, CvsHandler handler) {
            super.onActionPerformed(context, tabbedWindow, successfully, handler);
            final Project project = context.getProject();
            if (successfully) {
                if (project != null) {
                    final VirtualFile importedRoot = CvsVfsUtil.findFileByIoFile(myImportDetails.getBaseImportDirectory());
                    updateDirectoryMappings(project, importedRoot);
                }
            }
        }

        /**
       * Basically copied from GitInit/HgInit
       */
        private void updateDirectoryMappings(Project project, VirtualFile mapRoot) {
            if (project == null || project.isDefault()) {
                return;
            }
            final VirtualFile projectBaseDir = project.getBaseDir();
            if (projectBaseDir == null || !VfsUtil.isAncestor(projectBaseDir, mapRoot, false)) {
                return;
            }
            mapRoot.refresh(false, false);
            final String path = mapRoot.equals(projectBaseDir) ? "" : mapRoot.getPath();
            ProjectLevelVcsManager manager = ProjectLevelVcsManager.getInstance(project);
            manager.setDirectoryMappings(VcsUtil.addMapping(manager.getDirectoryMappings(), path, CvsVcs2.getInstance(project).getName()));
            manager.updateActiveVcss();
        }
    };
}
Also used : VcsContext(com.intellij.openapi.vcs.actions.VcsContext) CvsTabbedWindow(com.intellij.cvsSupport2.ui.CvsTabbedWindow) VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) CvsHandler(com.intellij.cvsSupport2.cvshandlers.CvsHandler) CommandCvsHandler(com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler) CvsContext(com.intellij.cvsSupport2.actions.cvsContext.CvsContext) ProjectLevelVcsManager(com.intellij.openapi.vcs.ProjectLevelVcsManager)

Example 32 with CvsHandler

use of com.intellij.cvsSupport2.cvshandlers.CvsHandler in project intellij-community by JetBrains.

the class CheckoutFileAction method getCvsHandler.

protected CvsHandler getCvsHandler(CvsContext context) {
    if (myModifiedFiles != null) {
        if (!myModifiedFiles.isEmpty()) {
            if (!new ReplaceFileConfirmationDialog(context.getProject(), CvsBundle.getCheckoutOperationName()).requestConfirmation(myModifiedFiles)) {
                return CvsHandler.NULL;
            }
        }
    }
    myModifiedFiles = null;
    Project project = context.getProject();
    FilePath[] filesArray = context.getSelectedFilePaths();
    List<FilePath> files = Arrays.asList(filesArray);
    if (CvsVcs2.getInstance(project).getCheckoutOptions().getValue() || OptionsDialog.shiftIsPressed(context.getModifiers())) {
        CheckoutFileDialog checkoutFileDialog = new CheckoutFileDialog(project, files);
        if (!checkoutFileDialog.showAndGet()) {
            return CvsHandler.NULL;
        }
    }
    return CommandCvsHandler.createCheckoutFileHandler(filesArray, CvsConfiguration.getInstance(project), VcsConfiguration.getInstance(project).getCheckoutOption());
}
Also used : ReplaceFileConfirmationDialog(com.intellij.openapi.vcs.ui.ReplaceFileConfirmationDialog) FilePath(com.intellij.openapi.vcs.FilePath) Project(com.intellij.openapi.project.Project) CheckoutFileDialog(com.intellij.cvsSupport2.cvsoperations.cvsCheckOut.ui.CheckoutFileDialog)

Example 33 with CvsHandler

use of com.intellij.cvsSupport2.cvshandlers.CvsHandler in project intellij-community by JetBrains.

the class CreateTagAction method getCvsHandler.

protected CvsHandler getCvsHandler(CvsContext context) {
    final FilePath[] selectedFiles = context.getSelectedFilePaths();
    final Project project = context.getProject();
    final CreateTagDialog dialog = new CreateTagDialog(selectedFiles, project, true);
    if (!dialog.showAndGet()) {
        return CvsHandler.NULL;
    }
    final boolean makeNewFilesReadOnly = CvsConfiguration.getInstance(project).MAKE_NEW_FILES_READONLY;
    return CommandCvsHandler.createTagHandler(selectedFiles, dialog.getTagName(), dialog.switchToThisBranch(), dialog.getOverrideExisting(), makeNewFilesReadOnly, project);
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) Project(com.intellij.openapi.project.Project) CreateTagDialog(com.intellij.cvsSupport2.cvsoperations.cvsTagOrBranch.ui.CreateTagDialog)

Example 34 with CvsHandler

use of com.intellij.cvsSupport2.cvshandlers.CvsHandler in project intellij-community by JetBrains.

the class DeleteTagAction method getCvsHandler.

protected CvsHandler getCvsHandler(CvsContext context) {
    final FilePath[] selectedFiles = context.getSelectedFilePaths();
    final DeleteTagDialog deleteTagDialog = new DeleteTagDialog(selectedFiles, context.getProject());
    if (!deleteTagDialog.showAndGet()) {
        return CvsHandler.NULL;
    }
    return CommandCvsHandler.createRemoveTagAction(selectedFiles, deleteTagDialog.getTagName());
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) DeleteTagDialog(com.intellij.cvsSupport2.cvsoperations.cvsTagOrBranch.ui.DeleteTagDialog)

Aggregations

VirtualFile (com.intellij.openapi.vfs.VirtualFile)11 CommandCvsHandler (com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler)10 CvsHandler (com.intellij.cvsSupport2.cvshandlers.CvsHandler)10 CvsOperationExecutor (com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor)9 Project (com.intellij.openapi.project.Project)9 FilePath (com.intellij.openapi.vcs.FilePath)9 File (java.io.File)7 CvsLightweightFile (com.intellij.cvsSupport2.actions.cvsContext.CvsLightweightFile)4 CvsTabbedWindow (com.intellij.cvsSupport2.ui.CvsTabbedWindow)4 CvsContext (com.intellij.cvsSupport2.actions.cvsContext.CvsContext)3 CvsConfiguration (com.intellij.cvsSupport2.config.CvsConfiguration)3 SelectCvsConfigurationDialog (com.intellij.cvsSupport2.config.ui.SelectCvsConfigurationDialog)2 TagOperation (com.intellij.cvsSupport2.cvsoperations.cvsTagOrBranch.TagOperation)2 CreateTagDialog (com.intellij.cvsSupport2.cvsoperations.cvsTagOrBranch.ui.CreateTagDialog)2 UpdateOperation (com.intellij.cvsSupport2.cvsoperations.cvsUpdate.UpdateOperation)2 WatchOperation (com.intellij.cvsSupport2.cvsoperations.cvsWatch.WatchOperation)2 CheckoutWizard (com.intellij.cvsSupport2.ui.experts.checkout.CheckoutWizard)2 VcsException (com.intellij.openapi.vcs.VcsException)2 VcsContext (com.intellij.openapi.vcs.actions.VcsContext)2 ArrayList (java.util.ArrayList)2