Search in sources :

Example 26 with CvsHandler

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

the class CvsRollbackEnvironment method rollbackMissingFileDeletion.

public void rollbackMissingFileDeletion(List<FilePath> filePaths, final List<VcsException> exceptions, final RollbackProgressListener listener) {
    final CvsHandler cvsHandler = CommandCvsHandler.createCheckoutFileHandler(filePaths.toArray(new FilePath[filePaths.size()]), CvsConfiguration.getInstance(myProject), null);
    final CvsOperationExecutor executor = new CvsOperationExecutor(myProject);
    executor.performActionSync(cvsHandler, CvsOperationExecutorCallback.EMPTY);
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) CvsHandler(com.intellij.cvsSupport2.cvshandlers.CvsHandler) CommandCvsHandler(com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler) CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor)

Example 27 with CvsHandler

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

the class CheckoutAction method getCvsHandler.

protected CvsHandler getCvsHandler(CvsContext context) {
    final Project project = context.getProject();
    CheckoutWizard checkoutWizard = new CheckoutWizard(project);
    if (!checkoutWizard.showAndGet()) {
        return CvsHandler.NULL;
    }
    myUseAlternativeCheckoutPath = checkoutWizard.useAlternativeCheckoutLocation();
    myCheckoutDirectory = checkoutWizard.getCheckoutDirectory();
    mySelectedElements = checkoutWizard.getSelectedElements();
    return CommandCvsHandler.createCheckoutHandler(checkoutWizard.getSelectedConfiguration(), collectCheckoutPaths(), myCheckoutDirectory, myUseAlternativeCheckoutPath, CvsApplicationLevelConfiguration.getInstance().MAKE_CHECKED_OUT_FILES_READONLY, project == null ? null : VcsConfiguration.getInstance(project).getCheckoutOption());
}
Also used : Project(com.intellij.openapi.project.Project) CheckoutWizard(com.intellij.cvsSupport2.ui.experts.checkout.CheckoutWizard)

Example 28 with CvsHandler

use of com.intellij.cvsSupport2.cvshandlers.CvsHandler 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)

Example 29 with CvsHandler

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

the class ViewWatchersAction method onActionPerformed.

protected void onActionPerformed(CvsContext context, CvsTabbedWindow tabbedWindow, boolean successfully, CvsHandler handler) {
    super.onActionPerformed(context, tabbedWindow, successfully, handler);
    if (successfully) {
        List<WatcherInfo> watchers = myWatchersOperation.getWatchers();
        String filePath = CvsVfsUtil.getFileFor(context.getSelectedFile()).getAbsolutePath();
        final Project project = context.getProject();
        if (project == null) {
            return;
        }
        if (watchers.isEmpty()) {
            VcsBalloonProblemNotifier.showOverChangesView(project, CvsBundle.message("message.error.no.watchers.for.file", filePath), MessageType.INFO);
        } else {
            tabbedWindow.addTab(CvsBundle.message("message.watchers.for.file", filePath), new WatchersPanel(watchers), true, true, true, true, null, "cvs.watchers");
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) WatcherInfo(com.intellij.cvsSupport2.cvsoperations.cvsWatch.WatcherInfo) WatchersPanel(com.intellij.cvsSupport2.cvsoperations.cvsWatch.ui.WatchersPanel)

Example 30 with CvsHandler

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

the class IgnoreFileAction method refreshFilesAndStatuses.

private static void refreshFilesAndStatuses(final CvsContext context, final MultiMap<VirtualFile, VirtualFile> parentToSelectedChildren) {
    final Refreshable refreshablePanel = context.getRefreshableDialog();
    if (refreshablePanel != null)
        refreshablePanel.saveState();
    final int[] refreshedParents = new int[] { 0 };
    final Collection<VirtualFile> createdCvsIgnoreFiles = new ArrayList<>();
    for (final VirtualFile parent : parentToSelectedChildren.keySet()) {
        final Runnable runnable = new Runnable() {

            public void run() {
                try {
                    final VirtualFile cvsIgnoreFile = CvsVfsUtil.refreshAndfFindChild(parent, CvsUtil.CVS_IGNORE_FILE);
                    if (cvsIgnoreFile == null) {
                        final String path = parent.getPath() + "/" + CvsUtil.CVS_IGNORE_FILE;
                        LOG.error(String.valueOf(CvsVfsUtil.findFileByPath(path)) + " " + parent.getPath() + " " + new File(VfsUtil.virtualToIoFile(parent), CvsUtil.CVS_IGNORE_FILE).isFile());
                        return;
                    }
                    if (!CvsUtil.fileIsUnderCvs(cvsIgnoreFile) && !ChangeListManager.getInstance(context.getProject()).isIgnoredFile(cvsIgnoreFile) && !CvsEntriesManager.getInstance().fileIsIgnored(cvsIgnoreFile)) {
                        createdCvsIgnoreFiles.add(cvsIgnoreFile);
                    }
                    final Collection<VirtualFile> filesToUpdateStatus = parentToSelectedChildren.get(parent);
                    for (final VirtualFile file : filesToUpdateStatus) {
                        FileStatusManager.getInstance(context.getProject()).fileStatusChanged(file);
                        VcsDirtyScopeManager.getInstance(context.getProject()).fileDirty(file);
                    }
                } finally {
                    refreshedParents[0]++;
                    if (refreshedParents[0] == parentToSelectedChildren.size()) {
                        // all parents are refreshed
                        if (createdCvsIgnoreFiles.isEmpty()) {
                            refreshPanel(context);
                        } else {
                            addCvsIgnoreFilesToCvsAndRefreshPanel();
                        }
                    }
                }
            }

            private void addCvsIgnoreFilesToCvsAndRefreshPanel() {
                createAddFilesAction().actionPerformed(createContext(createdCvsIgnoreFiles, context));
            }

            private AddFileOrDirectoryAction createAddFilesAction() {
                return new AddFileOrDirectoryAction(CvsBundle.message("adding.cvsignore.files.to.cvs.action.name"), Options.ON_FILE_ADDING) {

                    protected void onActionPerformed(CvsContext context, CvsTabbedWindow tabbedWindow, boolean successfully, CvsHandler handler) {
                        refreshPanel(context);
                    }
                };
            }
        };
        parent.refresh(true, true, runnable);
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) CvsTabbedWindow(com.intellij.cvsSupport2.ui.CvsTabbedWindow) CvsHandler(com.intellij.cvsSupport2.cvshandlers.CvsHandler) CvsContext(com.intellij.cvsSupport2.actions.cvsContext.CvsContext) ArrayList(java.util.ArrayList) Refreshable(com.intellij.openapi.vcs.ui.Refreshable) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

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