summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Wu2011-08-12 06:49:13 (EDT)
committer Steffen Pingel2011-08-12 06:49:33 (EDT)
commit0d04617bca51fc4bbcc177418edb661d65a6b44a (patch)
treecf63dd490348ea899e91764d68dd58d4c77c3ba9
parent5992da64814ac2b25184f43d48533567a0f3b519 (diff)
downloadorg.eclipse.mylyn.tasks-0d04617bca51fc4bbcc177418edb661d65a6b44a.zip
org.eclipse.mylyn.tasks-0d04617bca51fc4bbcc177418edb661d65a6b44a.tar.gz
org.eclipse.mylyn.tasks-0d04617bca51fc4bbcc177418edb661d65a6b44a.tar.bz2
bug 349598: [patch] PersonProposalProvider should set currentUser when
populated by connectors https://bugs.eclipse.org/bugs/show_bug.cgi?id=349598
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java31
1 files changed, 23 insertions, 8 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java
index c3bbd53..74388c4 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java
@@ -46,6 +46,7 @@ import org.eclipse.osgi.util.NLS;
* @author David Shepherd
* @author Sam Davis
* @author Thomas Ehrnhoefer
+ * @author Mike Wu
*/
public class PersonProposalProvider implements IContentProposalProvider {
@@ -207,8 +208,15 @@ public class PersonProposalProvider implements IContentProposalProvider {
});
if (proposals.size() > 0) {
+ String user = null;
+ if (repositoryUrl != null && connectorKind != null) {
+ user = getCurrentUser(repositoryUrl, connectorKind);
+ }
for (String proposal : proposals.keySet()) {
addAddress(addressSet, proposal);
+ if (user != null && user.equals(proposal)) {
+ currentUser = user;
+ }
}
return addressSet;
}
@@ -227,14 +235,9 @@ public class PersonProposalProvider implements IContentProposalProvider {
tasks.add(currentTask);
}
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(connectorKind, repositoryUrl);
-
- if (repository != null) {
- AuthenticationCredentials credentials = repository.getCredentials(AuthenticationType.REPOSITORY);
- if (credentials != null && credentials.getUserName().length() > 0) {
- currentUser = credentials.getUserName();
- addressSet.add(currentUser);
- }
+ currentUser = getCurrentUser(repositoryUrl, connectorKind);
+ if (currentUser != null) {
+ addressSet.add(currentUser);
}
Collection<AbstractTask> allTasks = TasksUiPlugin.getTaskList().getAllTasks();
@@ -252,6 +255,18 @@ public class PersonProposalProvider implements IContentProposalProvider {
return addressSet;
}
+ private String getCurrentUser(String repositoryUrl, String connectorKind) {
+ TaskRepository repository = TasksUi.getRepositoryManager().getRepository(connectorKind, repositoryUrl);
+
+ if (repository != null) {
+ AuthenticationCredentials credentials = repository.getCredentials(AuthenticationType.REPOSITORY);
+ if (credentials != null && credentials.getUserName().length() > 0) {
+ return credentials.getUserName();
+ }
+ }
+ return null;
+ }
+
private void addAddresses(ITask task, Set<String> addressSet) {
addAddress(addressSet, task.getOwner());
}