Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2011-12-05 18:23:46 +0000
committerKevin Sawicki2011-12-05 18:23:46 +0000
commit3df733fcd54a8fcfd3c3341fff823d3fc17ede3d (patch)
treec436bbd790676e246f2f1db2f06b36bd11add968
parentff7db08b23b3fc53f01a9998a502cc9170a64307 (diff)
downloadegit-github-3df733fcd54a8fcfd3c3341fff823d3fc17ede3d.tar.gz
egit-github-3df733fcd54a8fcfd3c3341fff823d3fc17ede3d.tar.xz
egit-github-3df733fcd54a8fcfd3c3341fff823d3fc17ede3d.zip
Use correct task repository when opening a newly Gist
Now that multiple Gist Task Repositories are supported the GistNotificationPopup needs to track which repository to use when the link is selected Change-Id: Ibd8c911d8396c6856aabec3fa93a708a3a977c24
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/CreateGistHandler.java2
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/CreateGistJob.java10
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/GistNotificationPopup.java29
3 files changed, 22 insertions, 19 deletions
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/CreateGistHandler.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/CreateGistHandler.java
index d522de52..5b4c937a 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/CreateGistHandler.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/CreateGistHandler.java
@@ -176,7 +176,7 @@ public class CreateGistHandler extends AbstractHandler {
GistService service = new GistService(client);
CreateGistJob job = new CreateGistJob(
Messages.CreateGistHandler_CreateGistJobName, name, contents,
- service, isPublic);
+ service, isPublic, repository);
job.schedule();
}
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/CreateGistJob.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/CreateGistJob.java
index 1cb63012..a5098c72 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/CreateGistJob.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/CreateGistJob.java
@@ -23,6 +23,7 @@ import org.eclipse.egit.github.core.service.GistService;
import org.eclipse.mylyn.internal.github.core.GitHubException;
import org.eclipse.mylyn.internal.github.ui.GitHubUi;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
@@ -35,23 +36,26 @@ public class CreateGistJob extends Job {
private String content;
private GistService service;
private boolean isPublic;
+ private TaskRepository repository;
/**
* Create job that will create a Gist with the specified parameters
- *
+ *
* @param name
* @param title
* @param content
* @param service
* @param isPublic
+ * @param repository
*/
public CreateGistJob(String name, String title, String content,
- GistService service, boolean isPublic) {
+ GistService service, boolean isPublic, TaskRepository repository) {
super(name);
this.title = title;
this.content = content;
this.service = service;
this.isPublic = isPublic;
+ this.repository = repository;
}
@Override
@@ -68,7 +72,7 @@ public class CreateGistJob extends Job {
public void run() {
GistNotificationPopup popup = new GistNotificationPopup(
- display, created, title);
+ display, created, title, repository);
popup.create();
popup.open();
}
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/GistNotificationPopup.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/GistNotificationPopup.java
index 5cdf2366..e669de29 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/GistNotificationPopup.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/GistNotificationPopup.java
@@ -11,7 +11,6 @@
package org.eclipse.mylyn.internal.github.ui.gist;
import java.text.MessageFormat;
-import java.util.Set;
import org.eclipse.egit.github.core.Gist;
import org.eclipse.mylyn.internal.github.ui.GitHubImages;
@@ -40,17 +39,22 @@ public class GistNotificationPopup extends AbstractNotificationPopup {
private String title;
+ private TaskRepository repository;
+
/**
* Create Gist notification popup
- *
+ *
* @param display
* @param gist
* @param title
+ * @param repository
*/
- public GistNotificationPopup(Display display, Gist gist, String title) {
+ public GistNotificationPopup(Display display, Gist gist, String title,
+ TaskRepository repository) {
super(display);
this.gist = gist;
this.title = title;
+ this.repository = repository;
}
@Override
@@ -68,18 +72,13 @@ public class GistNotificationPopup extends AbstractNotificationPopup {
@Override
public void widgetSelected(SelectionEvent e) {
- Set<TaskRepository> repositories = GistConnectorUi
- .getRepositories();
- if (!repositories.isEmpty()) {
- TaskRepository repository = repositories.iterator().next();
- AbstractTask task = TasksUiInternal.getTask(
- repository.getRepositoryUrl(), gist.getId(),
- gist.getHtmlUrl());
- if (task != null)
- TasksUiInternal.refreshAndOpenTaskListElement(task);
- else
- TasksUiInternal.openTask(repository, gist.getId(), null);
- }
+ AbstractTask task = TasksUiInternal.getTask(
+ repository.getRepositoryUrl(), gist.getId(),
+ gist.getHtmlUrl());
+ if (task != null)
+ TasksUiInternal.refreshAndOpenTaskListElement(task);
+ else
+ TasksUiInternal.openTask(repository, gist.getId(), null);
}
});
}

Back to the top