From 73aad85e7c97c2edff93ef1d49e488d51c165649 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Mon, 4 Apr 2011 18:39:53 +0200 Subject: [PATCH] IDEA-24600 (:local: specific configuration elements shown when cvs root is empty) --- .../intellij/cvsSupport2/CvsBundle.properties | 6 ++--- .../connections/CvsRootException.java | 26 +++++++++++++++++++ .../connections/CvsRootParser.java | 9 +++---- .../connections/RootFormatter.java | 6 ++--- .../connections/IDEARootFormatter.java | 6 ++++- .../ui/experts/SelectCvsElementStep.java | 10 ++++--- 6 files changed, 47 insertions(+), 16 deletions(-) create mode 100644 plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/CvsRootException.java diff --git a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/CvsBundle.properties b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/CvsBundle.properties index affc7b593ff2..620513981c14 100644 --- a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/CvsBundle.properties +++ b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/CvsBundle.properties @@ -46,7 +46,8 @@ operation.name.checkout.project=Checkout Project message.error.cannot.find.storing.copy=Cannot find any stored copy of file {0} message.confirmation.use.stored.copy.for.merge=Use stored copy {0} to merge with? operation.name.merge=Merge -message.error.invalid.cvs.root=Invalid cvs root: {0} +message.error.invalid.cvs.root=Invalid cvs root: \n{0} +message.error.missing.cvs.root=Method not found in root: {0} message.error.cannot.connect.to.cvs.title=Cannot Connect to CVS message.error.cannot.restore.cvs.admin.directories=Cannot restore CVS admin directories: {0} message.error.cannot.restore.cvs.admin.directories.title=Restoring CVS Admin Directories @@ -93,7 +94,6 @@ button.text.configure.cvs.roots=&Configure... dialog.title.select.cvs.root.configuration=Select CVS Root Configuration cvs.root.description.ssh.internal.implementation=ssh (internal implementation) cvs.root.description.local=local -error.mesage.wrong.method=wrong method: {0} error.message.cannot.establish.external.connection=Cannot establish external connection error.message.connection.already.open=Connection already open checkbox.text.use.internal.ssh.implementation=Use internal ssh implementation @@ -131,7 +131,7 @@ error.message.ssh.private.key.authentication.failed=Server rejected access for t exception.text.cannot.connect.with.invalid.root=createConnection() could not be called (invalid cvs root) exception.text.cannot.do.setoffline.with.invalid.root=setOffline() could not be called (invalid cvs root) error.message.incorrect.tag.name=Tag name {0} -exception.text.unsupported.method=Unsupported method: {0} +exception.text.unsupported.method=Unsupported method {0} found in root {1} exception.text.ext.server.rejected.access=Server rejected access exception.text.ext.cannot.establish.external.connection=Cannot establish external connection exception.text.cannot.establish.external.connection=Cannot establish external connection. Response from server was: {0} diff --git a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/CvsRootException.java b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/CvsRootException.java new file mode 100644 index 000000000000..9f9bbb5eb542 --- /dev/null +++ b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/CvsRootException.java @@ -0,0 +1,26 @@ +/* + * Copyright 2000-2011 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.cvsSupport2.connections; + +/** + * @author Bas Leijdekkers + */ +public class CvsRootException extends RuntimeException { + + public CvsRootException(String message) { + super(message); + } +} diff --git a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/CvsRootParser.java b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/CvsRootParser.java index e2202ad06d99..fcd4101c7667 100644 --- a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/CvsRootParser.java +++ b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/CvsRootParser.java @@ -15,6 +15,7 @@ */ package com.intellij.cvsSupport2.connections; +import com.intellij.CvsBundle; import com.intellij.openapi.util.text.StringUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -60,9 +61,7 @@ public final class CvsRootParser { CvsRootParser result = new CvsRootParser(); if (!StringUtil.startsWithChar(str, ':')) { - result.METHOD = CvsMethod.LOCAL_METHOD; - result.REPOSITORY = str; - return result; + throw new CvsRootException(CvsBundle.message("message.error.invalid.cvs.root", str)); } @NonNls String local2 = ":local:"; @@ -93,7 +92,7 @@ public final class CvsRootParser { } else { if (check) { - throw new IllegalArgumentException(com.intellij.CvsBundle.message("error.message.wrong.remote.repository", str)); + throw new IllegalArgumentException(CvsBundle.message("error.message.wrong.remote.repository", str)); } else { result.REPOSITORY = suffix; @@ -217,7 +216,7 @@ public final class CvsRootParser { } } if (check) { - throw new IllegalArgumentException(com.intellij.CvsBundle.message("error.mesage.wrong.method", str)); + throw new CvsRootException(CvsBundle.message("message.error.invalid.cvs.root", str)); } cvsRoot.METHOD = CvsMethod.AVAILABLE_METHODS[0]; if (!StringUtil.startsWithChar(str, ':')) return str; diff --git a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/RootFormatter.java b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/RootFormatter.java index 0b82feac4ba5..b6d4e8e8b005 100644 --- a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/RootFormatter.java +++ b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/RootFormatter.java @@ -15,6 +15,7 @@ */ package com.intellij.cvsSupport2.connections; +import com.intellij.CvsBundle; import com.intellij.openapi.util.text.StringUtil; import org.netbeans.lib.cvsclient.connection.PServerPasswordScrambler; @@ -36,9 +37,6 @@ public class RootFormatter { public Settings createConfiguration(String rootAsString, boolean check) { final CvsRootParser root = CvsRootParser.valueOf(rootAsString, check); final Settings result = myBuilder.createSettings(root.METHOD, rootAsString); - - - if (root.METHOD.equals(CvsMethod.LOCAL_METHOD)) { fillLocalSettings(root.REPOSITORY, result); } @@ -52,7 +50,7 @@ public class RootFormatter { fillSettings(root, result); } else { - throw new RuntimeException(com.intellij.CvsBundle.message("exception.text.unsupported.method", root.METHOD)); + throw new CvsRootException(CvsBundle.message("exception.text.unsupported.method", root.METHOD, rootAsString)); } return result; } diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/connections/IDEARootFormatter.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/connections/IDEARootFormatter.java index 72491a928ec0..72152c0ba993 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/connections/IDEARootFormatter.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/connections/IDEARootFormatter.java @@ -16,6 +16,7 @@ package com.intellij.cvsSupport2.connections; +import com.intellij.CvsBundle; import com.intellij.cvsSupport2.config.CvsRootConfiguration; import com.intellij.cvsSupport2.connections.ext.ExtConnectionCvsSettings; import com.intellij.cvsSupport2.connections.local.LocalConnectionSettings; @@ -36,6 +37,9 @@ public class IDEARootFormatter implements CvsRootSettingsBuilder