diff options
author | Kevin Sawicki | 2011-04-19 23:11:05 +0000 |
---|---|---|
committer | Chris Aniszczyk | 2011-04-20 14:33:28 +0000 |
commit | 63af01045f40fc3e7464a67192d3c113e58593e3 (patch) | |
tree | e37e55ca0894c35644f9413b83560efb59040169 /org.eclipse.mylyn.github.ui | |
parent | 0237f3c283ab545241e958de3bdc4752d4dbe81f (diff) | |
download | egit-github-63af01045f40fc3e7464a67192d3c113e58593e3.tar.gz egit-github-63af01045f40fc3e7464a67192d3c113e58593e3.tar.xz egit-github-63af01045f40fc3e7464a67192d3c113e58593e3.zip |
Display exception message when thrown during validation
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>
Diffstat (limited to 'org.eclipse.mylyn.github.ui')
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 e778f6f5..1e1d78dc 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 ec25197f..1a5d09d7 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 df6f2ef1..52200bcd 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... |