remove cvs configuration getMyCopy() method

This commit is contained in:
Bas Leijdekkers
2014-06-23 16:32:36 +02:00
parent 544cebca45
commit 647a82e656
3 changed files with 20 additions and 35 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -91,12 +91,7 @@ public class CvsRootConfiguration extends AbstractConfiguration implements CvsEn
public static String createStringRepresentationOn(CvsMethod method, String user, String host, int port, String repository) {
if (method == CvsMethod.LOCAL_METHOD) {
final StringBuilder result = new StringBuilder();
result.append(SEPARATOR);
result.append(method.getName());
result.append(SEPARATOR);
result.append(repository);
return result.toString();
return SEPARATOR + method.getName() + SEPARATOR + repository;
}
final StringBuilder result = new StringBuilder();
result.append(SEPARATOR);
@@ -138,15 +133,6 @@ public class CvsRootConfiguration extends AbstractConfiguration implements CvsEn
return DATE_OR_REVISION_SETTINGS.USE_BRANCH && !DATE_OR_REVISION_SETTINGS.BRANCH.isEmpty();
}
public CvsRootConfiguration getMyCopy() {
try {
return (CvsRootConfiguration)clone();
}
catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
public void testConnection(Project project) throws AuthenticationException, IOException {
final IConnection connection = createSettings().createConnection(new ReadWriteStatistics());
final ErrorMessagesProcessor errorProcessor = new ErrorMessagesProcessor();
@@ -267,15 +253,20 @@ public class CvsRootConfiguration extends AbstractConfiguration implements CvsEn
}
@Override
public Object clone() throws CloneNotSupportedException {
final CvsRootConfiguration result = (CvsRootConfiguration)super.clone();
result.DATE_OR_REVISION_SETTINGS = DATE_OR_REVISION_SETTINGS.clone();
result.PROXY_SETTINGS = PROXY_SETTINGS.clone();
result.EXT_CONFIGURATION = EXT_CONFIGURATION.clone();
result.SSH_CONFIGURATION = SSH_CONFIGURATION.clone();
result.SSH_FOR_EXT_CONFIGURATION = SSH_FOR_EXT_CONFIGURATION.clone();
result.LOCAL_CONFIGURATION = LOCAL_CONFIGURATION.clone();
return result;
public CvsRootConfiguration clone() {
try {
final CvsRootConfiguration result = (CvsRootConfiguration)super.clone();
result.DATE_OR_REVISION_SETTINGS = DATE_OR_REVISION_SETTINGS.clone();
result.PROXY_SETTINGS = PROXY_SETTINGS.clone();
result.EXT_CONFIGURATION = EXT_CONFIGURATION.clone();
result.SSH_CONFIGURATION = SSH_CONFIGURATION.clone();
result.SSH_FOR_EXT_CONFIGURATION = SSH_FOR_EXT_CONFIGURATION.clone();
result.LOCAL_CONFIGURATION = LOCAL_CONFIGURATION.clone();
return result;
}
catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
@Override
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -131,7 +131,7 @@ public class CvsConfigurationsListEditor extends DialogWrapper implements DataPr
private void fillModel(List<CvsRootConfiguration> configurations) {
for (final CvsRootConfiguration configuration : configurations) {
myModel.addElement(configuration.getMyCopy());
myModel.addElement(configuration.clone());
}
}
@@ -198,8 +198,7 @@ public class CvsConfigurationsListEditor extends DialogWrapper implements DataPr
private void copySelectedConfiguration() {
if (!saveSelectedConfiguration()) return;
final CvsRootConfiguration newConfig = mySelection.getMyCopy();
myModel.addElement(newConfig);
myModel.addElement(mySelection.clone());
myList.setSelectedIndex(myModel.getSize() - 1);
}
@@ -99,12 +99,7 @@ public class SelectCvsElementStep extends WizardStep {
}
final boolean logged = isLogged(selectedConfiguration);
if (logged) {
try {
myCvsTree.setCvsRootConfiguration((CvsRootConfiguration)selectedConfiguration.clone());
}
catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
myCvsTree.setCvsRootConfiguration((CvsRootConfiguration)selectedConfiguration.clone());
}
return logged;
}