Search in sources :

Example 6 with CvsRootConfiguration

use of com.intellij.cvsSupport2.config.CvsRootConfiguration in project intellij-community by JetBrains.

the class MigrateCvsRootAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent event) {
    final VcsContext context = CvsContextWrapper.createInstance(event);
    final VirtualFile selectedFile = context.getSelectedFile();
    final Project project = context.getProject();
    final MigrateRootDialog dialog = new MigrateRootDialog(project, selectedFile);
    if (!dialog.showAndGet()) {
        return;
    }
    final File directory = dialog.getSelectedDirectory();
    final boolean shouldReplaceAllRoots = dialog.shouldReplaceAllRoots();
    final List<File> rootFiles = new ArrayList<>();
    try {
        if (shouldReplaceAllRoots) {
            collectRootFiles(directory, null, rootFiles);
        } else {
            collectRootFiles(directory, dialog.getCvsRoot(), rootFiles);
        }
    } catch (IOException e) {
        LOG.error(e);
        return;
    }
    final CvsRootConfiguration cvsConfiguration = dialog.getSelectedCvsConfiguration();
    final String cvsRoot = cvsConfiguration.getCvsRootAsString();
    for (final File file : rootFiles) {
        try {
            FileUtils.writeLine(file, cvsRoot);
        } catch (IOException e) {
            LOG.error(e);
            break;
        }
    }
    final AccessToken token = ApplicationManager.getApplication().acquireReadActionLock();
    try {
        for (File file : rootFiles) {
            CvsVfsUtil.findFileByIoFile(file).refresh(true, false);
        }
    } finally {
        token.finish();
    }
    StatusBar.Info.set("Finished migrating CVS root to " + cvsRoot, project);
}
Also used : VcsContext(com.intellij.openapi.vcs.actions.VcsContext) VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) AccessToken(com.intellij.openapi.application.AccessToken) ArrayList(java.util.ArrayList) MigrateRootDialog(com.intellij.cvsSupport2.ui.MigrateRootDialog) IOException(java.io.IOException) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) CvsRootConfiguration(com.intellij.cvsSupport2.config.CvsRootConfiguration)

Example 7 with CvsRootConfiguration

use of com.intellij.cvsSupport2.config.CvsRootConfiguration in project intellij-community by JetBrains.

the class CvsEntriesManager method createConnectionSettingsOn.

public CvsConnectionSettings createConnectionSettingsOn(String cvsRoot) {
    if (!myStringToSettingsMap.containsKey(cvsRoot)) {
        final CvsRootConfiguration rootConfiguration = myApplicationLevelConfiguration.getConfigurationForCvsRoot(cvsRoot);
        CvsConnectionSettings settings = new IDEARootFormatter(rootConfiguration).createConfiguration();
        myStringToSettingsMap.put(cvsRoot, settings);
    }
    return myStringToSettingsMap.get(cvsRoot);
}
Also used : CvsConnectionSettings(com.intellij.cvsSupport2.connections.CvsConnectionSettings) CvsRootConfiguration(com.intellij.cvsSupport2.config.CvsRootConfiguration) IDEARootFormatter(com.intellij.cvsSupport2.connections.IDEARootFormatter)

Example 8 with CvsRootConfiguration

use of com.intellij.cvsSupport2.config.CvsRootConfiguration in project intellij-community by JetBrains.

the class SelectCvsConfigurationPanel method fillModel.

private void fillModel(@Nullable CvsRootConfiguration configurationToSelect) {
    final CvsRootConfiguration selection = configurationToSelect == null ? mySelection : configurationToSelect;
    myModel.removeAllElements();
    final List<CvsRootConfiguration> configurations = CvsApplicationLevelConfiguration.getInstance().CONFIGURATIONS;
    for (CvsRootConfiguration configuration : configurations) {
        if (configuration.CVS_ROOT.isEmpty())
            continue;
        myModel.addElement(configuration);
    }
    if (selection != null)
        myList.setSelectedValue(selection, true);
    if (myList.getSelectedIndex() < 0 && myList.getModel().getSize() > 0) {
        myList.setSelectedIndex(0);
    }
}
Also used : CvsRootConfiguration(com.intellij.cvsSupport2.config.CvsRootConfiguration)

Example 9 with CvsRootConfiguration

use of com.intellij.cvsSupport2.config.CvsRootConfiguration in project intellij-community by JetBrains.

the class SelectCvsConfigurationPanel method editConfigurations.

public void editConfigurations() {
    final CvsApplicationLevelConfiguration configuration = CvsApplicationLevelConfiguration.getInstance();
    final CvsConfigurationsListEditor cvsConfigurationsListEditor = new CvsConfigurationsListEditor(new ArrayList<>(configuration.CONFIGURATIONS), myProject);
    final CvsRootConfiguration selectedConfiguration = getSelectedConfiguration();
    if (selectedConfiguration != null) {
        cvsConfigurationsListEditor.selectConfiguration(selectedConfiguration);
    }
    if (cvsConfigurationsListEditor.showAndGet()) {
        configuration.CONFIGURATIONS = cvsConfigurationsListEditor.getConfigurations();
        fillModel(cvsConfigurationsListEditor.getSelectedConfiguration());
    }
}
Also used : CvsApplicationLevelConfiguration(com.intellij.cvsSupport2.config.CvsApplicationLevelConfiguration) CvsRootConfiguration(com.intellij.cvsSupport2.config.CvsRootConfiguration)

Example 10 with CvsRootConfiguration

use of com.intellij.cvsSupport2.config.CvsRootConfiguration in project intellij-community by JetBrains.

the class CvsServicesImpl method createCvsVersionOn.

private static ComparableVcsRevisionOnOperation createCvsVersionOn(CvsModule module, Project project) {
    final CvsRootConfiguration rootConfiguration = CvsApplicationLevelConfiguration.getInstance().getConfigurationForCvsRoot(module.getRepository().getStringRepresentation());
    CvsConnectionSettings env = new IDEARootFormatter(rootConfiguration).createConfiguration();
    GetFileContentOperation operation = new GetFileContentOperation(new File(module.getPathInCvs()), env, new SimpleRevision(module.getRevision()));
    return new ComparableVcsRevisionOnOperation(operation, project);
}
Also used : GetFileContentOperation(com.intellij.cvsSupport2.cvsoperations.cvsContent.GetFileContentOperation) CvsConnectionSettings(com.intellij.cvsSupport2.connections.CvsConnectionSettings) ComparableVcsRevisionOnOperation(com.intellij.cvsSupport2.history.ComparableVcsRevisionOnOperation) File(java.io.File) VcsVirtualFile(com.intellij.openapi.vcs.vfs.VcsVirtualFile) CvsRootConfiguration(com.intellij.cvsSupport2.config.CvsRootConfiguration) IDEARootFormatter(com.intellij.cvsSupport2.connections.IDEARootFormatter) SimpleRevision(com.intellij.cvsSupport2.cvsoperations.dateOrRevision.SimpleRevision)

Aggregations

CvsRootConfiguration (com.intellij.cvsSupport2.config.CvsRootConfiguration)14 CvsApplicationLevelConfiguration (com.intellij.cvsSupport2.config.CvsApplicationLevelConfiguration)5 File (java.io.File)3 ArrayList (java.util.ArrayList)3 CvsConnectionSettings (com.intellij.cvsSupport2.connections.CvsConnectionSettings)2 IDEARootFormatter (com.intellij.cvsSupport2.connections.IDEARootFormatter)2 ProxySettings (com.intellij.cvsSupport2.config.ProxySettings)1 CvsConfigurationsListEditor (com.intellij.cvsSupport2.config.ui.CvsConfigurationsListEditor)1 CvsRootException (com.intellij.cvsSupport2.connections.CvsRootException)1 CvsLoginWorker (com.intellij.cvsSupport2.connections.login.CvsLoginWorker)1 CvsFile (com.intellij.cvsSupport2.cvsBrowser.CvsFile)1 LoginPerformer (com.intellij.cvsSupport2.cvsoperations.common.LoginPerformer)1 GetFileContentOperation (com.intellij.cvsSupport2.cvsoperations.cvsContent.GetFileContentOperation)1 SimpleRevision (com.intellij.cvsSupport2.cvsoperations.dateOrRevision.SimpleRevision)1 ComparableVcsRevisionOnOperation (com.intellij.cvsSupport2.history.ComparableVcsRevisionOnOperation)1 MigrateRootDialog (com.intellij.cvsSupport2.ui.MigrateRootDialog)1 AccessToken (com.intellij.openapi.application.AccessToken)1 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 Task (com.intellij.openapi.progress.Task)1