Search in sources :

Example 1 with CvsContext

use of com.intellij.cvsSupport2.actions.cvsContext.CvsContext in project intellij-community by JetBrains.

the class CvsUpdateEnvironment method createSettingsAndUpdateContext.

private static UpdateSettingsOnCvsConfiguration createSettingsAndUpdateContext(final CvsConfiguration cvsConfiguration, @NotNull final Ref<SequentialUpdatesContext> contextRef) {
    if (contextRef.get() != null) {
        final CvsSequentialUpdateContext cvsContext = (CvsSequentialUpdateContext) contextRef.get();
        contextRef.set(null);
        return cvsContext.getConfiguration();
    }
    if ((!cvsConfiguration.CLEAN_COPY) && cvsConfiguration.UPDATE_DATE_OR_REVISION_SETTINGS.overridesDefault() && (cvsConfiguration.MERGING_MODE != CvsConfiguration.DO_NOT_MERGE)) {
        // split into 2 updates
        final UpdateSettingsOnCvsConfiguration secondUpdate = new UpdateSettingsOnCvsConfiguration(cvsConfiguration.PRUNE_EMPTY_DIRECTORIES, cvsConfiguration.MERGING_MODE, cvsConfiguration.MERGE_WITH_BRANCH1_NAME, cvsConfiguration.MERGE_WITH_BRANCH2_NAME, cvsConfiguration.CREATE_NEW_DIRECTORIES, cvsConfiguration.UPDATE_KEYWORD_SUBSTITUTION, new DateOrRevisionSettings(), cvsConfiguration.MAKE_NEW_FILES_READONLY, cvsConfiguration.CLEAN_COPY, cvsConfiguration.RESET_STICKY);
        contextRef.set(new CvsSequentialUpdateContext(secondUpdate, cvsConfiguration.UPDATE_DATE_OR_REVISION_SETTINGS.asString()));
        return new UpdateSettingsOnCvsConfiguration(cvsConfiguration.PRUNE_EMPTY_DIRECTORIES, CvsConfiguration.DO_NOT_MERGE, null, null, cvsConfiguration.CREATE_NEW_DIRECTORIES, cvsConfiguration.UPDATE_KEYWORD_SUBSTITUTION, cvsConfiguration.UPDATE_DATE_OR_REVISION_SETTINGS, cvsConfiguration.MAKE_NEW_FILES_READONLY, cvsConfiguration.CLEAN_COPY, cvsConfiguration.RESET_STICKY);
    } else {
        // usual way
        return new UpdateSettingsOnCvsConfiguration(cvsConfiguration, cvsConfiguration.CLEAN_COPY, cvsConfiguration.RESET_STICKY);
    }
}
Also used : DateOrRevisionSettings(com.intellij.cvsSupport2.config.DateOrRevisionSettings) UpdateSettingsOnCvsConfiguration(com.intellij.cvsSupport2.actions.update.UpdateSettingsOnCvsConfiguration)

Example 2 with CvsContext

use of com.intellij.cvsSupport2.actions.cvsContext.CvsContext in project intellij-community by JetBrains.

the class DeleteHandler method removeFiles.

private void removeFiles() {
    for (File file : myFilesToDeleteEntry) {
        if (!file.exists()) {
            CvsUtil.removeEntryFor(file);
        }
    }
    if (myDeletedFiles.isEmpty())
        return;
    for (String s : myDeletedFiles) {
        FileUtil.delete(new File(s));
    }
    final CvsContext context = new CvsContextAdapter() {

        public Project getProject() {
            return myProject;
        }

        public Collection<String> getDeletedFileNames() {
            return myDeletedFiles;
        }
    };
    RemoveLocallyFileOrDirectoryAction.createAutomaticallyAction().setAutoSave(false).actionPerformed(context);
}
Also used : CvsContext(com.intellij.cvsSupport2.actions.cvsContext.CvsContext) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) CvsContextAdapter(com.intellij.cvsSupport2.actions.cvsContext.CvsContextAdapter)

Example 3 with CvsContext

use of com.intellij.cvsSupport2.actions.cvsContext.CvsContext in project intellij-community by JetBrains.

the class GetFileFromRepositoryAction method getCvsHandler.

protected CvsHandler getCvsHandler(CvsContext context) {
    CvsLightweightFile[] cvsLightweightFiles = context.getSelectedLightweightFiles();
    Project project = context.getProject();
    if (cvsLightweightFiles != null) {
        boolean makeNewFilesReadOnly = project != null && CvsConfiguration.getInstance(project).MAKE_NEW_FILES_READONLY;
        return CommandCvsHandler.createGetFileFromRepositoryHandler(cvsLightweightFiles, makeNewFilesReadOnly);
    }
    final FilePath[] filePaths = context.getSelectedFilePaths();
    if (filePaths != null) {
        CvsConfiguration cvsConfiguration = CvsConfiguration.getInstance(project);
        // do not use -j's
        final UpdateSettingsOnCvsConfiguration updateSettings = new UpdateSettingsOnCvsConfiguration(cvsConfiguration, cvsConfiguration.CLEAN_COPY, cvsConfiguration.RESET_STICKY);
        return CommandCvsHandler.createUpdateHandler(filePaths, updateSettings, project, UpdatedFiles.create());
    }
    return CvsHandler.NULL;
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) Project(com.intellij.openapi.project.Project) CvsConfiguration(com.intellij.cvsSupport2.config.CvsConfiguration) UpdateSettingsOnCvsConfiguration(com.intellij.cvsSupport2.actions.update.UpdateSettingsOnCvsConfiguration) CvsLightweightFile(com.intellij.cvsSupport2.actions.cvsContext.CvsLightweightFile) UpdateSettingsOnCvsConfiguration(com.intellij.cvsSupport2.actions.update.UpdateSettingsOnCvsConfiguration)

Example 4 with CvsContext

use of com.intellij.cvsSupport2.actions.cvsContext.CvsContext in project intellij-community by JetBrains.

the class IgnoreFileAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    final MultiMap<VirtualFile, VirtualFile> parentToSelectedChildren = MultiMap.createSmart();
    final CvsContext context = CvsContextWrapper.createCachedInstance(e);
    final VirtualFile[] selectedFiles = context.getSelectedFiles();
    for (VirtualFile selectedFile : selectedFiles) {
        final VirtualFile parent = selectedFile.getParent();
        parentToSelectedChildren.putValue(parent, selectedFile);
        try {
            CvsUtil.ignoreFile(selectedFile);
        } catch (IOException e1) {
            final String message = CvsBundle.message("message.error.ignore.files", selectedFile.getPresentableUrl(), e1.getLocalizedMessage());
            VcsBalloonProblemNotifier.showOverChangesView(context.getProject(), message, MessageType.ERROR);
        }
    }
    refreshFilesAndStatuses(context, parentToSelectedChildren);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) CvsContext(com.intellij.cvsSupport2.actions.cvsContext.CvsContext) IOException(java.io.IOException)

Example 5 with CvsContext

use of com.intellij.cvsSupport2.actions.cvsContext.CvsContext in project intellij-community by JetBrains.

the class ImportAction method getCvsHandler.

protected CvsHandler getCvsHandler(CvsContext context) {
    final VirtualFile selectedFile = context.getSelectedFile();
    final ImportWizard importWizard = new ImportWizard(context.getProject(), selectedFile);
    if (!importWizard.showAndGet()) {
        return CvsHandler.NULL;
    }
    myImportDetails = importWizard.createImportDetails();
    if (myImportDetails == null)
        return CvsHandler.NULL;
    return CommandCvsHandler.createImportHandler(myImportDetails);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ImportWizard(com.intellij.cvsSupport2.ui.experts.importToCvs.ImportWizard)

Aggregations

CvsContext (com.intellij.cvsSupport2.actions.cvsContext.CvsContext)10 VirtualFile (com.intellij.openapi.vfs.VirtualFile)10 Project (com.intellij.openapi.project.Project)9 FilePath (com.intellij.openapi.vcs.FilePath)5 CommandCvsHandler (com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler)3 CvsHandler (com.intellij.cvsSupport2.cvshandlers.CvsHandler)3 CvsTabbedWindow (com.intellij.cvsSupport2.ui.CvsTabbedWindow)3 Presentation (com.intellij.openapi.actionSystem.Presentation)3 UpdateSettingsOnCvsConfiguration (com.intellij.cvsSupport2.actions.update.UpdateSettingsOnCvsConfiguration)2 CvsConfiguration (com.intellij.cvsSupport2.config.CvsConfiguration)2 SelectCvsConfigurationDialog (com.intellij.cvsSupport2.config.ui.SelectCvsConfigurationDialog)2 CvsConnectionSettings (com.intellij.cvsSupport2.connections.CvsConnectionSettings)2 CreateTagDialog (com.intellij.cvsSupport2.cvsoperations.cvsTagOrBranch.ui.CreateTagDialog)2 WatchOperation (com.intellij.cvsSupport2.cvsoperations.cvsWatch.WatchOperation)2 VcsContext (com.intellij.openapi.vcs.actions.VcsContext)2 File (java.io.File)2 CvsBundle (com.intellij.CvsBundle)1 CvsContextAdapter (com.intellij.cvsSupport2.actions.cvsContext.CvsContextAdapter)1 CvsLightweightFile (com.intellij.cvsSupport2.actions.cvsContext.CvsLightweightFile)1 CvsEntriesManager (com.intellij.cvsSupport2.application.CvsEntriesManager)1