aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.console
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.console')
-rw-r--r--org.eclipse.jgit.console/.classpath1
-rw-r--r--org.eclipse.jgit.console/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.jgit.console/pom.xml3
-rw-r--r--org.eclipse.jgit.console/resources/org/eclipse/jgit/console/ConsoleText.properties5
-rw-r--r--org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleAuthenticator.java7
-rw-r--r--org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleSshSessionFactory.java6
-rw-r--r--org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleText.java66
7 files changed, 84 insertions, 7 deletions
diff --git a/org.eclipse.jgit.console/.classpath b/org.eclipse.jgit.console/.classpath
index ad32c83a78..31db9a9117 100644
--- a/org.eclipse.jgit.console/.classpath
+++ b/org.eclipse.jgit.console/.classpath
@@ -3,5 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="resources"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.jgit.console/META-INF/MANIFEST.MF b/org.eclipse.jgit.console/META-INF/MANIFEST.MF
index 7c97c5ab0f..792a7cd6bb 100644
--- a/org.eclipse.jgit.console/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.console/META-INF/MANIFEST.MF
@@ -7,6 +7,7 @@ Bundle-Version: 0.8.0.qualifier
Bundle-Vendor: %provider_name
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.jgit.console;version="0.8.0"
-Import-Package: org.eclipse.jgit.transport;version="[0.8.0,0.9.0)",
+Import-Package: org.eclipse.jgit.nls;version="[0.8.0,0.9.0)",
+ org.eclipse.jgit.transport;version="[0.8.0,0.9.0)",
org.eclipse.jgit.util;version="[0.8.0,0.9.0)"
Require-Bundle: com.jcraft.jsch;bundle-version="[0.1.37,0.2.0)"
diff --git a/org.eclipse.jgit.console/pom.xml b/org.eclipse.jgit.console/pom.xml
index b33c5724d7..11ac7019a2 100644
--- a/org.eclipse.jgit.console/pom.xml
+++ b/org.eclipse.jgit.console/pom.xml
@@ -84,6 +84,9 @@
<include>plugin.properties</include>
</includes>
</resource>
+ <resource>
+ <directory>resources/</directory>
+ </resource>
</resources>
<plugins>
diff --git a/org.eclipse.jgit.console/resources/org/eclipse/jgit/console/ConsoleText.properties b/org.eclipse.jgit.console/resources/org/eclipse/jgit/console/ConsoleText.properties
new file mode 100644
index 0000000000..9aaf2298da
--- /dev/null
+++ b/org.eclipse.jgit.console/resources/org/eclipse/jgit/console/ConsoleText.properties
@@ -0,0 +1,5 @@
+answerNo=n
+answerYes=y
+noSystemConsoleAvailable=No System.console available
+password=Password:
+usernameFor=Username for {0}:
diff --git a/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleAuthenticator.java b/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleAuthenticator.java
index 84fd520f75..3df5e44331 100644
--- a/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleAuthenticator.java
+++ b/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleAuthenticator.java
@@ -47,6 +47,7 @@ package org.eclipse.jgit.console;
import java.io.Console;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
+import java.text.MessageFormat;
import org.eclipse.jgit.util.CachedAuthenticator;
@@ -56,7 +57,7 @@ public class ConsoleAuthenticator extends CachedAuthenticator {
public static void install() {
final ConsoleAuthenticator c = new ConsoleAuthenticator();
if (c.cons == null)
- throw new NoClassDefFoundError("No System.console available");
+ throw new NoClassDefFoundError(ConsoleText.get().noSystemConsoleAvailable);
Authenticator.setDefault(c);
}
@@ -65,11 +66,11 @@ public class ConsoleAuthenticator extends CachedAuthenticator {
@Override
protected PasswordAuthentication promptPasswordAuthentication() {
final String realm = formatRealm();
- String username = cons.readLine("Username for %s: ", realm);
+ String username = cons.readLine(MessageFormat.format(ConsoleText.get().usernameFor + " ", realm));
if (username == null || username.isEmpty()) {
return null;
}
- char[] password = cons.readPassword("Password: ");
+ char[] password = cons.readPassword(ConsoleText.get().password + " ");
if (password == null) {
password = new char[0];
}
diff --git a/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleSshSessionFactory.java b/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleSshSessionFactory.java
index 7d36dded48..b11078dea8 100644
--- a/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleSshSessionFactory.java
+++ b/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleSshSessionFactory.java
@@ -70,7 +70,7 @@ public class ConsoleSshSessionFactory extends SshConfigSessionFactory {
public static void install() {
final ConsoleSshSessionFactory c = new ConsoleSshSessionFactory();
if (c.cons == null)
- throw new NoClassDefFoundError("No System.console available");
+ throw new NoClassDefFoundError(ConsoleText.get().noSystemConsoleAvailable);
SshSessionFactory.setInstance(c);
}
@@ -93,8 +93,8 @@ public class ConsoleSshSessionFactory extends SshConfigSessionFactory {
}
public boolean promptYesNo(final String msg) {
- String r = cons.readLine("%s [y/n]? ", msg);
- return "y".equalsIgnoreCase(r);
+ String r = cons.readLine("%s [%s/%s]? ", msg, ConsoleText.get().answerYes, ConsoleText.get().answerNo);
+ return ConsoleText.get().answerYes.equalsIgnoreCase(r);
}
public boolean promptPassword(final String msg) {
diff --git a/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleText.java b/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleText.java
new file mode 100644
index 0000000000..3f1734b01a
--- /dev/null
+++ b/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleText.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010, Sasa Zivkov <sasa.zivkov@sap.com>
+ * and other copyright owners as documented in the project's IP log.
+ *
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Distribution License v1.0 which
+ * accompanies this distribution, is reproduced below, and is
+ * available at http://www.eclipse.org/org/documents/edl-v10.php
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * - Neither the name of the Eclipse Foundation, Inc. nor the
+ * names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.eclipse.jgit.console;
+
+import org.eclipse.jgit.nls.NLS;
+import org.eclipse.jgit.nls.TranslationBundle;
+
+/**
+ * Translation bundle for JGit console
+ */
+public class ConsoleText extends TranslationBundle {
+
+ /**
+ * @return an instance of this translation bundle
+ */
+ public static ConsoleText get() {
+ return NLS.getBundleFor(ConsoleText.class);
+ }
+
+ /***/ public String answerNo;
+ /***/ public String answerYes;
+ /***/ public String noSystemConsoleAvailable;
+ /***/ public String password;
+ /***/ public String usernameFor;
+}