summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2011-04-21 16:37:56 (EDT)
committer Kevin Sawicki2011-04-21 16:37:56 (EDT)
commit7f25cd5bf4c06cbc2a60caf037c7899e40ba9de3 (patch)
treef3fae4f78a52b77f5eedb5eba54b8345ca5c7905
parent3d4fac7dfe6c6defcbac67e5096f88280d98d396 (diff)
downloadegit-github-7f25cd5bf4c06cbc2a60caf037c7899e40ba9de3.zip
egit-github-7f25cd5bf4c06cbc2a60caf037c7899e40ba9de3.tar.gz
egit-github-7f25cd5bf4c06cbc2a60caf037c7899e40ba9de3.tar.bz2
Add default title and user when creating first gist query. refs/changes/09/3209/1
Change-Id: I12a621786f3b3003b0751cfdfa9ee7d8d26e284c Signed-off-by: Kevin Sawicki <kevin@github.com>
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/GistRepositoryQueryPage.java19
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/Messages.java3
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/messages.properties1
3 files changed, 20 insertions, 3 deletions
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/GistRepositoryQueryPage.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/GistRepositoryQueryPage.java
index 1ad9af0..0507d63 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/GistRepositoryQueryPage.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/GistRepositoryQueryPage.java
@@ -13,7 +13,10 @@ package org.eclipse.mylyn.internal.github.ui.gist;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
+import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.internal.github.core.gist.IGistQueryConstants;
+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage;
@@ -69,12 +72,15 @@ public class GistRepositoryQueryPage extends AbstractRepositoryQueryPage {
}
};
- new Label(displayArea, SWT.NONE).setText(Messages.GistRepositoryQueryPage_LabelTitle);
+ new Label(displayArea, SWT.NONE)
+ .setText(Messages.GistRepositoryQueryPage_LabelTitle);
titleText = new Text(displayArea, SWT.SINGLE | SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, false).applyTo(titleText);
titleText.addModifyListener(completeListener);
+ titleText.setFocus();
- new Label(displayArea, SWT.NONE).setText(Messages.GistRepositoryQueryPage_LabelUser);
+ new Label(displayArea, SWT.NONE)
+ .setText(Messages.GistRepositoryQueryPage_LabelUser);
userText = new Text(displayArea, SWT.SINGLE | SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, false).applyTo(userText);
userText.addModifyListener(completeListener);
@@ -83,9 +89,16 @@ public class GistRepositoryQueryPage extends AbstractRepositoryQueryPage {
if (query != null) {
if (query.getSummary() != null)
titleText.setText(query.getSummary());
-
if (query.getAttribute(IGistQueryConstants.USER) != null)
userText.setText(query.getAttribute(IGistQueryConstants.USER));
+ } else if (TasksUiPlugin.getTaskList()
+ .getRepositoryQueries(getTaskRepository().getRepositoryUrl())
+ .isEmpty()) {
+ titleText.setText(Messages.GistRepositoryQueryPage_TitleDefault);
+ AuthenticationCredentials credentials = getTaskRepository()
+ .getCredentials(AuthenticationType.REPOSITORY);
+ if (credentials != null)
+ userText.setText(credentials.getUserName());
}
Dialog.applyDialogFont(displayArea);
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/Messages.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/Messages.java
index 84eea02..edaefa5 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/Messages.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/Messages.java
@@ -32,6 +32,9 @@ public class Messages extends NLS {
public static String GistRepositoryQueryPage_LabelUser;
/** */
+ public static String GistRepositoryQueryPage_TitleDefault;
+
+ /** */
public static String GistRepositorySettingsPage_Description;
/** */
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/messages.properties b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/messages.properties
index 1c1c02e..7dd660c 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/messages.properties
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/messages.properties
@@ -2,6 +2,7 @@ GistAttachmentPart_PartName=Files
GistConnectorUi_LabelTaskKind=Gist
GistRepositoryQueryPage_LabelTitle=Title:
GistRepositoryQueryPage_LabelUser=User:
+GistRepositoryQueryPage_TitleDefault=My Gists
GistRepositorySettingsPage_Description=Enter repository settings
GistRepositorySettingsPage_RepositoryLabelDefault=Gists
GistRepositorySettingsPage_StatusError=Error validating settings: {0}