Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Davis2015-08-19 16:09:22 -0400
committerSam Davis2015-08-19 18:00:35 -0400
commit5528c60382bc995bcf112133696b4bdaf215f991 (patch)
tree7bbd4aa85bb55315e1f36a486bf54b6277468dd1
parent82cd9c122c88a94ef4e7b699b510b40d2991ed11 (diff)
downloadorg.eclipse.mylyn.tasks-5528c60382bc995bcf112133696b4bdaf215f991.tar.gz
org.eclipse.mylyn.tasks-5528c60382bc995bcf112133696b4bdaf215f991.tar.xz
org.eclipse.mylyn.tasks-5528c60382bc995bcf112133696b4bdaf215f991.zip
475428: content assist proposals created from tasks in the task list
should insert the owner ID if it is set on the task Change-Id: Iaf008ac571ef226f0e38ea88958ecc5a521aefbf Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=475428
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/PersonProposalProviderTest.java30
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java11
2 files changed, 40 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/PersonProposalProviderTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/PersonProposalProviderTest.java
index 5e4a896d9..8496bc445 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/PersonProposalProviderTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/PersonProposalProviderTest.java
@@ -336,4 +336,34 @@ public class PersonProposalProviderTest extends TestCase {
assertEquals("21", result[0].getContent());
assertEquals("22", result[1].getContent());
}
+
+ public void testGetProposalByOwnerId() throws Exception {
+ TaskTask task = TaskTestUtil.createMockTask("1");
+ task.setOwner("Joel User");
+ TasksUiPlugin.getTaskList().addTask(task);
+ TaskRepository repository = TaskTestUtil.createMockRepository();
+ TasksUi.getRepositoryManager().addRepository(repository);
+
+ PersonProposalProvider provider = new PersonProposalProvider(MockRepositoryConnector.REPOSITORY_URL,
+ MockRepositoryConnector.CONNECTOR_KIND);
+ IContentProposal[] result = provider.getProposals("joel", 1);
+ assertEquals(1, result.length);
+ assertEquals("Joel User", result[0].getLabel());
+ assertEquals("Joel User", result[0].getContent());
+
+ task.setOwnerId("joel.user@mylyn.org");
+ provider = new PersonProposalProvider(MockRepositoryConnector.REPOSITORY_URL,
+ MockRepositoryConnector.CONNECTOR_KIND);
+ result = provider.getProposals("joel", 1);
+ assertEquals(1, result.length);
+ assertEquals("Joel User <joel.user@mylyn.org>", result[0].getLabel());
+ assertEquals("joel.user@mylyn.org", result[0].getContent());
+
+ task.setOwnerId("");
+ task.setOwner("");
+ provider = new PersonProposalProvider(MockRepositoryConnector.REPOSITORY_URL,
+ MockRepositoryConnector.CONNECTOR_KIND);
+ result = provider.getProposals("joel", 1);
+ assertEquals(0, result.length);
+ }
}
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 725759784..003095993 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
@@ -39,6 +39,8 @@ import org.eclipse.mylyn.tasks.core.data.TaskData;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.osgi.util.NLS;
+import com.google.common.base.Strings;
+
/**
* @author Shawn Minto
* @author Eugene Kuleshov
@@ -270,7 +272,14 @@ public class PersonProposalProvider implements IContentProposalProvider {
}
private void addAddresses(ITask task, Set<String> addressSet) {
- addAddress(addressSet, task.getOwner());
+ if (Strings.isNullOrEmpty(task.getOwnerId())) {
+ addAddress(addressSet, task.getOwner());
+ } else {
+ addAddress(addressSet, task.getOwnerId());
+ if (!Strings.isNullOrEmpty(task.getOwner())) {
+ proposals.put(task.getOwnerId(), task.getOwner());
+ }
+ }
}
private void addAddresses(TaskData data, Set<String> addressSet) {

Back to the top