IDEA-24600 (:local: specific configuration elements shown when cvs root is empty)

This commit is contained in:
Bas Leijdekkers
2011-04-04 18:39:53 +02:00
parent 33aa918757
commit 73aad85e7c
6 changed files with 47 additions and 16 deletions
@@ -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}
@@ -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);
}
}
@@ -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;
@@ -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<Settings extends CvsSettings> {
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<Settings extends CvsSettings> {
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;
}
@@ -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<CvsConnectionSe
}
public CvsConnectionSettings createSettings(final CvsMethod method, final String cvsRootAsString) {
if (method == null) {
throw new CvsRootException(CvsBundle.message("message.error.missing.cvs.root", cvsRootAsString));
}
if (method.equals(CvsMethod.LOCAL_METHOD)) {
return new LocalConnectionSettings(cvsRootAsString, myCvsRootConfiguration);
}
@@ -49,7 +53,7 @@ public class IDEARootFormatter implements CvsRootSettingsBuilder<CvsConnectionSe
return new SshConnectionSettings(myCvsRootConfiguration);
}
throw new RuntimeException(com.intellij.CvsBundle.message("exception.text.unsupported.method", method));
throw new CvsRootException(CvsBundle.message("exception.text.unsupported.method", method, cvsRootAsString));
}
public String getPServerPassword(final String cvsRoot) {
@@ -17,6 +17,7 @@ package com.intellij.cvsSupport2.ui.experts;
import com.intellij.cvsSupport2.config.CvsRootConfiguration;
import com.intellij.cvsSupport2.connections.CvsEnvironment;
import com.intellij.cvsSupport2.connections.CvsRootException;
import com.intellij.cvsSupport2.cvsBrowser.CvsElement;
import com.intellij.cvsSupport2.cvsBrowser.CvsTree;
import com.intellij.cvsSupport2.cvsBrowser.LoginAbortedException;
@@ -24,6 +25,7 @@ import com.intellij.cvsSupport2.cvsExecution.ModalityContextImpl;
import com.intellij.cvsSupport2.cvsoperations.common.LoginPerformer;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.vcs.VcsException;
@@ -79,11 +81,13 @@ public class SelectCvsElementStep extends WizardStep {
});
/*final boolean logged = performer.loginAll(
new ModalityContextImpl(ModalityState.stateForComponent(mySelectCVSConfigurationStep.getComponent()), false), false);*/
final boolean logged = performer.loginAll(new ModalityContextImpl(ModalityState.current(), false), false);
if ((! logged) || (! errors.isNull())) {
try {
final boolean logged = performer.loginAll(new ModalityContextImpl(ModalityState.current(), false), false);
return logged && errors.isNull();
} catch (CvsRootException e) {
Messages.showErrorDialog(e.getMessage(), "Invalid CVS Root");
return false;
}
return true;
}
@Override