aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2011-04-19 19:11:05 (EDT)
committerChris Aniszczyk2011-04-20 10:33:28 (EDT)
commit63af01045f40fc3e7464a67192d3c113e58593e3 (patch)
treee37e55ca0894c35644f9413b83560efb59040169
parent0237f3c283ab545241e958de3bdc4752d4dbe81f (diff)
downloadegit-github-63af01045f40fc3e7464a67192d3c113e58593e3.zip
egit-github-63af01045f40fc3e7464a67192d3c113e58593e3.tar.gz
egit-github-63af01045f40fc3e7464a67192d3c113e58593e3.tar.bz2
Display exception message when thrown during validationrefs/changes/79/3179/2
Previously a message about bad credentials was always shown when validation failed due to exception. This was incorrect since validation may fail for other reasons such as the repository not existing or being private. Change-Id: I15e6f4e101c11206b54325659d60e4ab0def5688 Signed-off-by: Kevin Sawicki <kevin@github.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositorySettingsPage.java16
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/Messages.java4
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/messages.properties2
3 files changed, 17 insertions, 5 deletions
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositorySettingsPage.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositorySettingsPage.java
index e778f6f..1e1d78d 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositorySettingsPage.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositorySettingsPage.java
@@ -14,12 +14,14 @@ package org.eclipse.mylyn.github.ui.internal;
import java.io.IOException;
import java.net.URL;
+import java.text.MessageFormat;
import java.util.regex.Matcher;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.github.internal.GitHub;
@@ -164,8 +166,10 @@ public class GitHubRepositorySettingsPage extends
monitor.worked(20);
service.getIssues(user, project, null);
} catch (IOException e) {
- setStatus(GitHubUi
- .createErrorStatus(Messages.GitHubRepositorySettingsPage_ErrorInvalidCredentials));
+ String message = MessageFormat
+ .format(Messages.GitHubRepositorySettingsPage_StatusError,
+ e.getLocalizedMessage());
+ setStatus(GitHubUi.createErrorStatus(message));
return;
} finally {
monitor.done();
@@ -202,4 +206,12 @@ public class GitHubRepositorySettingsPage extends
super.applyTo(repository);
}
+ /**
+ * @see org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage#canValidate()
+ */
+ public boolean canValidate() {
+ return isPageComplete()
+ && (getMessage() == null || getMessageType() != IMessageProvider.ERROR);
+ }
+
}
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/Messages.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/Messages.java
index ec25197..1a5d09d 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/Messages.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/Messages.java
@@ -65,10 +65,10 @@ public class Messages extends NLS {
public static String GitHubRepositorySettingsPage_Description;
/** */
- public static String GitHubRepositorySettingsPage_ErrorInvalidCredentials;
+ public static String GitHubRepositorySettingsPage_ErrorMalformedUrl;
/** */
- public static String GitHubRepositorySettingsPage_ErrorMalformedUrl;
+ public static String GitHubRepositorySettingsPage_StatusError;
/** */
public static String GitHubRepositorySettingsPage_StatusSuccess;
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/messages.properties b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/messages.properties
index df6f2ef..52200bc 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/messages.properties
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/messages.properties
@@ -13,7 +13,7 @@ GitHubRepositoryQueryPage_TaskLoadingLabels=Loading labels
GitHubRepositoryQueryPage_TaskLoadingMilestones=Loading milestones
GitHubRepositoryQueryPage_TitleLabel=Title:
GitHubRepositorySettingsPage_Description=Enter repository location and credentials
-GitHubRepositorySettingsPage_ErrorInvalidCredentials=Invalid credentials. Please check your GitHub User ID and Password.
+GitHubRepositorySettingsPage_StatusError=Error validating settings: {0}
GitHubRepositorySettingsPage_ErrorMalformedUrl=Server URL must be in the form http://github.com/user/project
GitHubRepositorySettingsPage_StatusSuccess=Success\!
GitHubRepositorySettingsPage_TaskContactingServer=Contacting server...