aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2011-04-25 18:22:23 -0400
committerKevin Sawicki2011-04-25 18:25:22 -0400
commitabdac698cb76d5a21951f65fb1be891e3b0ec999 (patch)
treea65925a821f13cc144c5311aba45c19a570b631f
parent8bc31dd0b52578b4739dd56451b8a6ba8dfcbfd3 (diff)
downloadegit-github-abdac698cb76d5a21951f65fb1be891e3b0ec999.zip
egit-github-abdac698cb76d5a21951f65fb1be891e3b0ec999.tar.gz
egit-github-abdac698cb76d5a21951f65fb1be891e3b0ec999.tar.xz
Add credentials page for import repositories wizard.
The import repositories wizard will be used to bulk add all GitHub repositories to the Mylyn Task Repositories view. Currently repositories are added one a time. Change-Id: I7c346216d4de8b4996fdcee14e4a41beb0a8a6ca Signed-off-by: Kevin Sawicki <kevin@github.com>
-rw-r--r--org.eclipse.mylyn.github.ui/icons/obj16/checkall.gifbin0 -> 162 bytes
-rw-r--r--org.eclipse.mylyn.github.ui/icons/obj16/uncheckall.gifbin0 -> 146 bytes
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CredentialsWizardPage.java107
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubImages.java6
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/Messages.java48
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/messages.properties16
6 files changed, 177 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.github.ui/icons/obj16/checkall.gif b/org.eclipse.mylyn.github.ui/icons/obj16/checkall.gif
new file mode 100644
index 0000000..d805d0d
--- /dev/null
+++ b/org.eclipse.mylyn.github.ui/icons/obj16/checkall.gif
Binary files differ
diff --git a/org.eclipse.mylyn.github.ui/icons/obj16/uncheckall.gif b/org.eclipse.mylyn.github.ui/icons/obj16/uncheckall.gif
new file mode 100644
index 0000000..986785c
--- /dev/null
+++ b/org.eclipse.mylyn.github.ui/icons/obj16/uncheckall.gif
Binary files differ
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CredentialsWizardPage.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CredentialsWizardPage.java
new file mode 100644
index 0000000..c1dbc89
--- /dev/null
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CredentialsWizardPage.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2011 GitHub Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Kevin Sawicki (GitHub Inc.) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.mylyn.github.ui.internal;
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Credentials wizard page class.
+ *
+ * @author Kevin Sawicki (kevin@github.com)
+ */
+public class CredentialsWizardPage extends WizardPage {
+
+ private Text userText;
+
+ private Text passwordText;
+
+ /**
+ * Create credentials wizard page
+ */
+ public CredentialsWizardPage() {
+ super("credentialsPage", Messages.CredentialsWizardPage_Title, null); //$NON-NLS-1$
+ setDescription(Messages.CredentialsWizardPage_Description);
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite displayArea = new Composite(parent, SWT.NONE);
+ GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(false)
+ .applyTo(displayArea);
+
+ new Label(displayArea, SWT.NONE).setText(Messages.CredentialsWizardPage_LabelUser);
+
+ userText = new Text(displayArea, SWT.BORDER | SWT.SINGLE);
+ userText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ validatePage();
+ }
+ });
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(userText);
+
+ new Label(displayArea, SWT.NONE).setText(Messages.CredentialsWizardPage_LabelPassword);
+ passwordText = new Text(displayArea, SWT.BORDER | SWT.SINGLE
+ | SWT.PASSWORD);
+ passwordText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ validatePage();
+ }
+ });
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(passwordText);
+
+ setControl(displayArea);
+ setPageComplete(false);
+ }
+
+ private void validatePage() {
+ String message = null;
+ if (message == null && userText.getText().trim().length() == 0)
+ message = Messages.CredentialsWizardPage_ErrorUser;
+
+ if (message == null && passwordText.getText().trim().length() == 0)
+ message = Messages.CredentialsWizardPage_ErrorPassword;
+
+ setErrorMessage(message);
+ setPageComplete(message == null);
+
+ }
+
+ /**
+ * Get user name
+ *
+ * @return user name
+ */
+ public String getUserName() {
+ return this.userText.getText();
+ }
+
+ /**
+ * Get password
+ *
+ * @return password
+ */
+ public String getPassword() {
+ return this.passwordText.getText();
+ }
+
+}
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubImages.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubImages.java
index df22dfd..fac445e 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubImages.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubImages.java
@@ -31,10 +31,14 @@ public class GitHubImages {
public static final String GITHUB_LOGO_OBJ = NAME_PREFIX + "OBJ_GITHUB_LOGO"; //$NON-NLS-1$
public static final String GITHUB_ISSUE_LABEL_OBJ = NAME_PREFIX + "OBJ_GITHUB_ISSUE_LABEL"; //$NON-NLS-1$
public static final String GITHUB_ADD_OBJ = NAME_PREFIX + "GITHUB_ADD_OBJ"; //$NON-NLS-1$
+ public static final String GITHUB_CHECKALL_OBJ = NAME_PREFIX + "GITHUB_CHECKALL_OBJ"; //$NON-NLS-1$
+ public static final String GITHUB_UNCHECKALL_OBJ = NAME_PREFIX + "GITHUB_UNCHECKALL_OBJ"; //$NON-NLS-1$
public static final ImageDescriptor DESC_GITHUB_LOGO = create(PATH_OBJ, "github.png"); //$NON-NLS-1$
public static final ImageDescriptor DESC_GITHUB_ISSUE_LABEL = create(PATH_OBJ, "issue_label.png"); //$NON-NLS-1$
public static final ImageDescriptor DESC_GITHUB_ADD = create(PATH_OBJ, "add.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_GITHUB_CHECKALL = create(PATH_OBJ, "checkall.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_GITHUB_UNCHECKALL = create(PATH_OBJ, "uncheckall.gif"); //$NON-NLS-1$
private static ImageDescriptor create(String prefix, String name) {
return ImageDescriptor.createFromURL(makeImageURL(prefix, name));
@@ -51,6 +55,8 @@ public class GitHubImages {
manage(GITHUB_LOGO_OBJ, DESC_GITHUB_LOGO);
manage(GITHUB_ISSUE_LABEL_OBJ, DESC_GITHUB_ISSUE_LABEL);
manage(GITHUB_ADD_OBJ, DESC_GITHUB_ADD);
+ manage(GITHUB_CHECKALL_OBJ, DESC_GITHUB_CHECKALL);
+ manage(GITHUB_UNCHECKALL_OBJ, DESC_GITHUB_UNCHECKALL);
}
private static URL makeImageURL(String prefix, String name) {
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 1a5d09d..36251ce 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
@@ -20,6 +20,24 @@ public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.mylyn.github.ui.internal.messages"; //$NON-NLS-1$
/** */
+ public static String CredentialsWizardPage_Description;
+
+ /** */
+ public static String CredentialsWizardPage_ErrorPassword;
+
+ /** */
+ public static String CredentialsWizardPage_ErrorUser;
+
+ /** */
+ public static String CredentialsWizardPage_LabelPassword;
+
+ /** */
+ public static String CredentialsWizardPage_LabelUser;
+
+ /** */
+ public static String CredentialsWizardPage_Title;
+
+ /** */
public static String GitHubRepositoryQueryPage_ErrorLoading;
/** */
@@ -103,6 +121,36 @@ public class Messages extends NLS {
/** */
public static String IssueLabelAttributeEditor_TooltipAddLabel;
+ /** */
+ public static String RepositorySelectionWizardPage_Description;
+
+ /** */
+ public static String RepositorySelectionWizardPage_ErrorLoading;
+
+ /** */
+ public static String RepositorySelectionWizardPage_LabelAddGist;
+
+ /** */
+ public static String RepositorySelectionWizardPage_LabelRepos;
+
+ /** */
+ public static String RepositorySelectionWizardPage_LabelSelectionCount;
+
+ /** */
+ public static String RepositorySelectionWizardPage_TaskFetchingOrganizationRepositories;
+
+ /** */
+ public static String RepositorySelectionWizardPage_TaskFetchingRepositories;
+
+ /** */
+ public static String RepositorySelectionWizardPage_Title;
+
+ /** */
+ public static String RepositorySelectionWizardPage_TooltipCheckAll;
+
+ /** */
+ public static String RepositorySelectionWizardPage_TooltipUncheckAll;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
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 48bc8f2..dd53699 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
@@ -1,3 +1,9 @@
+CredentialsWizardPage_Description=Enter GitHub user name and password
+CredentialsWizardPage_ErrorPassword=Enter GitHub password
+CredentialsWizardPage_ErrorUser=Enter GitHub login name
+CredentialsWizardPage_LabelPassword=Password:
+CredentialsWizardPage_LabelUser=User ID:
+CredentialsWizardPage_Title=GitHub Credentials
GitHubRepositoryQueryPage_ErrorLoading=Error loading labels and milestones
GitHubRepositoryQueryPage_AssigneeLabel=Assigned to:
GitHubRepositoryQueryPage_Description=Issue query settings
@@ -26,3 +32,13 @@ IssueLabelAttributeEditor_DescriptionNewLabel=Label Name:
IssueLabelAttributeEditor_MessageEnterName=Enter label name
IssueLabelAttributeEditor_TitleNewLabel=New Label
IssueLabelAttributeEditor_TooltipAddLabel=Add Label...
+RepositorySelectionWizardPage_Description=Select repositories to import
+RepositorySelectionWizardPage_ErrorLoading=Error loading repositories: {0}
+RepositorySelectionWizardPage_LabelAddGist=Add Gist task repository
+RepositorySelectionWizardPage_LabelRepos=GitHub Repositories:
+RepositorySelectionWizardPage_LabelSelectionCount={0}/{1} repositories selected.
+RepositorySelectionWizardPage_TaskFetchingOrganizationRepositories=Getting your organization repositories
+RepositorySelectionWizardPage_TaskFetchingRepositories=Getting your repositories
+RepositorySelectionWizardPage_Title=Select Repositories
+RepositorySelectionWizardPage_TooltipCheckAll=Check all
+RepositorySelectionWizardPage_TooltipUncheckAll=Uncheck all