diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/CvsRootConfiguration.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/CvsRootConfiguration.java index ec247dbc400c..fec6b5d6fef8 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/CvsRootConfiguration.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/CvsRootConfiguration.java @@ -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 diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/ui/CvsConfigurationsListEditor.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/ui/CvsConfigurationsListEditor.java index 6182b816ef38..a051da3c11b7 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/ui/CvsConfigurationsListEditor.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/ui/CvsConfigurationsListEditor.java @@ -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 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); } diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/experts/SelectCvsElementStep.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/experts/SelectCvsElementStep.java index 263a486e362d..d455ec93df62 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/experts/SelectCvsElementStep.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/experts/SelectCvsElementStep.java @@ -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; }