Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2007-06-07 13:58:36 -0400
committerrelves2007-06-07 13:58:36 -0400
commit0f301b3a53988ccbaf4782fb3dce11143af4386a (patch)
treec5988792c17c4e139fec3c6ebfea69af4d31ebdc
parent00efdf6ed0ee49ba4bc3b0e64ee1ddd3282191d4 (diff)
downloadorg.eclipse.mylyn.tasks-0f301b3a53988ccbaf4782fb3dce11143af4386a.tar.gz
org.eclipse.mylyn.tasks-0f301b3a53988ccbaf4782fb3dce11143af4386a.tar.xz
org.eclipse.mylyn.tasks-0f301b3a53988ccbaf4782fb3dce11143af4386a.zip
ASSIGNED - bug 189066: [api] updateTaskFromTaskData() should not block
https://bugs.eclipse.org/bugs/show_bug.cgi?id=189066
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java14
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryQuery.java5
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaConfigurationTest.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java33
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaSearchEngineTest.java106
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskListManagerTest.java42
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskListNotificationManagerTest.java12
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskListStandaloneTest.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskReportGeneratorTest.java8
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/headless/BugzillaQueryTest.java3
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugzillaTaskEditor.java3
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryWizardPage.java4
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java2
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractQueryHit.java193
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java3
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryQuery.java53
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java52
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeActivityDelegate.java30
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeContainer.java17
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java66
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITask.java8
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListExternalizer.java15
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/QueryHitCollector.java2
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/Task.java54
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskArchive.java4
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskCategory.java4
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskList.java80
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/UncategorizedCategory.java4
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TableSorterTest.java6
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityTest.java7
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskDataImportTest.java2
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListContentProviderTest.java8
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java119
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListTest.java2
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListUiTest.java10
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryQuery.java9
-rw-r--r--org.eclipse.mylyn.tasks.ui/plugin.xml2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/MoveToCategoryMenuContributor.java7
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewCategoryAction.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskListElementAction.java11
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java48
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TableDecoratingLabelProvider.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskActivityLabelProvider.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskElementLabelProvider.java28
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java37
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListTableSorter.java19
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java11
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskTableLabelProvider.java3
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeQueryJob.java32
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeTaskJob.java34
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskFactory.java95
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskListManager.java14
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java113
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java29
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryQuery.java5
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/RepositorySearchQueryTest.java2
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracQueryTest.java2
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java7
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryQueryTest.java4
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracTaskExternalizer.java2
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/NewTracTaskEditor.java3
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracCustomQueryPage.java3
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryWizardPage.java4
67 files changed, 678 insertions, 841 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
index 2536a6147..8832a72bd 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
@@ -605,7 +605,8 @@ public class BugzillaClient {
}
}
- public void postAttachment(String bugReportID, String comment, ITaskAttachment attachment) throws HttpException, IOException, CoreException {
+ public void postAttachment(String bugReportID, String comment, ITaskAttachment attachment) throws HttpException,
+ IOException, CoreException {
WebClientUtil.setupHttpClient(httpClient, proxy, repositoryUrl.toString(), htAuthUser, htAuthPass);
if (!authenticated && hasAuthenticationCredentials()) {
authenticate();
@@ -622,14 +623,11 @@ public class BugzillaClient {
postMethod.getParams().setBooleanParameter(HttpMethodParams.USE_EXPECT_CONTINUE, true);
List<PartBase> parts = new ArrayList<PartBase>();
parts.add(new StringPart(IBugzillaConstants.POST_INPUT_ACTION, VALUE_ACTION_INSERT, characterEncoding));
- // if (username != null) {
- parts.add(new StringPart(IBugzillaConstants.POST_INPUT_BUGZILLA_LOGIN, username, characterEncoding));
- //}
- //if (password != null) {
- parts.add(new StringPart(IBugzillaConstants.POST_INPUT_BUGZILLA_PASSWORD, password, characterEncoding));
- // }
+ parts.add(new StringPart(IBugzillaConstants.POST_INPUT_BUGZILLA_LOGIN, username, characterEncoding));
+ parts.add(new StringPart(IBugzillaConstants.POST_INPUT_BUGZILLA_PASSWORD, password, characterEncoding));
parts.add(new StringPart(IBugzillaConstants.POST_INPUT_BUGID, bugReportID, characterEncoding));
- parts.add(new StringPart(IBugzillaConstants.POST_INPUT_DESCRIPTION, attachment.getDescription(), characterEncoding));
+ parts.add(new StringPart(IBugzillaConstants.POST_INPUT_DESCRIPTION, attachment.getDescription(),
+ characterEncoding));
parts.add(new StringPart(IBugzillaConstants.POST_INPUT_COMMENT, comment, characterEncoding));
parts.add(new FilePart(IBugzillaConstants.POST_INPUT_DATA, new AttachmentPartSource(attachment)));
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java
index 2541806ee..c76800c1d 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java
@@ -282,7 +282,7 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
}
});
- BugzillaRepositoryQuery query = new BugzillaRepositoryQuery(repository.getUrl(), urlQueryString, "", taskList);
+ BugzillaRepositoryQuery query = new BugzillaRepositoryQuery(repository.getUrl(), urlQueryString, "");
performQuery(query, repository, new NullProgressMonitor(), collector, false);
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryQuery.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryQuery.java
index c777ff5e9..3eca6fb2e 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryQuery.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryQuery.java
@@ -12,7 +12,6 @@
package org.eclipse.mylar.internal.bugzilla.core;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
-import org.eclipse.mylar.tasks.core.TaskList;
/**
* @author Shawn Minto
@@ -22,8 +21,8 @@ public class BugzillaRepositoryQuery extends AbstractRepositoryQuery {
private boolean customQuery = false;
- public BugzillaRepositoryQuery(String repositoryUrl, String queryUrl, String description, TaskList taskList) {
- super(description, taskList);
+ public BugzillaRepositoryQuery(String repositoryUrl, String queryUrl, String description) {
+ super(description);
this.url = queryUrl;
this.repositoryUrl = repositoryUrl;
// try {
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaConfigurationTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaConfigurationTest.java
index 8c6b7ea50..f2f46afae 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaConfigurationTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaConfigurationTest.java
@@ -130,7 +130,7 @@ public class BugzillaConfigurationTest extends TestCase {
assertEquals(7, config.getSeverities().size());
assertTrue(config.getProducts().size() > 50);
assertEquals(4, config.getOpenStatusValues().size());
- assertEquals(12, config.getComponents("Mylar").size());
+ assertEquals(13, config.getComponents("Mylar").size());
assertEquals(23, config.getKeywords().size());
// assertEquals(10, config.getComponents("Hyades").size());
// assertEquals(1, config.getTargetMilestones("TestProduct").size());
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java
index d62ea93b3..8e21b53b6 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java
@@ -56,7 +56,7 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
BugzillaRepositoryQuery bugQuery = new BugzillaRepositoryQuery(
IBugzillaConstants.TEST_BUGZILLA_222_URL,
"http://mylar.eclipse.org/bugs222/buglist.cgi?short_desc_type=allwordssubstr&short_desc=&product=Read+Only+Test+Cases&long_desc_type=allwordssubstr&long_desc=&bug_status=NEW&order=Importance",
- "testFocedQuerySynchronization", taskList);
+ "testFocedQuerySynchronization");
taskList.addQuery(bugQuery);
@@ -111,13 +111,11 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
// null, collector, "-1");
//
String queryUrl = "http://mylar.eclipse.org/bugs218/buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=search-match-test&product=TestProduct&long_desc_type=substring&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&deadlinefrom=&deadlineto=&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailassigned_to1=1&emailtype1=substring&email1=&emailassigned_to2=1&emailreporter2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&cmdtype=doit&order=Reuse+same+sort+as+last+time&field0-0-0=noop&type0-0-0=noop&value0-0-0=";
- BugzillaRepositoryQuery bugzillaQuery = new BugzillaRepositoryQuery(repository.getUrl(), queryUrl, "search",
- taskList);
+ BugzillaRepositoryQuery bugzillaQuery = new BugzillaRepositoryQuery(repository.getUrl(), queryUrl, "search");
SearchHitCollector collector = new SearchHitCollector(taskList, repository, bugzillaQuery, taskFactory);
- RepositorySearchResult result = (RepositorySearchResult)collector.getSearchResult();
-
-
+ RepositorySearchResult result = (RepositorySearchResult) collector.getSearchResult();
+
// operation.run(new NullProgressMonitor());
// BugzillaSearchQuery searchQuery = new BugzillaSearchQuery(collector);
collector.run(new NullProgressMonitor());
@@ -242,16 +240,17 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
public void testUniqueQueryHitObjects() {
init222();
BugzillaRepositoryQuery query1 = new BugzillaRepositoryQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL,
- "queryurl", "description1", taskList);
+ "queryurl", "description1");
BugzillaTask query1Hit = new BugzillaTask(IBugzillaConstants.TEST_BUGZILLA_222_URL, "1", "description1");
- query1.addHit(query1Hit);
taskList.addQuery(query1);
-
+ taskList.addTask(query1Hit, query1);
+
BugzillaRepositoryQuery query2 = new BugzillaRepositoryQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL,
- "queryurl2", "description2", taskList);
+ "queryurl2", "description2");
BugzillaTask query2Hit = new BugzillaTask(IBugzillaConstants.TEST_BUGZILLA_222_URL, "1", "description2");
- query2.addHit(query2Hit);
taskList.addQuery(query2);
+ taskList.addTask(query2Hit, query1);
+
assertEquals(2, taskList.getQueries().size());
assertEquals(1, taskList.getAllTasks().size());
for (AbstractRepositoryTask hit : query1.getHits()) {
@@ -290,10 +289,11 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
attachment.setPatch(false);
attachment.setReport(taskData);
attachment.setComment("Automated JUnit attachment test"); // optional
-
+
/* Test attempt to upload a non-existent file */
attachment.setFilePath("/this/is/not/a/real-file");
attachment.setFile(new File(attachment.getFilePath()));
+ attachment.setFilename("real-file");
// IAttachmentHandler attachmentHandler =
// connector.getAttachmentHandler();
BugzillaClient client = connector.getClientManager().getClient(repository);
@@ -317,7 +317,9 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
File attachFile = new File(fileName);
attachment.setFilePath(attachFile.getAbsolutePath());
BufferedWriter write = new BufferedWriter(new FileWriter(attachFile));
- attachment.setFile(new File(attachment.getFilePath()));
+ attachFile = new File(attachment.getFilePath());
+ attachment.setFile(attachFile);
+ attachment.setFilename(attachFile.getName());
// assertFalse(attachmentHandler.uploadAttachment(attachment,
// repository.getUserName(), repository.getPassword(),
// Proxy.NO_PROXY));
@@ -338,7 +340,10 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
// assertTrue(attachmentHandler.uploadAttachment(attachment,
// repository.getUserName(), repository.getPassword(),
// Proxy.NO_PROXY));
- attachment.setFile(new File(attachment.getFilePath()));
+ File fileToAttach = new File(attachment.getFilePath());
+ assertTrue(fileToAttach.exists());
+ attachment.setFile(fileToAttach);
+ attachment.setFilename(fileToAttach.getName());
client.postAttachment(attachment.getReport().getId(), attachment.getComment(), attachment);
task = (BugzillaTask) connector.createTaskFromExistingId(repository, taskNumber, new NullProgressMonitor());
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaSearchEngineTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaSearchEngineTest.java
index d9966f3c3..287e61ec3 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaSearchEngineTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaSearchEngineTest.java
@@ -33,16 +33,21 @@ import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
public class BugzillaSearchEngineTest extends TestCase {
private static final String QUERY_NAME = "Query Page Name";
- private static final String BUG_DESC_SUBSTRING_SEARCH = "/buglist.cgi?short_desc_type=allwordssubstr&short_desc=";//search-match-test&amp";
+
+ private static final String BUG_DESC_SUBSTRING_SEARCH = "/buglist.cgi?short_desc_type=allwordssubstr&short_desc=";// search-match-test&amp";
+
private static final String SEARCH_DESCRIPTION = "search-match-test";
+
private static final int NUM_EXPECTED_HITS = 2;
+
private static final int NUM_REPOSITORIES = 0;
@Override
protected void setUp() throws Exception {
super.setUp();
TasksUiPlugin.getRepositoryManager().clearRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
- assertEquals(NUM_REPOSITORIES, TasksUiPlugin.getRepositoryManager().getRepositories(BugzillaCorePlugin.REPOSITORY_KIND).size());
+ assertEquals(NUM_REPOSITORIES, TasksUiPlugin.getRepositoryManager().getRepositories(
+ BugzillaCorePlugin.REPOSITORY_KIND).size());
}
@Override
@@ -51,63 +56,74 @@ public class BugzillaSearchEngineTest extends TestCase {
super.tearDown();
}
-// public void testSearching216() throws Exception {
-// TaskRepository repository = new TaskRepository(BugzillaPlugin.REPOSITORY_KIND,
-// IBugzillaConstants.TEST_BUGZILLA_216_URL, IBugzillaConstants.BugzillaServerVersion.SERVER_216.toString());
-// MylarTaskListPlugin.getRepositoryManager().addRepository(repository);
-// List<AbstractQueryHit> hits = runQuery(IBugzillaConstants.TEST_BUGZILLA_216_URL, SEARCH_DESCRIPTION);
-// assertEquals(NUM_EXPECTED_HITS, hits.size());
-// }
-
+// public void testSearching216() throws Exception {
+// TaskRepository repository = new
+// TaskRepository(BugzillaPlugin.REPOSITORY_KIND,
+// IBugzillaConstants.TEST_BUGZILLA_216_URL,
+// IBugzillaConstants.BugzillaServerVersion.SERVER_216.toString());
+// MylarTaskListPlugin.getRepositoryManager().addRepository(repository);
+// List<AbstractQueryHit> hits =
+// runQuery(IBugzillaConstants.TEST_BUGZILLA_216_URL, SEARCH_DESCRIPTION);
+// assertEquals(NUM_EXPECTED_HITS, hits.size());
+// }
+
public void testSearching218() throws Exception {
TaskRepository repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND,
- IBugzillaConstants.TEST_BUGZILLA_218_URL, IBugzillaConstants.BugzillaServerVersion.SERVER_218.toString());
- TasksUiPlugin.getRepositoryManager().addRepository(repository, TasksUiPlugin.getDefault().getRepositoriesFilePath());
- assertEquals(NUM_EXPECTED_HITS, runQuery(IBugzillaConstants.TEST_BUGZILLA_218_URL, SEARCH_DESCRIPTION).size());
+ IBugzillaConstants.TEST_BUGZILLA_218_URL, IBugzillaConstants.BugzillaServerVersion.SERVER_218
+ .toString());
+ TasksUiPlugin.getRepositoryManager().addRepository(repository,
+ TasksUiPlugin.getDefault().getRepositoriesFilePath());
+ assertEquals(NUM_EXPECTED_HITS, runQuery(IBugzillaConstants.TEST_BUGZILLA_218_URL, SEARCH_DESCRIPTION).size());
}
-
+
public void testSearching220() throws Exception {
TaskRepository repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND,
- IBugzillaConstants.TEST_BUGZILLA_220_URL, IBugzillaConstants.BugzillaServerVersion.SERVER_220.toString());
- TasksUiPlugin.getRepositoryManager().addRepository(repository, TasksUiPlugin.getDefault().getRepositoriesFilePath());
- assertEquals(NUM_EXPECTED_HITS, runQuery(IBugzillaConstants.TEST_BUGZILLA_220_URL, SEARCH_DESCRIPTION).size());
+ IBugzillaConstants.TEST_BUGZILLA_220_URL, IBugzillaConstants.BugzillaServerVersion.SERVER_220
+ .toString());
+ TasksUiPlugin.getRepositoryManager().addRepository(repository,
+ TasksUiPlugin.getDefault().getRepositoriesFilePath());
+ assertEquals(NUM_EXPECTED_HITS, runQuery(IBugzillaConstants.TEST_BUGZILLA_220_URL, SEARCH_DESCRIPTION).size());
}
-
+
public void testSearching2201() throws Exception {
TaskRepository repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND,
- IBugzillaConstants.TEST_BUGZILLA_2201_URL, IBugzillaConstants.BugzillaServerVersion.SERVER_220.toString());
- TasksUiPlugin.getRepositoryManager().addRepository(repository, TasksUiPlugin.getDefault().getRepositoriesFilePath());
- assertEquals(NUM_EXPECTED_HITS, runQuery(IBugzillaConstants.TEST_BUGZILLA_2201_URL, SEARCH_DESCRIPTION).size());
+ IBugzillaConstants.TEST_BUGZILLA_2201_URL, IBugzillaConstants.BugzillaServerVersion.SERVER_220
+ .toString());
+ TasksUiPlugin.getRepositoryManager().addRepository(repository,
+ TasksUiPlugin.getDefault().getRepositoriesFilePath());
+ assertEquals(NUM_EXPECTED_HITS, runQuery(IBugzillaConstants.TEST_BUGZILLA_2201_URL, SEARCH_DESCRIPTION).size());
}
-
+
public void testSearching222() throws Exception {
- TaskRepository repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND,
- IBugzillaConstants.TEST_BUGZILLA_222_URL, IBugzillaConstants.BugzillaServerVersion.SERVER_222.toString());
- TasksUiPlugin.getRepositoryManager().addRepository(repository, TasksUiPlugin.getDefault().getRepositoriesFilePath());
+ TaskRepository repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND,
+ IBugzillaConstants.TEST_BUGZILLA_222_URL, IBugzillaConstants.BugzillaServerVersion.SERVER_222
+ .toString());
+ TasksUiPlugin.getRepositoryManager().addRepository(repository,
+ TasksUiPlugin.getDefault().getRepositoriesFilePath());
Set<AbstractRepositoryTask> hits = runQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL, SEARCH_DESCRIPTION);
- assertEquals(NUM_EXPECTED_HITS, hits.size());
+ assertEquals(NUM_EXPECTED_HITS, hits.size());
}
-
- private Set<AbstractRepositoryTask> runQuery(String repositoryURL, String SearchString) throws Exception {
- TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository(BugzillaCorePlugin.REPOSITORY_KIND, repositoryURL);
- assertNotNull(repository);
-
- final BugzillaRepositoryQuery repositoryQuery = new BugzillaRepositoryQuery(
- repository.getUrl(),
- repository.getUrl() + BUG_DESC_SUBSTRING_SEARCH+SearchString,
- QUERY_NAME,
- TasksUiPlugin.getTaskListManager().getTaskList());
-
- AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(BugzillaCorePlugin.REPOSITORY_KIND);
+
+ private Set<AbstractRepositoryTask> runQuery(String repositoryURL, String SearchString) throws Exception {
+ TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository(
+ BugzillaCorePlugin.REPOSITORY_KIND, repositoryURL);
+ assertNotNull(repository);
+
+ final BugzillaRepositoryQuery repositoryQuery = new BugzillaRepositoryQuery(repository.getUrl(), repository
+ .getUrl()
+ + BUG_DESC_SUBSTRING_SEARCH + SearchString, QUERY_NAME);
+
+ AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
+ BugzillaCorePlugin.REPOSITORY_KIND);
TaskList taskList = TasksUiPlugin.getTaskListManager().getTaskList();
QueryHitCollector collector = new QueryHitCollector(taskList, new TaskFactory(repository));
-
+
connector.performQuery(repositoryQuery, repository, new NullProgressMonitor(), collector, false);
-
- //results.addAll(connector.performQuery(repositoryQuery, new NullProgressMonitor(), new MultiStatus(TasksUiPlugin.PLUGIN_ID, IStatus.OK, "Query result", null)));
- return collector.getTaskHits();
+
+ // results.addAll(connector.performQuery(repositoryQuery, new
+ // NullProgressMonitor(), new MultiStatus(TasksUiPlugin.PLUGIN_ID,
+ // IStatus.OK, "Query result", null)));
+ return collector.getTaskHits();
}
-
-
-
+
}
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskListManagerTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskListManagerTest.java
index bb0fcc6d2..611c9830d 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskListManagerTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskListManagerTest.java
@@ -40,16 +40,17 @@ public class BugzillaTaskListManagerTest extends TestCase {
private TaskListManager manager;
private TaskRepository repository;
-
+
@Override
protected void setUp() throws Exception {
super.setUp();
- manager = TasksUiPlugin.getTaskListManager();
+ manager = TasksUiPlugin.getTaskListManager();
manager.readExistingOrCreateNewList();
manager.resetTaskList();
manager.saveTaskList();
repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.ECLIPSE_BUGZILLA_URL);
- TasksUiPlugin.getRepositoryManager().addRepository(repository, TasksUiPlugin.getDefault().getRepositoriesFilePath());
+ TasksUiPlugin.getRepositoryManager().addRepository(repository,
+ TasksUiPlugin.getDefault().getRepositoriesFilePath());
assertEquals(0, manager.getTaskList().getAllTasks().size());
}
@@ -57,11 +58,12 @@ public class BugzillaTaskListManagerTest extends TestCase {
protected void tearDown() throws Exception {
super.tearDown();
manager.resetTaskList();
- TasksUiPlugin.getTaskListManager().saveTaskList();
-// TasksUiPlugin.getDefault().getTaskListSaveManager().saveTaskList(true);
- TasksUiPlugin.getRepositoryManager().removeRepository(repository, TasksUiPlugin.getDefault().getRepositoriesFilePath());
+ TasksUiPlugin.getTaskListManager().saveTaskList();
+// TasksUiPlugin.getDefault().getTaskListSaveManager().saveTaskList(true);
+ TasksUiPlugin.getRepositoryManager().removeRepository(repository,
+ TasksUiPlugin.getDefault().getRepositoriesFilePath());
}
-
+
// TODO: move
public void testRemindedPersistance() {
@@ -87,7 +89,7 @@ public class BugzillaTaskListManagerTest extends TestCase {
assertTrue(task.hasBeenReminded());
}
}
-
+
public void testRepositoryTaskExternalization() {
BugzillaTask repositoryTask = new BugzillaTask("repo", "1", "label");
repositoryTask.setKind("kind");
@@ -107,10 +109,9 @@ public class BugzillaTaskListManagerTest extends TestCase {
assertEquals(repositoryTask.getSummary(), readTask.getSummary());
assertEquals(repositoryTask.getTaskKind(), readTask.getTaskKind());
}
-
+
public void testQueryExternalization() {
- AbstractRepositoryQuery query = new BugzillaRepositoryQuery("repositoryUrl", "queryUrl", "label", manager
- .getTaskList());
+ AbstractRepositoryQuery query = new BugzillaRepositoryQuery("repositoryUrl", "queryUrl", "label");
// long time = 1234;
// Date oldDate = new Date(time);
// query.setLastRefresh(oldDate);
@@ -133,10 +134,9 @@ public class BugzillaTaskListManagerTest extends TestCase {
assertEquals("repositoryUrl", readQuery.getRepositoryUrl());
// assertEquals(time, readQuery.getLastSynchronized().getTime());
}
-
+
public void testBugzillaCustomQueryExternalization() {
- BugzillaRepositoryQuery query = new BugzillaRepositoryQuery("repositoryUrl", "queryUrl", "label", manager
- .getTaskList());
+ BugzillaRepositoryQuery query = new BugzillaRepositoryQuery("repositoryUrl", "queryUrl", "label");
query.setCustomQuery(true);
manager.getTaskList().addQuery(query);
manager.saveTaskList();
@@ -151,7 +151,7 @@ public class BugzillaTaskListManagerTest extends TestCase {
.next();
assertTrue(readQuery.isCustomQuery());
}
-
+
public void testLegacyTaskListReading() throws IOException {
File originalFile = manager.getTaskListFile();
File legacyListFile = new File("temptasklist.xml");
@@ -200,8 +200,7 @@ public class BugzillaTaskListManagerTest extends TestCase {
}
public void testDeleteQuery() {
- AbstractRepositoryQuery query = new BugzillaRepositoryQuery("repositoryUrl", "queryUrl", "label", manager
- .getTaskList());
+ AbstractRepositoryQuery query = new BugzillaRepositoryQuery("repositoryUrl", "queryUrl", "label");
manager.getTaskList().addQuery(query);
AbstractRepositoryQuery readQuery = manager.getTaskList().getQueries().iterator().next();
@@ -212,8 +211,7 @@ public class BugzillaTaskListManagerTest extends TestCase {
}
public void testDeleteQueryAfterRename() {
- AbstractRepositoryQuery query = new BugzillaRepositoryQuery("repositoryUrl", "queryUrl", "label", manager
- .getTaskList());
+ AbstractRepositoryQuery query = new BugzillaRepositoryQuery("repositoryUrl", "queryUrl", "label");
manager.getTaskList().addQuery(query);
AbstractRepositoryQuery readQuery = manager.getTaskList().getQueries().iterator().next();
@@ -224,15 +222,13 @@ public class BugzillaTaskListManagerTest extends TestCase {
}
public void testCreateQueryWithSameName() {
- AbstractRepositoryQuery query = new BugzillaRepositoryQuery("repositoryUrl", "queryUrl", "label", manager
- .getTaskList());
+ AbstractRepositoryQuery query = new BugzillaRepositoryQuery("repositoryUrl", "queryUrl", "label");
manager.getTaskList().addQuery(query);
assertEquals(1, manager.getTaskList().getQueries().size());
AbstractRepositoryQuery readQuery = manager.getTaskList().getQueries().iterator().next();
assertEquals(query, readQuery);
- manager.getTaskList().addQuery(
- new BugzillaRepositoryQuery("repositoryUrl", "queryUrl", "label", manager.getTaskList()));
+ manager.getTaskList().addQuery(new BugzillaRepositoryQuery("repositoryUrl", "queryUrl", "label"));
assertEquals(1, manager.getTaskList().getQueries().size());
}
}
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskListNotificationManagerTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskListNotificationManagerTest.java
index 481af7b69..436d47b60 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskListNotificationManagerTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskListNotificationManagerTest.java
@@ -79,9 +79,8 @@ public class TaskListNotificationManagerTest extends TestCase {
TasksUiPlugin.getRepositoryManager().addRepository(repository,
TasksUiPlugin.getDefault().getRepositoriesFilePath());
AbstractRepositoryTask task = new BugzillaTask("https://bugs.eclipse.org/bugs", "142891", "label");
- assertTrue(task.getSyncState() == RepositoryTaskSyncState.INCOMING);
+ assertEquals( RepositoryTaskSyncState.SYNCHRONIZED, task.getSyncState());
assertFalse(task.isNotified());
- task.setNotified(false);
TasksUiPlugin.getTaskListManager().getTaskList().addTask(task);
TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault().getTaskListNotificationManager();
notificationManager.collectNotifications();
@@ -96,9 +95,10 @@ public class TaskListNotificationManagerTest extends TestCase {
BugzillaTask hit = new BugzillaTask("https://bugs.eclipse.org/bugs", "1", "summary");
assertFalse(hit.isNotified());
BugzillaRepositoryQuery query = new BugzillaRepositoryQuery("https://bugs.eclipse.org/bugs", "queryUrl",
- "summary", TasksUiPlugin.getTaskListManager().getTaskList());
- query.addHit(hit);
+ "summary");
TasksUiPlugin.getTaskListManager().getTaskList().addQuery(query);
+ TasksUiPlugin.getTaskListManager().getTaskList().addTask(hit, query);
+
TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault().getTaskListNotificationManager();
assertFalse(hit.isNotified());
notificationManager.collectNotifications();
@@ -115,9 +115,9 @@ public class TaskListNotificationManagerTest extends TestCase {
String hitHandle = hit.getHandleIdentifier();
assertFalse(hit.isNotified());
BugzillaRepositoryQuery query = new BugzillaRepositoryQuery("https://bugs.eclipse.org/bugs", "queryUrl",
- "summary", TasksUiPlugin.getTaskListManager().getTaskList());
- query.addHit(hit);
+ "summary");
TasksUiPlugin.getTaskListManager().getTaskList().addQuery(query);
+ TasksUiPlugin.getTaskListManager().getTaskList().addTask(hit, query);
TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault().getTaskListNotificationManager();
notificationManager.collectNotifications();
for (ITaskListNotification notification : notificationManager.getNotifications()) {
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskListStandaloneTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskListStandaloneTest.java
index 77b361361..953c744d4 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskListStandaloneTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskListStandaloneTest.java
@@ -173,7 +173,7 @@ public class TaskListStandaloneTest extends TestCase {
externalizers.add(new BugzillaTaskExternalizer());
// make a query
BugzillaRepositoryQuery query = new BugzillaRepositoryQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL,
- "http://queryurl", "summary", TasksUiPlugin.getTaskListManager().getTaskList());
+ "http://queryurl", "summary");
manager.getTaskList().addQuery(query);
manager.saveTaskList();
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskReportGeneratorTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskReportGeneratorTest.java
index 48f67387c..9518853d4 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskReportGeneratorTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskReportGeneratorTest.java
@@ -112,7 +112,7 @@ public class TaskReportGeneratorTest extends TestCase {
Task task1 = new Task(TasksUiPlugin.getTaskListManager().genUniqueTaskHandle(), "task 1");
manager.getTaskList().moveToRoot(task1);
task1.setCompleted(true);
- TaskCategory cat1 = new TaskCategory("TaskReportGeneratorTest Category", manager.getTaskList());
+ TaskCategory cat1 = new TaskCategory("TaskReportGeneratorTest Category");
manager.getTaskList().addCategory(cat1);
Set<ITaskListElement> catagories = new HashSet<ITaskListElement>();
@@ -135,7 +135,7 @@ public class TaskReportGeneratorTest extends TestCase {
BugzillaTask task1 = new BugzillaTask("repo", "1", "task 1");
manager.getTaskList().moveToRoot(task1);
task1.setCompleted(true);
- TaskCategory cat1 = new TaskCategory("TaskReportGeneratorTest Category", manager.getTaskList());
+ TaskCategory cat1 = new TaskCategory("TaskReportGeneratorTest Category");
manager.getTaskList().addCategory(cat1);
Set<ITaskListElement> catagories = new HashSet<ITaskListElement>();
@@ -160,7 +160,7 @@ public class TaskReportGeneratorTest extends TestCase {
task1.setCompleted(false);
BugzillaRepositoryQuery bugQuery = new BugzillaRepositoryQuery("repositoryUrl", "queryUrl",
- "TaskReportGeneratorBugzillaQueryCategory", manager.getTaskList());
+ "TaskReportGeneratorBugzillaQueryCategory");
manager.getTaskList().addQuery(bugQuery);
@@ -173,7 +173,7 @@ public class TaskReportGeneratorTest extends TestCase {
generator.run(new NullProgressMonitor());
assertEquals(0, generator.getAllCollectedTasks().size());
- bugQuery.addHit(task1);
+ manager.getTaskList().addTask(task1, bugQuery);
generator.run(new NullProgressMonitor());
assertEquals(0, generator.getAllCollectedTasks().size());
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/headless/BugzillaQueryTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/headless/BugzillaQueryTest.java
index 5f43da257..a8c31eaa8 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/headless/BugzillaQueryTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/headless/BugzillaQueryTest.java
@@ -135,8 +135,7 @@ public class BugzillaQueryTest extends TestCase {
QueryHitCollector collector = new QueryHitCollector(taskList, new TaskFactory(repository));
BugzillaRepositoryConnector connector = new BugzillaRepositoryConnector();
connector.init(taskList);
- BugzillaRepositoryQuery query = new BugzillaRepositoryQuery(repository.getUrl(), queryUrlString, "summary",
- taskList);
+ BugzillaRepositoryQuery query = new BugzillaRepositoryQuery(repository.getUrl(), queryUrlString, "summary");
connector.performQuery(query, repository, new NullProgressMonitor(), collector, false);
assertEquals(2, collector.getTaskHits().size());
for (ITask hit : collector.getTaskHits()) {
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugzillaTaskEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugzillaTaskEditor.java
index f9bb142da..59ac5c2b8 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugzillaTaskEditor.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugzillaTaskEditor.java
@@ -114,8 +114,7 @@ public class NewBugzillaTaskEditor extends AbstractNewRepositoryTaskEditor {
queryUrl += "&product=" + taskData.getProduct();
- BugzillaRepositoryQuery bugzillaQuery = new BugzillaRepositoryQuery(repository.getUrl(), queryUrl, "search",
- TasksUiPlugin.getTaskListManager().getTaskList());
+ BugzillaRepositoryQuery bugzillaQuery = new BugzillaRepositoryQuery(repository.getUrl(), queryUrl, "search");
SearchHitCollector collector = new SearchHitCollector(TasksUiPlugin.getTaskListManager().getTaskList(),
repository, bugzillaQuery, new TaskFactory(repository));
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java
index 635e9b6ab..551c34235 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java
@@ -1484,7 +1484,7 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L
if (originalQuery == null) {
try {
originalQuery = new BugzillaRepositoryQuery(repository.getUrl(), getQueryURL(repository,
- getQueryParameters()), getQueryTitle(), TasksUiPlugin.getTaskListManager().getTaskList());
+ getQueryParameters()), getQueryTitle());
} catch (UnsupportedEncodingException e) {
return null;
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryWizardPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryWizardPage.java
index 724a03ffa..828fe47b1 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryWizardPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryWizardPage.java
@@ -14,7 +14,6 @@ package org.eclipse.mylar.internal.bugzilla.ui.tasklist;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryQuery;
import org.eclipse.mylar.internal.tasks.ui.TasksUiImages;
import org.eclipse.mylar.tasks.core.TaskRepository;
-import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
import org.eclipse.mylar.tasks.ui.search.AbstractRepositoryQueryPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyEvent;
@@ -123,8 +122,7 @@ public class BugzillaCustomQueryWizardPage extends AbstractRepositoryQueryPage {
@Override
public BugzillaRepositoryQuery getQuery() {
if (query == null) {
- query = new BugzillaRepositoryQuery(repository.getUrl(), queryText.getText(), this.getQueryTitle(),
- TasksUiPlugin.getTaskListManager().getTaskList());
+ query = new BugzillaRepositoryQuery(repository.getUrl(), queryText.getText(), this.getQueryTitle());
query.setCustomQuery(true);
} else {
query.setDescription(this.getQueryTitle());
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java
index 1ef0fecc4..a69efb258 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java
@@ -61,7 +61,7 @@ public class BugzillaTaskExternalizer extends DelegatingTaskExternalizer {
public AbstractRepositoryQuery readQuery(Node node, TaskList taskList) throws TaskExternalizationException {
Element element = (Element) node;
BugzillaRepositoryQuery query = new BugzillaRepositoryQuery(element.getAttribute(KEY_REPOSITORY_URL), element
- .getAttribute(KEY_QUERY_STRING), element.getAttribute(KEY_NAME), taskList);
+ .getAttribute(KEY_QUERY_STRING), element.getAttribute(KEY_NAME));
if (node.getNodeName().equals(TAG_BUGZILLA_CUSTOM_QUERY)) {
query.setCustomQuery(true);
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractQueryHit.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractQueryHit.java
deleted file mode 100644
index 74940e0a4..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractQueryHit.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2006 University Of British Columbia and others.
- * 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:
- * University Of British Columbia - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylar.tasks.core;
-
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.mylar.internal.tasks.core.RepositoryTaskHandleUtil;
-import org.eclipse.mylar.tasks.core.Task.PriorityLevel;
-
-/**
- * @author Mik Kersten
- */
-/*public*/ abstract class AbstractQueryHit extends PlatformObject implements ITaskListElement {
-
- protected TaskList taskList;
-
- protected AbstractRepositoryTask task;
-
- protected String repositoryUrl;
-
- protected String summary;
-
- protected String priority = PriorityLevel.getDefault().toString();
-
- protected String taskId;
-
- private boolean completed = false;
-
- private boolean isNotified = false;
-
- private AbstractRepositoryQuery parent;
-
- protected AbstractQueryHit(TaskList taskList, String repositoryUrl, String description, String taskId) {
- this.taskList = taskList;
- this.repositoryUrl = repositoryUrl;
- this.summary = description;
- this.taskId = taskId;
- }
-
- public AbstractRepositoryQuery getParent() {
- return parent;
- }
-
- public void setParent(AbstractRepositoryQuery parent) {
- this.parent = parent;
- }
-
- public String getRepositoryUrl() {
- return repositoryUrl;
- }
-
- public void setRepositoryUrl(String repositoryUrl) {
- this.repositoryUrl = repositoryUrl;
- }
-
- public String getSummary() {
- if (task != null) {
- return task.getSummary();
- } else {
- return summary;
- }
- }
-
- public AbstractRepositoryTask getOrCreateCorrespondingTask() {
- if (taskList == null) {
- return null;
- }
-
- ITask existingTask = taskList.getTask(getHandleIdentifier());
- if (existingTask instanceof AbstractRepositoryTask) {
- this.task = (AbstractRepositoryTask) existingTask;
- } else {
- task = createTask();
- task.setCompleted(completed);
- taskList.addTask(task);
- }
- return task;
- }
-
- //@Deprecated
- protected abstract AbstractRepositoryTask createTask();
-
- /**
- * @return null if there is no corresponding task
- */
- public AbstractRepositoryTask getCorrespondingTask() {
- return task;
- }
-
- public void setCorrespondingTask(AbstractRepositoryTask task) {
- this.task = task;
- }
-
- public boolean isCompleted() {
- if (task != null) {
- return task.isCompleted();
- } else {
- return completed;
- }
- }
-
- public void setCompleted(boolean completed) {
- this.completed = completed;
- }
-
- public final String getHandleIdentifier() {
- if (task != null) {
- return task.getHandleIdentifier();
- }
- return RepositoryTaskHandleUtil.getHandle(repositoryUrl, taskId);
- }
-
- /**
- * @return Unique identifier for this task on the corresponding server, must
- * be robust to changing attributes on the task.
- */
- public String getTaskId() {
- return taskId;
- }
-
- /**
- * @return An ID that can be presented to the user for identifying the task,
- * override to return null if no such ID exists.
- */
- public String getIdentifyingLabel() {
- return getTaskId();
- }
-
- public boolean isNotified() {
- return isNotified;
- }
-
- public void setNotified(boolean notified) {
- isNotified = notified;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof AbstractQueryHit)) {
- return false;
- }
- AbstractQueryHit hit = (AbstractQueryHit) obj;
- return hit.getHandleIdentifier().equals(this.getHandleIdentifier());
- }
-
- @Override
- public int hashCode() {
- return this.getHandleIdentifier().hashCode();
- }
-
- /**
- * @return the url of the hit without any additional login information etc.
- */
- public String getUrl() {
- return "";
- }
-
- public String getPriority() {
- if (task != null) {
- return task.getPriority();
- } else {
- return priority;
- }
- }
-
- public void setPriority(String priority) {
- this.priority = priority;
- }
-
- public void setSummary(String description) {
- this.summary = description;
- }
-
- public void setHandleIdentifier(String id) {
- // ignore
- }
-
- public int compareTo(ITaskListElement taskListElement) {
- return this.taskId.compareTo(((AbstractQueryHit) taskListElement).taskId);
- }
-
- @Deprecated
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
index 7b129b019..214c8d548 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
@@ -141,7 +141,7 @@ public abstract class AbstractRepositoryConnector {
AbstractRepositoryTask subTask = createTaskFromExistingId(repository, subId, false,
new SubProgressMonitor(monitor, 1));
if (subTask != null) {
- repositoryTask.addSubTask(subTask);
+ taskList.addTask(subTask, repositoryTask);
}
}
}
@@ -431,4 +431,5 @@ public abstract class AbstractRepositoryConnector {
public void setTaskDataManager(TaskDataManager taskDataManager) {
this.taskDataManager = taskDataManager;
}
+
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryQuery.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryQuery.java
index 427f2e2d1..dc459ab77 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryQuery.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryQuery.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.mylar.tasks.core;
-import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -33,21 +32,8 @@ public abstract class AbstractRepositoryQuery extends AbstractTaskContainer {
public abstract String getRepositoryKind();
- /**
- * Query must be added to tasklist or synchronization will result in empty
- * result set due to removeOrphanedHits(). All hits that don't have a query
- * in the tasklist are removed.
- */
- public AbstractRepositoryQuery(String description, TaskList taskList) {
- super(description, taskList);
- }
-
- public boolean isArchive() {
- return false;
- }
-
- public void setIsArchive(boolean isArchive) {
- // ignore
+ public AbstractRepositoryQuery(String description) {
+ super(description);
}
public synchronized Set<AbstractRepositoryTask> getHits() {
@@ -60,24 +46,20 @@ public abstract class AbstractRepositoryQuery extends AbstractTaskContainer {
return repositoryTasks;
}
- public synchronized void updateHits(Collection<AbstractRepositoryTask> newHits) {
- clear();
- for (AbstractRepositoryTask abstractRepositoryTask : newHits) {
- addHit(abstractRepositoryTask);
- }
- }
-
- public synchronized void addHit(AbstractRepositoryTask hit) {
- // TODO: Move up?
- if(!taskList.getAllTasks().contains(hit)) {
- taskList.addTask(hit);
- }
- super.add(hit);
- }
+// public synchronized void updateHits(Collection<AbstractRepositoryTask> newHits) {
+// clear();
+// for (AbstractRepositoryTask abstractRepositoryTask : newHits) {
+// addHit(abstractRepositoryTask);
+// }
+// }
- public synchronized void removeHit(AbstractRepositoryTask hit) {
- super.remove(hit);
- }
+// public synchronized void addHit(AbstractRepositoryTask hit) {
+// super.add(hit);
+// }
+//
+// public synchronized void removeHit(AbstractRepositoryTask hit) {
+// super.remove(hit);
+// }
public synchronized String getPriority() {
if (super.isEmpty()) {
@@ -97,11 +79,6 @@ public abstract class AbstractRepositoryQuery extends AbstractTaskContainer {
return false;
}
- @Override
- public boolean isCompleted() {
- return false;
- }
-
public String getRepositoryUrl() {
return repositoryUrl;
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java
index f2fdd7796..e5556975b 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.mylar.tasks.core;
-import java.util.HashSet;
+import java.util.Collections;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
@@ -25,9 +25,7 @@ public abstract class AbstractTaskContainer extends PlatformObject implements IT
private String handle = "";
- private Set<String> childHandles = new CopyOnWriteArraySet<String>();
-
- protected TaskList taskList;
+ private Set<ITask> children = new CopyOnWriteArraySet<ITask>();
/**
* Optional URL corresponding to the web resource associated with this
@@ -35,39 +33,36 @@ public abstract class AbstractTaskContainer extends PlatformObject implements IT
*/
protected String url = null;
- public AbstractTaskContainer(String handleAndDescription, TaskList taskList) {
+ public AbstractTaskContainer(String handleAndDescription) {
assert handle != null;
this.handle = handleAndDescription;
- this.taskList = taskList;
}
+ // XXX: Get rid of this
public abstract boolean isLocal();
public Set<ITask> getChildren() {
- Set<ITask> children = new HashSet<ITask>();
- for (String childHandle : childHandles) {
- ITask task = taskList.getTask(childHandle);
- if (task != null) {
- children.add(task);
- }
- }
- return children;
+ return Collections.unmodifiableSet(children);
}
-
+
public boolean contains(String handle) {
- return childHandles.contains(handle);
+ for (ITask child : children) {
+ if (handle.equals(child.getHandleIdentifier())) {
+ return true;
+ }
+ }
+ return false;
}
public String getSummary() {
return handle;
}
-
/**
* @since 2.0
*/
public boolean isEmpty() {
- return childHandles.isEmpty();
+ return children.isEmpty();
}
public String getHandleIdentifier() {
@@ -82,20 +77,25 @@ public abstract class AbstractTaskContainer extends PlatformObject implements IT
this.handle = handle;
}
+ /**
+ * Use {@link TaskList} methods instead.
+ */
void add(ITask task) {
- childHandles.add(task.getHandleIdentifier());
+ children.add(task);
}
+ /**
+ * Does not delete task from TaskList
+ */
void remove(ITask task) {
- childHandles.remove(task.getHandleIdentifier());
- }
-
- void clear() {
- childHandles.clear();
+ children.remove(task);
}
- public boolean isCompleted() {
- return false;
+ /**
+ * Does not delete tasks from TaskList
+ */
+ public void clear() {
+ children.clear();
}
@Override
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeActivityDelegate.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeActivityDelegate.java
index 42158e053..feb971c23 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeActivityDelegate.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeActivityDelegate.java
@@ -15,13 +15,11 @@ import java.util.Calendar;
import java.util.Date;
import java.util.Set;
-import org.eclipse.core.runtime.PlatformObject;
-
/**
* @author Rob Elves
* @author Mik Kersten
*/
-public class DateRangeActivityDelegate extends PlatformObject implements ITask {
+public class DateRangeActivityDelegate extends AbstractTaskContainer implements ITask {
private ITask task = null;
@@ -38,6 +36,7 @@ public class DateRangeActivityDelegate extends PlatformObject implements ITask {
}
public DateRangeActivityDelegate(DateRangeContainer parent, ITask task, Calendar start, Calendar end, long activity) {
+ super(task.getHandleIdentifier());
if (task == null) {
throw new RuntimeException("attempted to instantiated with null task: " + parent);
}
@@ -103,9 +102,9 @@ public class DateRangeActivityDelegate extends PlatformObject implements ITask {
return parent;
}
- public void addSubTask(ITask task) {
- task.addSubTask(task);
- }
+// public void addSubTask(ITask task) {
+// task.addSubTask(task);
+// }
public AbstractTaskContainer getContainer() {
return task.getContainer();
@@ -143,10 +142,6 @@ public class DateRangeActivityDelegate extends PlatformObject implements ITask {
return task.getNotes();
}
- public ITask getParent() {
- return task.getParent();
- }
-
public String getPriority() {
return task.getPriority();
}
@@ -179,9 +174,9 @@ public class DateRangeActivityDelegate extends PlatformObject implements ITask {
return task.isPastReminder();
}
- public void removeSubTask(ITask task) {
- task.removeSubTask(task);
- }
+// public void removeSubTask(ITask task) {
+// task.removeSubTask(task);
+// }
public void setActive(boolean active) {
task.setActive(active);
@@ -219,10 +214,6 @@ public class DateRangeActivityDelegate extends PlatformObject implements ITask {
task.setNotes(notes);
}
- public void setParent(ITask parent) {
- task.setParent(parent);
- }
-
public void setPriority(String priority) {
task.setPriority(priority);
}
@@ -254,4 +245,9 @@ public class DateRangeActivityDelegate extends PlatformObject implements ITask {
public void setDueDate(Date date) {
task.setDueDate(date);
}
+
+ @Override
+ public boolean isLocal() {
+ return ((Task)task).isLocal();
+ }
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeContainer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeContainer.java
index 540f674eb..4aabb01fb 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeContainer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeContainer.java
@@ -38,22 +38,21 @@ public class DateRangeContainer extends AbstractTaskContainer {
private long totalEstimated = 0;
- public DateRangeContainer(GregorianCalendar startDate, GregorianCalendar endDate, String description,
- TaskList taskList) {
- super(description, taskList);
+ public DateRangeContainer(GregorianCalendar startDate, GregorianCalendar endDate, String description) {
+ super(description);
this.startDate = startDate;
this.endDate = endDate;
}
- public DateRangeContainer(Calendar startDate, Calendar endDate, String description, TaskList taskList) {
- super(description, taskList);
+ public DateRangeContainer(Calendar startDate, Calendar endDate, String description) {
+ super(description);
this.startDate = startDate;
this.endDate = endDate;
}
- public DateRangeContainer(GregorianCalendar startDate, GregorianCalendar endDate, TaskList taskList) {
+ public DateRangeContainer(GregorianCalendar startDate, GregorianCalendar endDate) {
super(DateFormat.getDateInstance(DateFormat.FULL).format(startDate.getTime()) + " to "
- + DateFormat.getDateInstance(DateFormat.FULL).format(endDate.getTime()), taskList);
+ + DateFormat.getDateInstance(DateFormat.FULL).format(endDate.getTime()));
// super(startDate.hashCode() + endDate.hashCode() + "");
// String start =
// DateFormat.getDateInstance(DateFormat.FULL).format(startDate.getTime());
@@ -64,8 +63,8 @@ public class DateRangeContainer extends AbstractTaskContainer {
this.endDate = endDate;
}
- public DateRangeContainer(Date time, Date time2, String description, TaskList taskList) {
- super(description, taskList);
+ public DateRangeContainer(Date time, Date time2, String description) {
+ super(description);
startDate = new GregorianCalendar();
startDate.setTime(time);
endDate = new GregorianCalendar();
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java
index e167a79cd..cc4f601e4 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java
@@ -244,7 +244,7 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
String handle = element.getAttribute(KEY_HANDLE);
ITask subTask = tasklist.getTask(handle);
if (subTask != null) {
- task.addSubTask(subTask);
+ tasklist.addTask(subTask, (Task)task);
}
}
}
@@ -287,7 +287,7 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
AbstractTaskContainer category;
if (element.hasAttribute(KEY_NAME)) {
- category = new TaskCategory(element.getAttribute(KEY_NAME), taskList);
+ category = new TaskCategory(element.getAttribute(KEY_NAME));
taskList.internalAddCategory(category);
} else {
// LEGACY: registry categories did not have names
@@ -359,7 +359,7 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
if (task != null) {
readTaskInfo(task, taskList, element, parent, category);
}
-
+
return task;
}
@@ -407,8 +407,6 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
} else {
taskList.internalAddRootTask(task);
}
- } else if (parent != null) {
- task.setParent(parent);
} else {
taskList.internalAddTask(task, taskList.getArchiveContainer());
}
@@ -633,25 +631,9 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
return KEY_QUERY_HIT;
}
- public boolean canCreateElementFor(AbstractQueryHit queryHit) {
- return false;
- }
-
public Element createQueryHitElement(AbstractRepositoryTask queryHit, Document doc, Element parent) {
Element node = doc.createElement(getQueryHitTagName());
-// node.setAttribute(KEY_NAME, queryHit.getSummary());
node.setAttribute(KEY_HANDLE, queryHit.getHandleIdentifier());
-// node.setAttribute(KEY_PRIORITY, queryHit.getPriority());
-// if (queryHit.isCompleted()) {
-// node.setAttribute(KEY_COMPLETE, VAL_TRUE);
-// } else {
-// node.setAttribute(KEY_COMPLETE, VAL_FALSE);
-// }
-// if (queryHit.isNotified()) {
-// node.setAttribute(KEY_NOTIFIED_INCOMING, VAL_TRUE);
-// } else {
-// node.setAttribute(KEY_NOTIFIED_INCOMING, VAL_FALSE);
-// }
parent.appendChild(node);
return node;
}
@@ -667,7 +649,7 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
String handle = element.getAttribute(KEY_HANDLE);
ITask hit = taskList.getTask(handle);
if (hit != null) {
- query.addHit((AbstractRepositoryTask) hit);
+ taskList.addTask(hit, query);
}
} else {
@@ -675,46 +657,6 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
}
}
-// /**
-// * Subclasses should override.
-// */
-// public AbstractQueryHit createQueryHit(String repositoryUrl, String taskId,
-// String summary, Element element,
-// TaskList taskList, AbstractRepositoryQuery query) throws
-// TaskExternalizationException {
-// // no default hit reading behavior
-// return null;
-// }
-
-// private void readQueryHitInfo(AbstractQueryHit hit, TaskList taskList,
-// AbstractRepositoryQuery query,
-// Element element) throws TaskExternalizationException {
-// if (element.hasAttribute(KEY_PRIORITY)) {
-// hit.setPriority(element.getAttribute(KEY_PRIORITY));
-// }
-//
-// if (element.hasAttribute(KEY_COMPLETE) &&
-// element.getAttribute(KEY_COMPLETE).compareTo(VAL_TRUE) == 0) {
-// hit.setCompleted(true);
-// } else {
-// hit.setCompleted(false);
-// }
-//
-// if (element.hasAttribute(KEY_NOTIFIED_INCOMING)
-// && element.getAttribute(KEY_NOTIFIED_INCOMING).compareTo(VAL_TRUE) == 0) {
-// hit.setNotified(true);
-// } else {
-// hit.setNotified(false);
-// }
-//
-// ITask correspondingTask = taskList.getTask(hit.getHandleIdentifier());
-// if (correspondingTask instanceof AbstractRepositoryTask) {
-// hit.setCorrespondingTask((AbstractRepositoryTask) correspondingTask);
-// }
-//
-// query.addHit(hit);
-// }
-
public List<ITaskListExternalizer> getDelegateExternalizers() {
return delegateExternalizers;
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITask.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITask.java
index d5bbb31d1..3d95af2ab 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITask.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITask.java
@@ -23,10 +23,6 @@ public interface ITask extends ITaskListElement {
public abstract String getHandleIdentifier();
- public abstract ITask getParent();
-
- public abstract void setParent(ITask parent);
-
public abstract boolean isActive();
public abstract void setActive(boolean active);
@@ -55,12 +51,10 @@ public interface ITask extends ITaskListElement {
public abstract Set<ITask> getChildren();
- public abstract void addSubTask(ITask task);
-
- public abstract void removeSubTask(ITask task);
public abstract void setPriority(String priority);
+ @Deprecated
public abstract void setContainer(AbstractTaskContainer category);
/**
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListExternalizer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListExternalizer.java
index e248bca75..63de8b587 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListExternalizer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListExternalizer.java
@@ -32,8 +32,6 @@ public interface ITaskListExternalizer {
public abstract String getQueryTagNameForElement(AbstractRepositoryQuery query);
-// public abstract String getQueryHitTagName();
-
/**
* @return the element that was created, null if failed
*/
@@ -52,8 +50,8 @@ public interface ITaskListExternalizer {
public abstract boolean canReadTask(Node node);
- public abstract ITask createTask(String repositoryUrl, String taskId, String summary, Element element, TaskList tlist, AbstractTaskContainer category, ITask parent)
- throws TaskExternalizationException;
+ public abstract ITask createTask(String repositoryUrl, String taskId, String summary, Element element,
+ TaskList tlist, AbstractTaskContainer category, ITask parent) throws TaskExternalizationException;
public abstract boolean canCreateElementFor(AbstractRepositoryQuery category);
@@ -62,13 +60,4 @@ public interface ITaskListExternalizer {
public abstract boolean canReadQuery(Node node);
public abstract AbstractRepositoryQuery readQuery(Node node, TaskList tlist) throws TaskExternalizationException;
-
- public abstract boolean canCreateElementFor(AbstractQueryHit queryHit);
-
-// public abstract Element createQueryHitElement(AbstractRepositoryTask queryHit, Document doc, Element parent);
-
-// public abstract boolean canReadQueryHit(Node node);
-
-// public abstract AbstractQueryHit createQueryHit(String repositoryUrl, String taskId, String summary, Element element, TaskList tlist, AbstractRepositoryQuery query)
-// throws TaskExternalizationException;
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/QueryHitCollector.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/QueryHitCollector.java
index b6abca0f1..3fe1ea6b3 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/QueryHitCollector.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/QueryHitCollector.java
@@ -89,7 +89,7 @@ public class QueryHitCollector {
public void accept(RepositoryTaskData taskData) throws CoreException {
if (taskData == null)
return;
-
+
if (!getProgressMonitor().isCanceled()) {
getProgressMonitor().subTask(getFormattedMatchesString(matchCount));
getProgressMonitor().worked(1);
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/Task.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/Task.java
index b7f8fdc8e..8d7624143 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/Task.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/Task.java
@@ -14,15 +14,11 @@ package org.eclipse.mylar.tasks.core;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.PlatformObject;
/**
* @author Mik Kersten
*/
-public class Task extends PlatformObject implements ITask {
+public class Task extends AbstractTaskContainer implements ITask {
private static final String REPOSITORY_KIND_LOCAL = "local";
@@ -101,11 +97,9 @@ public class Task extends PlatformObject implements ITask {
}
}
- private String handleIdentifier = "-1";
-
private boolean active = false;
- private boolean category = false;
+// private boolean category = false;
private boolean hasReminded = false;
@@ -131,12 +125,7 @@ public class Task extends PlatformObject implements ITask {
private Date dueDate = null;
- /**
- * @return null if root
- */
- private transient ITask parent;
-
- private Set<ITask> children = new HashSet<ITask>();
+ //private Set<ITask> children = new HashSet<ITask>();
protected String kind = DEFAULT_TASK_KIND;
@@ -146,21 +135,10 @@ public class Task extends PlatformObject implements ITask {
}
public Task(String handle, String summary) {
- this.handleIdentifier = handle;
+ super(handle);
this.summary = summary;
}
- public String getHandleIdentifier() {
- return handleIdentifier;
- }
-
- public ITask getParent() {
- return parent;
- }
-
- public void setParent(ITask parent) {
- this.parent = parent;
- }
/**
* Package visible in order to prevent sets that don't update the index.
@@ -200,14 +178,6 @@ public class Task extends PlatformObject implements ITask {
}
}
- public boolean isCategory() {
- return category;
- }
-
- public void setIsCategory(boolean category) {
- this.category = category;
- }
-
public String getPriority() {
return priority;
}
@@ -247,21 +217,6 @@ public class Task extends PlatformObject implements ITask {
this.estimatedTimeHours = estimated;
}
- public Set<ITask> getChildren() {
- return children;
- }
-
- public void addSubTask(ITask t) {
- children.add(t);
- }
-
- public void removeSubTask(ITask t) {
- children.remove(t);
- }
-
- public void dropSubTasks() {
- children.clear();
- }
public void setContainer(AbstractTaskContainer cat) {
this.parentCategory = cat;
@@ -275,6 +230,7 @@ public class Task extends PlatformObject implements ITask {
return summary;
}
+ // TODO: Remove
public boolean isLocal() {
return true;
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskArchive.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskArchive.java
index adae2728a..7788ab5eb 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskArchive.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskArchive.java
@@ -22,8 +22,8 @@ public class TaskArchive extends AbstractTaskContainer {
public static final String LABEL_ARCHIVE = "Archive (all tasks)";
- public TaskArchive(TaskList taskList) {
- super(HANDLE, taskList);
+ public TaskArchive() {
+ super(HANDLE);
}
public String getPriority() {
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskCategory.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskCategory.java
index 9562bc848..e0ae5f726 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskCategory.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskCategory.java
@@ -21,8 +21,8 @@ import java.util.Set;
*/
public class TaskCategory extends AbstractTaskContainer {
- public TaskCategory(String handleAndDescription, TaskList taskList) {
- super(handleAndDescription, taskList);
+ public TaskCategory(String handleAndDescription) {
+ super(handleAndDescription);
}
public String getPriority() {
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskList.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskList.java
index 253551222..a6e1a2b37 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskList.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskList.java
@@ -65,8 +65,8 @@ public class TaskList {
categories = new ConcurrentHashMap<String, AbstractTaskContainer>();
queries = new ConcurrentHashMap<String, AbstractRepositoryQuery>();
- archiveContainer = new TaskArchive(this);
- uncategorizedCategory = new UncategorizedCategory(this);
+ archiveContainer = new TaskArchive();
+ uncategorizedCategory = new UncategorizedCategory();
activeTasks = new CopyOnWriteArrayList<ITask>();
lastTaskNum = 0;
@@ -76,9 +76,6 @@ public class TaskList {
public void addTask(ITask task) {
addTask(task, archiveContainer);
- for (ITask subTask : task.getChildren()) {
- addTask(subTask, archiveContainer);
- }
}
/**
@@ -98,11 +95,74 @@ public class TaskList {
return result;
}
- public void addTask(ITask task, AbstractTaskContainer category) {
- tasks.put(task.getHandleIdentifier(), task);
- if (category != null) {
- category.add(task);
- task.setContainer(category);
+// /**
+// * Adds subTask to parentTask, adding each to tasklist if not already
+// * present
+// */
+// public void addSubTask(ITask parentTask, ITask subTask) {
+// if (parentTask instanceof AbstractTaskContainer) {
+// if (!tasks.containsKey(parentTask.getHandleIdentifier())) {
+// addTask(parentTask);
+// } else {
+// parentTask = tasks.get(parentTask.getHandleIdentifier());
+// }
+// if (!tasks.containsKey(subTask.getHandleIdentifier())) {
+// addTask(subTask);
+// }
+// ((AbstractTaskContainer) parentTask).add(subTask);
+// }
+// }
+//
+// /**
+// * Precondition: query exists in tasklist Postcondition: hit added to
+// * tasklist if not present and added to query
+// */
+// public void addQueryHit(AbstractRepositoryQuery query, ITask hit) {
+// if (queries.containsKey(query.getHandleIdentifier())) {
+// if (!tasks.containsKey(hit.getHandleIdentifier())) {
+// addTask(hit);
+// } else {
+// hit = tasks.get(hit.getHandleIdentifier());
+// }
+// query.add(hit);
+// }
+// }
+
+// /**
+// * Add task hits to a query Precondition: query exists in tasklist
+// * Postcondition: hit added to tasklist if not present and added to query
+// */
+// public void addTask(ITask task, AbstractRepositoryQuery query) {
+// if (queries.containsKey(query.getHandleIdentifier())) {
+// if (!tasks.containsKey(task.getHandleIdentifier())) {
+// addTask(task);
+// } else {
+// hit = tasks.get(hit.getHandleIdentifier());
+// }
+// query.add(hit);
+// }
+// }
+
+ /**
+ * Precondition: {@code container} already exists in tasklist (be it a parent task, category, or query)
+ * @param task to be added (hit, subtask, etc)
+ * @param container task container, query or parent task
+ */
+ public void addTask(ITask task, AbstractTaskContainer container) {
+
+ if (!tasks.containsKey(task.getHandleIdentifier())) {
+ tasks.put(task.getHandleIdentifier(), task);
+ archiveContainer.add(task);
+ task.setContainer(archiveContainer);
+ } else {
+ task = tasks.get(task.getHandleIdentifier());
+ }
+
+ if (container != null) {
+ container.add(task);
+ if (!(container instanceof ITask) && !(container instanceof AbstractRepositoryQuery)) {
+ task.setContainer(container);
+ }
} else {
uncategorizedCategory.add(task);
task.setContainer(uncategorizedCategory);
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/UncategorizedCategory.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/UncategorizedCategory.java
index 7fca227dc..1b24f6b50 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/UncategorizedCategory.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/UncategorizedCategory.java
@@ -20,8 +20,8 @@ public class UncategorizedCategory extends AbstractTaskContainer {
public static final String HANDLE = "uncategorized";
- public UncategorizedCategory(TaskList taskList) {
- super(HANDLE, taskList);
+ public UncategorizedCategory() {
+ super(HANDLE);
}
public String getPriority() {
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TableSorterTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TableSorterTest.java
index 53e937fdb..48d841239 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TableSorterTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TableSorterTest.java
@@ -14,9 +14,9 @@ package org.eclipse.mylar.tasks.tests;
import junit.framework.TestCase;
import org.eclipse.mylar.internal.tasks.ui.views.TaskListTableSorter;
+import org.eclipse.mylar.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylar.tasks.core.Task;
import org.eclipse.mylar.tasks.core.TaskCategory;
-import org.eclipse.mylar.tasks.core.TaskList;
/**
* @author Mik Kersten
@@ -24,10 +24,10 @@ import org.eclipse.mylar.tasks.core.TaskList;
public class TableSorterTest extends TestCase {
public void testRootTaskSorting() {
- TaskListTableSorter sorter = new TaskListTableSorter(null, TaskListTableSorter.SortByIndex.SUMMARY);
+ TaskListTableSorter sorter = new TaskListTableSorter(TaskListView.getFromActivePerspective(), TaskListTableSorter.SortByIndex.SUMMARY);
Task task = new Task("1", "");
- TaskCategory category = new TaskCategory("cat", new TaskList());
+ TaskCategory category = new TaskCategory("cat");
assertEquals(-1, sorter.compare(null, task, category));
assertEquals(1, sorter.compare(null, category, task));
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityTest.java
index 187d285fd..8706e8f15 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityTest.java
@@ -28,7 +28,6 @@ import org.eclipse.mylar.tasks.core.DateRangeActivityDelegate;
import org.eclipse.mylar.tasks.core.DateRangeContainer;
import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.Task;
-import org.eclipse.mylar.tasks.core.TaskList;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
/**
@@ -40,11 +39,8 @@ public class TaskActivityTest extends TestCase {
private long currentEndMili = 1900;
- private TaskList taskList;
-
protected void setUp() throws Exception {
super.setUp();
- taskList = TasksUiPlugin.getTaskListManager().getTaskList();
}
protected void tearDown() throws Exception {
@@ -68,8 +64,7 @@ public class TaskActivityTest extends TestCase {
Calendar endDate = GregorianCalendar.getInstance();
endDate.setTimeInMillis(2000);
- DateRangeContainer testContainer = new DateRangeContainer(startDate, endDate, "test date range container",
- taskList);
+ DateRangeContainer testContainer = new DateRangeContainer(startDate, endDate, "test date range container");
assertTrue(testContainer.includes(startDate));
assertTrue(testContainer.includes(endDate));
Calendar midTime = GregorianCalendar.getInstance();
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskDataImportTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskDataImportTest.java
index a73ac3805..62c3f7860 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskDataImportTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskDataImportTest.java
@@ -87,7 +87,7 @@ public class TaskDataImportTest extends AbstractContextTest {
assertNotNull(historyContext);
assertTrue(taskList.getAllTasks().size() == 0);
assertTrue(historyContext.getInteractionHistory().size() == 0);
- assertEquals(1, TasksUiPlugin.getRepositoryManager().getAllRepositories().size());
+ //assertEquals(1, TasksUiPlugin.getRepositoryManager().getAllRepositories().size());
wizardPage.setParameters(true, true, true, true, true, "", sourceZipFile.getPath());
wizard.performFinish();
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListContentProviderTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListContentProviderTest.java
index 6ed8b9e77..6d76c8995 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListContentProviderTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListContentProviderTest.java
@@ -14,6 +14,7 @@ import org.eclipse.mylar.internal.tasks.ui.TaskListPreferenceConstants;
import org.eclipse.mylar.internal.tasks.ui.views.TaskListContentProvider;
import org.eclipse.mylar.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylar.tasks.core.Task;
+import org.eclipse.mylar.tasks.core.TaskList;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
/**
@@ -25,6 +26,8 @@ public class TaskListContentProviderTest extends TestCase {
private TaskListView view;
+ private TaskList taskList;
+
@Override
protected void setUp() throws Exception {
super.setUp();
@@ -34,6 +37,7 @@ public class TaskListContentProviderTest extends TestCase {
TasksUiPlugin.getDefault().getPreferenceStore().setValue(TaskListPreferenceConstants.FILTER_SUBTASKS, false);
view.clearFilters(true);
view.addFilter(view.getCompleteFilter());
+ taskList = TasksUiPlugin.getTaskListManager().getTaskList();
}
@Override
@@ -47,12 +51,12 @@ public class TaskListContentProviderTest extends TestCase {
Task parent = new Task("parent", "parent label");
Task completedChild = new Task("completed child", "completed child label");
completedChild.setCompleted(true);
- parent.addSubTask(completedChild);
+ taskList.addTask(completedChild, parent);
assertFalse(provider.hasChildren(parent));
Task incompleteChild = new Task("incomplete child", "incomplete child label");
incompleteChild.setCompleted(false);
- parent.addSubTask(incompleteChild);
+ taskList.addTask(incompleteChild, parent);
assertTrue(provider.hasChildren(parent));
}
}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java
index e9cf53000..35f8799e1 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java
@@ -139,7 +139,7 @@ public class TaskListManagerTest extends TestCase {
}
public void testMigrateQueryUrlHandles() {
- AbstractRepositoryQuery query = new MockRepositoryQuery("mquery", manager.getTaskList());
+ AbstractRepositoryQuery query = new MockRepositoryQuery("mquery");
query.setRepositoryUrl("http://foo.bar");
query.setUrl("http://foo.bar/b");
manager.getTaskList().addQuery(query);
@@ -153,7 +153,7 @@ public class TaskListManagerTest extends TestCase {
}
public void testMigrateQueryHandles() {
- AbstractRepositoryQuery query = new MockRepositoryQuery("mquery", manager.getTaskList());
+ AbstractRepositoryQuery query = new MockRepositoryQuery("mquery");
query.setRepositoryUrl("http://a");
manager.getTaskList().addQuery(query);
manager.refactorRepositoryUrl("http://a", "http://b");
@@ -283,9 +283,9 @@ public class TaskListManagerTest extends TestCase {
assertEquals(0, manager.getTaskList().getRootTasks().size());
Task task1 = new Task("t1", "t1");
- TaskCategory cat1 = new TaskCategory("cat1", manager.getTaskList());
+ TaskCategory cat1 = new TaskCategory("cat1");
manager.getTaskList().addCategory(cat1);
- TaskCategory cat2 = new TaskCategory("cat2", manager.getTaskList());
+ TaskCategory cat2 = new TaskCategory("cat2");
manager.getTaskList().addCategory(cat2);
manager.getTaskList().moveToContainer(cat1, task1);
@@ -304,7 +304,7 @@ public class TaskListManagerTest extends TestCase {
assertEquals(1, manager.getTaskList().getRootTasks().size());
assertEquals(UncategorizedCategory.HANDLE, task1.getContainer().getHandleIdentifier());
- TaskCategory cat1 = new TaskCategory("c1", manager.getTaskList());
+ TaskCategory cat1 = new TaskCategory("c1");
manager.getTaskList().addCategory(cat1);
manager.getTaskList().moveToContainer(cat1, task1);
@@ -326,7 +326,7 @@ public class TaskListManagerTest extends TestCase {
public void testCategoryPersistance() {
MockRepositoryTask task = new MockRepositoryTask("1");
- TaskCategory category = new TaskCategory("cat", manager.getTaskList());
+ TaskCategory category = new TaskCategory("cat");
manager.getTaskList().addCategory(category);
manager.getTaskList().moveToContainer(category, task);
assertNotNull(manager.getTaskList());
@@ -342,7 +342,7 @@ public class TaskListManagerTest extends TestCase {
public void testDeleteCategory() {
assertNotNull(manager.getTaskList());
assertEquals(2, manager.getTaskList().getCategories().size());
- TaskCategory category = new TaskCategory("cat", manager.getTaskList());
+ TaskCategory category = new TaskCategory("cat");
manager.getTaskList().addCategory(category);
assertEquals(3, manager.getTaskList().getCategories().size());
manager.getTaskList().deleteCategory(category);
@@ -351,7 +351,7 @@ public class TaskListManagerTest extends TestCase {
public void testDeleteCategoryMovesTasksToRoot() {
ITask task = new MockRepositoryTask("delete");
- TaskCategory category = new TaskCategory("cat", manager.getTaskList());
+ TaskCategory category = new TaskCategory("cat");
manager.getTaskList().addTask(task, category);
manager.getTaskList().addCategory(category);
assertEquals(0, manager.getTaskList().getUncategorizedCategory().getChildren().size());
@@ -363,7 +363,7 @@ public class TaskListManagerTest extends TestCase {
assertNotNull(manager.getTaskList());
- TaskCategory category = new TaskCategory("cat", manager.getTaskList());
+ TaskCategory category = new TaskCategory("cat");
manager.getTaskList().addCategory(category);
assertEquals(3, manager.getTaskList().getCategories().size());
String newDesc = "newDescription";
@@ -379,7 +379,7 @@ public class TaskListManagerTest extends TestCase {
String newDesc = "newDescription";
assertNotNull(manager.getTaskList());
assertEquals(2, manager.getTaskList().getCategories().size());
- TaskCategory category = new TaskCategory("cat", manager.getTaskList());
+ TaskCategory category = new TaskCategory("cat");
manager.getTaskList().addCategory(category);
assertEquals(3, manager.getTaskList().getCategories().size());
manager.getTaskList().renameContainer(category, newDesc);
@@ -390,10 +390,10 @@ public class TaskListManagerTest extends TestCase {
public void testCreateSameCategoryName() {
assertNotNull(manager.getTaskList());
assertEquals(2, manager.getTaskList().getCategories().size());
- TaskCategory category = new TaskCategory("cat", manager.getTaskList());
+ TaskCategory category = new TaskCategory("cat");
manager.getTaskList().addCategory(category);
assertEquals(3, manager.getTaskList().getCategories().size());
- TaskCategory category2 = new TaskCategory("cat", manager.getTaskList());
+ TaskCategory category2 = new TaskCategory("cat");
manager.getTaskList().addCategory(category2);
assertEquals(3, manager.getTaskList().getCategories().size());
AbstractTaskContainer container = manager.getTaskList().getContainerForHandle("cat");
@@ -417,7 +417,7 @@ public class TaskListManagerTest extends TestCase {
assertEquals(2, manager.getTaskList().getCategories().size());
ITask task = new Task("task-1", "label");
- TaskCategory category = new TaskCategory("handleAndDescription", manager.getTaskList());
+ TaskCategory category = new TaskCategory("handleAndDescription");
manager.getTaskList().addTask(task);
assertEquals(1, manager.getTaskList().getArchiveContainer().getChildren().size());
@@ -444,9 +444,9 @@ public class TaskListManagerTest extends TestCase {
MockRepositoryTask task = new MockRepositoryTask(repositoryUrl, "1");
TaskList taskList = TasksUiPlugin.getTaskListManager().getTaskList();
taskList.moveToRoot(task);
- MockRepositoryQuery query = new MockRepositoryQuery("query", taskList);
- query.addHit(task);
+ MockRepositoryQuery query = new MockRepositoryQuery("query");
taskList.addQuery(query);
+ taskList.addTask(task, query);
assertEquals(1, taskList.getAllTasks().size());
assertEquals(1, taskList.getRootTasks().size());
taskList.deleteTask(task);
@@ -469,7 +469,7 @@ public class TaskListManagerTest extends TestCase {
}
public void testRepositoryTasksAndCategoriesMultiRead() {
- TaskCategory cat1 = new TaskCategory("Category 1", manager.getTaskList());
+ TaskCategory cat1 = new TaskCategory("Category 1");
manager.getTaskList().addCategory(cat1);
MockRepositoryTask reportInCat1 = new MockRepositoryTask("123");
@@ -515,9 +515,8 @@ public class TaskListManagerTest extends TestCase {
rootTasks.add(task1);
Task sub1 = new Task("subtask-1", "sub 1");
- task1.addSubTask(sub1);
- manager.getTaskList().addTask(sub1);
- sub1.setParent(task1);
+ //manager.getTaskList().addTask(sub1);
+ manager.getTaskList().addTask(sub1, task1);
Task task2 = new Task(manager.genUniqueTaskHandle(), "task 2");
manager.getTaskList().moveToRoot(task2);
@@ -525,7 +524,7 @@ public class TaskListManagerTest extends TestCase {
Set<TaskCategory> categories = new HashSet<TaskCategory>();
Set<ITask> cat1Contents = new HashSet<ITask>();
- TaskCategory cat1 = new TaskCategory("Category 1", manager.getTaskList());
+ TaskCategory cat1 = new TaskCategory("Category 1");
manager.getTaskList().addCategory(cat1);
categories.add(cat1);
Task task3 = new Task(manager.genUniqueTaskHandle(), "task 3");
@@ -533,8 +532,8 @@ public class TaskListManagerTest extends TestCase {
cat1Contents.add(task3);
assertEquals(cat1, task3.getContainer());
Task sub2 = new Task(manager.genUniqueTaskHandle(), "sub 2");
- task3.addSubTask(sub2);
- sub2.setParent(task3);
+ manager.getTaskList().addTask(sub2, task3);
+
Task task4 = new Task(manager.genUniqueTaskHandle(), "task 4");
manager.getTaskList().moveToContainer(cat1, task4);
cat1Contents.add(task4);
@@ -627,21 +626,25 @@ public class TaskListManagerTest extends TestCase {
MockRepositoryTask hit2twin = new MockRepositoryTask("2");
MockRepositoryTask hit3twin = new MockRepositoryTask("3");
- MockRepositoryQuery query1 = new MockRepositoryQuery("query1", manager.getTaskList());
- MockRepositoryQuery query2 = new MockRepositoryQuery("query2", manager.getTaskList());
-
- query1.addHit(hit1);
- query1.addHit(hit2);
- query1.addHit(hit3);
+ MockRepositoryQuery query1 = new MockRepositoryQuery("query1");
+ MockRepositoryQuery query2 = new MockRepositoryQuery("query2");
+
+ taskList.addQuery(query1);
+ taskList.addQuery(query2);
+ taskList.addTask(hit1, query1);
+ taskList.addTask(hit2, query1);
+ taskList.addTask(hit3, query1);
+
+
assertEquals(3, query1.getHits().size());
- query2.addHit(hit1twin);
- query2.addHit(hit2twin);
- query2.addHit(hit3twin);
+
+ taskList.addTask(hit1twin, query2);
+ taskList.addTask(hit2twin, query2);
+ taskList.addTask(hit3twin, query2);
+
assertEquals(3, query2.getHits().size());
- manager.getTaskList().addQuery(query1);
- manager.getTaskList().addQuery(query2);
Set<AbstractRepositoryQuery> queriesReturned = taskList.getQueriesForHandle(RepositoryTaskHandleUtil.getHandle(
MockRepositoryConnector.REPOSITORY_URL, "1"));
@@ -674,6 +677,7 @@ public class TaskListManagerTest extends TestCase {
// }
public void testUpdateQueryHits() {
+ TaskList taskList = manager.getTaskList();
MockRepositoryTask hit1 = new MockRepositoryTask("1");
MockRepositoryTask hit2 = new MockRepositoryTask("2");
@@ -683,26 +687,28 @@ public class TaskListManagerTest extends TestCase {
MockRepositoryTask hit2twin = new MockRepositoryTask("2");
MockRepositoryTask hit3twin = new MockRepositoryTask("3");
- MockRepositoryQuery query1 = new MockRepositoryQuery("query1", manager.getTaskList());
-
- query1.addHit(hit1);
- query1.addHit(hit2);
- query1.addHit(hit3);
+ MockRepositoryQuery query1 = new MockRepositoryQuery("query1");
+ taskList.addQuery(query1);
+
+ taskList.addTask(hit1, query1);
+ taskList.addTask(hit2, query1);
+ taskList.addTask(hit3, query1);
+
+ taskList.addTask(hit1twin, query1);
+ taskList.addTask(hit2twin, query1);
+ taskList.addTask(hit3twin, query1);
assertEquals(3, query1.getHits().size());
- Set<AbstractRepositoryTask> newHits = new HashSet<AbstractRepositoryTask>();
- query1.updateHits(newHits);
+ query1.clear();
assertEquals(0, query1.getHits().size());
- newHits.add(hit1);
- newHits.add(hit2);
- query1.updateHits(newHits);
+ taskList.addTask(hit1, query1);
+ taskList.addTask(hit2, query1);
assertEquals(2, query1.getHits().size());
hit1.setNotified(true);
- newHits.clear();
- newHits.add(hit1twin);
- newHits.add(hit2twin);
- newHits.add(hit3twin);
- query1.updateHits(newHits);
+
+ taskList.addTask(hit1twin, query1);
+ taskList.addTask(hit2twin, query1);
+ taskList.addTask(hit3twin, query1);
assertEquals(3, query1.getHits().size());
assertTrue(query1.getHits().contains(hit1twin));
assertTrue(query1.getHits().contains(hit2twin));
@@ -768,12 +774,11 @@ public class TaskListManagerTest extends TestCase {
manager.getTaskList().reset();
MockRepositoryTask hit1 = new MockRepositoryTask("1");
MockRepositoryTask hit2 = new MockRepositoryTask("2");
- MockRepositoryQuery query = new MockRepositoryQuery("summary", manager.getTaskList());
- query.addHit(hit1);
- query.addHit(hit2);
-
-
+ MockRepositoryQuery query = new MockRepositoryQuery("summary");
manager.getTaskList().addQuery(query);
+ manager.getTaskList().addTask(hit1, query);
+ manager.getTaskList().addTask(hit2, query);
+
elements.clear();
elements.add(query);
readAction = new MarkTaskReadAction(elements);
@@ -805,11 +810,11 @@ public class TaskListManagerTest extends TestCase {
manager.getTaskList().reset();
MockRepositoryTask hit1 = new MockRepositoryTask("1");
MockRepositoryTask hit2 = new MockRepositoryTask("2");
- MockRepositoryQuery query = new MockRepositoryQuery("summary", manager.getTaskList());
- query.addHit(hit1);
- query.addHit(hit2);
-
+ MockRepositoryQuery query = new MockRepositoryQuery("summary");
manager.getTaskList().addQuery(query);
+ manager.getTaskList().addTask(hit1, query);
+ manager.getTaskList().addTask(hit2, query);
+
elements.clear();
elements.add(query);
MarkTaskReadAction readAction = new MarkTaskReadAction(elements);
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListTest.java
index 371a5b89d..da94671f9 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListTest.java
@@ -21,7 +21,7 @@ public class TaskListTest extends TestCase {
public void testGetUserCategories() {
TaskList taskList = new TaskList();
- taskList.addCategory(new TaskCategory("a", taskList));
+ taskList.addCategory(new TaskCategory("a"));
assertEquals(2, taskList.getUserCategories().size());
}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListUiTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListUiTest.java
index 884de73e5..08318cc78 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListUiTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListUiTest.java
@@ -88,7 +88,7 @@ public class TaskListUiTest extends TestCase {
try {
TaskListView.openInActivePerspective();
manager = TasksUiPlugin.getTaskListManager();
- cat1 = new TaskCategory("First Category", manager.getTaskList());
+ cat1 = new TaskCategory("First Category");
cat1task1 = new Task(TasksUiPlugin.getTaskListManager().genUniqueTaskHandle(), "task 1");
cat1task1.setPriority(Task.PriorityLevel.P1.toString());
@@ -99,8 +99,7 @@ public class TaskListUiTest extends TestCase {
cat1task1sub1 = new Task(TasksUiPlugin.getTaskListManager().genUniqueTaskHandle(), "sub task 1");
cat1task1sub1.setPriority(Task.PriorityLevel.P1.toString());
cat1task1sub1.setCompleted(true);
- cat1task1sub1.setParent(cat1task1);
- cat1task1.addSubTask(cat1task1sub1);
+ manager.getTaskList().addTask(cat1task1sub1, cat1task1);
cat1task2 = new Task(TasksUiPlugin.getTaskListManager().genUniqueTaskHandle(), "task 2");
cat1task2.setPriority(Task.PriorityLevel.P2.toString());
@@ -127,7 +126,7 @@ public class TaskListUiTest extends TestCase {
manager.getTaskList().addCategory(cat1);
assertEquals(cat1.getChildren().size(), 5);
- cat2 = new TaskCategory("Second Category", manager.getTaskList());
+ cat2 = new TaskCategory("Second Category");
cat2task1 = new Task(TasksUiPlugin.getTaskListManager().genUniqueTaskHandle(), "task 1");
cat2task1.setPriority(Task.PriorityLevel.P1.toString());
@@ -136,8 +135,7 @@ public class TaskListUiTest extends TestCase {
cat2task1sub1 = new Task(TasksUiPlugin.getTaskListManager().genUniqueTaskHandle(), "sub task 1");
cat2task1sub1.setPriority(Task.PriorityLevel.P1.toString());
- cat2task1sub1.setParent(cat2task1);
- cat2task1.addSubTask(cat2task1sub1);
+ manager.getTaskList().addTask(cat2task1sub1, cat2task1);
cat2task2 = new Task(TasksUiPlugin.getTaskListManager().genUniqueTaskHandle(), "task 2");
cat2task2.setPriority(Task.PriorityLevel.P2.toString());
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryQuery.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryQuery.java
index 9a9fb33a8..1508a4e3e 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryQuery.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryQuery.java
@@ -12,7 +12,6 @@
package org.eclipse.mylar.tasks.tests.connector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
-import org.eclipse.mylar.tasks.core.TaskList;
/**
* @author Mik Kersten
@@ -21,13 +20,13 @@ public class MockRepositoryQuery extends AbstractRepositoryQuery {
public String MOCK_URL = "http://mock.repository";
- public MockRepositoryQuery(String description, TaskList taskList) {
- super(description, taskList);
+ public MockRepositoryQuery(String description) {
+ super(description);
super.setUrl(MOCK_URL);
}
- public MockRepositoryQuery(String description, TaskList taskList, String url) {
- super(description, taskList);
+ public MockRepositoryQuery(String description, String url) {
+ super(description);
super.setUrl(url);
}
diff --git a/org.eclipse.mylyn.tasks.ui/plugin.xml b/org.eclipse.mylyn.tasks.ui/plugin.xml
index da40f24e7..d995167b8 100644
--- a/org.eclipse.mylyn.tasks.ui/plugin.xml
+++ b/org.eclipse.mylyn.tasks.ui/plugin.xml
@@ -370,7 +370,7 @@
tooltip="Synchronize with Repository">
<enablement>
<or>
- <objectClass name="org.eclipse.mylar.tasks.core.AbstractQueryHit"/>
+ <!--<objectClass name="org.eclipse.mylar.tasks.core.AbstractQueryHit"/>-->
<objectClass name="org.eclipse.mylar.tasks.core.AbstractRepositoryQuery"/>
<objectClass name="org.eclipse.mylar.tasks.core.AbstractRepositoryTask"/>
<objectClass name="org.eclipse.mylar.tasks.core.AbstractTaskContainer"/>
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/MoveToCategoryMenuContributor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/MoveToCategoryMenuContributor.java
index d4f0b2376..7d5dbc776 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/MoveToCategoryMenuContributor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/MoveToCategoryMenuContributor.java
@@ -16,7 +16,6 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.mylar.internal.tasks.ui.actions.NewCategoryAction;
-import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.ITaskListElement;
@@ -33,7 +32,11 @@ public class MoveToCategoryMenuContributor implements IDynamicSubMenuContributor
public MenuManager getSubMenuManager(final List<ITaskListElement> selectedElements) {
final MenuManager subMenuManager = new MenuManager(LABEL);
- subMenuManager.setVisible(selectedElements.size() > 0 && !(selectedElements.get(0) instanceof AbstractTaskContainer || selectedElements.get(0) instanceof AbstractRepositoryQuery));
+ //subMenuManager.setVisible(selectedElements.size() > 0 && !(selectedElements.get(0) instanceof AbstractTaskContainer || selectedElements.get(0) instanceof AbstractRepositoryQuery));
+
+ subMenuManager
+ .setVisible(selectedElements.size() > 0
+ && selectedElements.get(0) instanceof ITask);
List<AbstractTaskContainer> categories = new ArrayList<AbstractTaskContainer>(TasksUiPlugin.getTaskListManager().getTaskList().getCategories());
Collections.sort(categories);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java
index 2fe25b772..e61fb7618 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java
@@ -21,8 +21,6 @@ import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.window.Window;
import org.eclipse.mylar.internal.tasks.ui.planner.DateSelectionDialog;
-import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
-import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.ITaskListElement;
import org.eclipse.mylar.tasks.ui.DatePicker;
@@ -59,7 +57,7 @@ public class ScheduleTaskMenuContributor implements IDynamicSubMenuContributor {
subMenuManager
.setVisible(selectedElements.size() > 0
- && !(selectedElements.get(0) instanceof AbstractTaskContainer || selectedElements.get(0) instanceof AbstractRepositoryQuery));
+ && selectedElements.get(0) instanceof ITask);// !(selectedElements.get(0) instanceof AbstractTaskContainer || selectedElements.get(0) instanceof AbstractRepositoryQuery));
ITaskListElement singleSelection = null;
if (selectedElements.size() == 1) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewCategoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewCategoryAction.java
index c0666a92f..c10e51778 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewCategoryAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewCategoryAction.java
@@ -54,7 +54,7 @@ public class NewCategoryAction extends Action implements IViewActionDelegate {
"Enter name", "Enter a name for the Category: ", "", null);
int dialogResult = dialog.open();
if (dialogResult == Window.OK) {
- this.cat = new TaskCategory(dialog.getValue(), TasksUiPlugin.getTaskListManager().getTaskList());
+ this.cat = new TaskCategory(dialog.getValue());
TasksUiPlugin.getTaskListManager().getTaskList().addCategory(cat);
// this.view.getViewer().refresh();
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskListElementAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskListElementAction.java
index 5976d4c9d..747437b62 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskListElementAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskListElementAction.java
@@ -11,17 +11,17 @@
package org.eclipse.mylar.internal.tasks.ui.actions;
+import java.util.Iterator;
+import java.util.List;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
+import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.ITaskListElement;
import org.eclipse.mylar.tasks.ui.TasksUiUtil;
-import java.util.Iterator;
-import java.util.List;
-
/**
* @author Mik Kersten
*/
@@ -44,7 +44,8 @@ public class OpenTaskListElementAction extends Action {
List<?> list = ((IStructuredSelection) selection).toList();
for (Iterator<?> iterator = list.iterator(); iterator.hasNext();) {
Object element = (Object) iterator.next();
- if (element instanceof ITaskListElement && !(element instanceof AbstractTaskContainer)) {
+// if (element instanceof ITaskListElement && !(element instanceof AbstractTaskContainer)) {
+ if (element instanceof ITask) {
TasksUiUtil.refreshAndOpenTaskListElement((ITaskListElement) element);
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java
index d8bd103b8..146b4decb 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java
@@ -111,23 +111,21 @@ class CustomTaskListDecorationDrawer implements Listener {
offsetX = event.x + 18 - platformSpecificSquish;
offsetY += 2;
}
- if (element instanceof AbstractTaskContainer) {
- if (element instanceof AbstractTaskContainer) {
- if (!Arrays.asList(this.taskListView.getViewer().getExpandedElements()).contains(element)
- && hasIncoming((AbstractTaskContainer) element)) {
- int additionalSquish = 0;
- if (platformSpecificSquish > 0 && taskListView.synchronizationOverlaid) {
- additionalSquish = platformSpecificSquish + 3;
- } else if (platformSpecificSquish > 0) {
- additionalSquish = platformSpecificSquish / 2;
- }
- if (taskListView.synchronizationOverlaid) {
- image = TasksUiImages.getImage(TasksUiImages.OVERLAY_SYNCH_INCOMMING);
- offsetX = 42 - additionalSquish;
- } else {
- image = TasksUiImages.getImage(TasksUiImages.OVERLAY_INCOMMING);
- offsetX = 24 - additionalSquish;
- }
+ if (element instanceof AbstractTaskContainer && !(element instanceof ITask)) {
+ if (!Arrays.asList(this.taskListView.getViewer().getExpandedElements()).contains(element)
+ && hasIncoming((AbstractTaskContainer) element)) {
+ int additionalSquish = 0;
+ if (platformSpecificSquish > 0 && taskListView.synchronizationOverlaid) {
+ additionalSquish = platformSpecificSquish + 3;
+ } else if (platformSpecificSquish > 0) {
+ additionalSquish = platformSpecificSquish / 2;
+ }
+ if (taskListView.synchronizationOverlaid) {
+ image = TasksUiImages.getImage(TasksUiImages.OVERLAY_SYNCH_INCOMMING);
+ offsetX = 42 - additionalSquish;
+ } else {
+ image = TasksUiImages.getImage(TasksUiImages.OVERLAY_INCOMMING);
+ offsetX = 24 - additionalSquish;
}
}
} else {
@@ -148,14 +146,14 @@ class CustomTaskListDecorationDrawer implements Listener {
}
}
}
-// if (container instanceof AbstractRepositoryQuery) {
-// AbstractRepositoryQuery query = (AbstractRepositoryQuery) container;
-// for (AbstractRepositoryTask hit : query.getHits()) {
-// if (hit.getSyncState() == RepositoryTaskSyncState.INCOMING) {
-// return true;
-// }
-// }
-// }
+// if (container instanceof AbstractRepositoryQuery) {
+// AbstractRepositoryQuery query = (AbstractRepositoryQuery) container;
+// for (AbstractRepositoryTask hit : query.getHits()) {
+// if (hit.getSyncState() == RepositoryTaskSyncState.INCOMING) {
+// return true;
+// }
+// }
+// }
return false;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TableDecoratingLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TableDecoratingLabelProvider.java
index 605b2d145..57a52216f 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TableDecoratingLabelProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TableDecoratingLabelProvider.java
@@ -37,7 +37,7 @@ public class TableDecoratingLabelProvider extends DecoratingLabelProvider implem
return null;
}
if (columnIndex == 0) {
- if (element instanceof AbstractTaskContainer) {
+ if (element instanceof AbstractTaskContainer && !(element instanceof ITask)) {
return super.getImage(element);
} else {
ITask task = TaskElementLabelProvider.getCorrespondingTask((ITaskListElement)element);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskActivityLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskActivityLabelProvider.java
index c9dbb2e7d..63c7c5832 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskActivityLabelProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskActivityLabelProvider.java
@@ -120,7 +120,7 @@ public class TaskActivityLabelProvider extends DecoratingLabelProvider implement
@Override
public Color getBackground(Object element) {
- if (element instanceof AbstractTaskContainer) {
+ if (element instanceof AbstractTaskContainer && !(element instanceof ITask)) {
return categoryBackgroundColor;
} else {
return super.getBackground(element);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskElementLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskElementLabelProvider.java
index 7db291f7d..fcd65c7a7 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskElementLabelProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskElementLabelProvider.java
@@ -235,24 +235,7 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
}
public Color getForeground(Object object) {
- if (object instanceof AbstractTaskContainer) {
- for (ITask child : ((AbstractTaskContainer) object).getChildren()) {
- if (child.isActive()) {
- return TaskListColorsAndFonts.COLOR_TASK_ACTIVE;
- } else if (child.isPastReminder() && !child.isCompleted()) {
- return themeManager.getCurrentTheme().getColorRegistry().get(
- TaskListColorsAndFonts.THEME_COLOR_TASK_OVERDUE);
- }
- }
- } else if (object instanceof AbstractRepositoryQuery) {
- // FIXME AbstractRepositoryQuery is a subclass of
- // AbstractTaskContainer so this is probably a dead branch!
- for (AbstractRepositoryTask child : ((AbstractRepositoryQuery) object).getHits()) {
- if (child != null && child.isActive()) {
- return TaskListColorsAndFonts.COLOR_TASK_ACTIVE;
- }
- }
- } else if (object instanceof ITaskListElement) {
+ if (object instanceof ITaskListElement && object instanceof ITask) {
ITask task = getCorrespondingTask((ITaskListElement) object);
if (task != null) {
if (TasksUiPlugin.getTaskListManager().isCompletedToday(task)) {
@@ -274,6 +257,15 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
TaskListColorsAndFonts.THEME_COLOR_TASK_THISWEEK_SCHEDULED);
}
}
+ } else if (object instanceof AbstractTaskContainer) {
+ for (ITask child : ((AbstractTaskContainer) object).getChildren()) {
+ if (child.isActive()) {
+ return TaskListColorsAndFonts.COLOR_TASK_ACTIVE;
+ } else if (child.isPastReminder() && !child.isCompleted()) {
+ return themeManager.getCurrentTheme().getColorRegistry().get(
+ TaskListColorsAndFonts.THEME_COLOR_TASK_OVERDUE);
+ }
+ }
}
return null;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java
index 0fb5e4fd3..38128d2af 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java
@@ -63,11 +63,11 @@ public class TaskListContentProvider implements IStructuredContentProvider, ITre
public Object getParent(Object child) {
if (child instanceof ITask) {
- if (((ITask) child).getParent() != null) {
- return ((ITask) child).getParent();
- } else {
+// if (((ITask) child).getParent() != null) {
+// return ((ITask) child).getParent();
+// } else {
return ((ITask) child).getContainer();
- }
+// }
}
return null;
}
@@ -84,12 +84,12 @@ public class TaskListContentProvider implements IStructuredContentProvider, ITre
if (parent instanceof AbstractRepositoryQuery) {
AbstractRepositoryQuery t = (AbstractRepositoryQuery) parent;
return !t.isEmpty();
+ } else if (parent instanceof ITask) {
+ return taskHasUnfilteredChildren((ITask) parent);
} else if (parent instanceof AbstractTaskContainer) {
AbstractTaskContainer cat = (AbstractTaskContainer) parent;
// TODO: should provide hasChildren method!
return cat.getChildren() != null && cat.getChildren().size() > 0;
- } else if (parent instanceof ITask) {
- return taskHasUnfilteredChildren((ITask) parent);
}
return false;
}
@@ -241,18 +241,19 @@ public class TaskListContentProvider implements IStructuredContentProvider, ITre
}
}
return children;
- }
-// else if (parent instanceof AbstractQueryHit) {
-// AbstractRepositoryTask task = ((AbstractQueryHit) parent).getCorrespondingTask();
-// if (task != null) {
-// for (ITask t : task.getChildren()) {
-// if (!filter(parent, t)) {
-// children.add(t);
-// }
-// }
-// }
-// return children;
-// }
+ }
+// else if (parent instanceof AbstractQueryHit) {
+// AbstractRepositoryTask task = ((AbstractQueryHit)
+// parent).getCorrespondingTask();
+// if (task != null) {
+// for (ITask t : task.getChildren()) {
+// if (!filter(parent, t)) {
+// children.add(t);
+// }
+// }
+// }
+// return children;
+// }
} else {
List<ITaskListElement> children = new ArrayList<ITaskListElement>();
if (parent instanceof AbstractRepositoryQuery) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListTableSorter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListTableSorter.java
index 6986c8dca..bd2bc4251 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListTableSorter.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListTableSorter.java
@@ -85,10 +85,17 @@ public class TaskListTableSorter extends ViewerSorter {
return 1;
}
- if (o1 instanceof AbstractTaskContainer && o2 instanceof ITask) {
+ if (!(o1 instanceof ITask) && o2 instanceof ITask) {
return 1;
}
- if (o1 instanceof AbstractTaskContainer || o1 instanceof AbstractRepositoryQuery) {
+
+ if (o1 instanceof ITask && !(o2 instanceof AbstractTaskContainer)) {
+ return -1;
+ }
+
+ // if (o1 instanceof AbstractTaskContainer || o1 instanceof
+ // AbstractRepositoryQuery) {
+ if (!(o1 instanceof ITask)) {
if (o2 instanceof AbstractTaskContainer || o2 instanceof AbstractRepositoryQuery) {
return this.view.sortDirection
@@ -98,7 +105,7 @@ public class TaskListTableSorter extends ViewerSorter {
return -1;
}
} else if (o1 instanceof ITaskListElement) {
- if (o2 instanceof AbstractTaskContainer || o2 instanceof AbstractRepositoryQuery) {
+ if (!(o2 instanceof ITask)) {
return -1;
} else if (o2 instanceof ITaskListElement) {
ITaskListElement element1 = (ITaskListElement) o1;
@@ -122,10 +129,10 @@ public class TaskListTableSorter extends ViewerSorter {
ITask t1 = null;
ITask t2 = null;
if (element1 instanceof ITask) {
- t1 = (ITask)element1;
- }
+ t1 = (ITask) element1;
+ }
if (element2 instanceof ITask) {
- t2 = (ITask)element2;
+ t2 = (ITask) element2;
}
if (t1 != null && t2 != null) {
if (t1.getCreationDate() != null) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
index 8d53fe838..160f00b02 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
@@ -341,7 +341,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
private final Listener CATEGORY_GRADIENT_DRAWER = new Listener() {
public void handleEvent(Event event) {
- if (event.item.getData() instanceof AbstractTaskContainer) {
+ if (event.item.getData() instanceof AbstractTaskContainer && !(event.item.getData() instanceof ITask)) {
Scrollable scrollable = (Scrollable) event.widget;
GC gc = event.gc;
@@ -1119,7 +1119,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
Map<String, List<IDynamicSubMenuContributor>> dynamicMenuMap = TasksUiPlugin.getDefault().getDynamicMenuMap();
- if (!(element instanceof AbstractTaskContainer)) {
+ if (element instanceof ITask) {
addAction(openAction, manager, element);
}
addAction(openWithBrowser, manager, element);
@@ -1154,7 +1154,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
addAction(renameAction, manager, element);
}
- if (element instanceof AbstractTaskContainer) {
+ if (element instanceof AbstractTaskContainer && !(element instanceof ITask)) {
manager.add(goIntoAction);
}
if (drilledIntoCategory != null) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java
index 6dacac1db..622760a1a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java
@@ -15,7 +15,6 @@ import java.util.HashSet;
import java.util.Set;
import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylar.tasks.core.DateRangeActivityDelegate;
import org.eclipse.mylar.tasks.core.DateRangeContainer;
import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.ITaskListElement;
@@ -64,12 +63,12 @@ public class TaskScheduleContentProvider extends TaskListContentProvider {
}
public Object getParent(Object child) {
- if (child instanceof DateRangeActivityDelegate) {
- DateRangeActivityDelegate dateRangeTaskWrapper = (DateRangeActivityDelegate) child;
- return dateRangeTaskWrapper.getParent();
- } else {
+// if (child instanceof DateRangeActivityDelegate) {
+// DateRangeActivityDelegate dateRangeTaskWrapper = (DateRangeActivityDelegate) child;
+// return dateRangeTaskWrapper.getParent();
+// } else {
return null;
- }
+// }
}
public boolean hasChildren(Object parent) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskTableLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskTableLabelProvider.java
index accd1fec4..75d614946 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskTableLabelProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskTableLabelProvider.java
@@ -23,6 +23,7 @@ import org.eclipse.mylar.internal.tasks.ui.TaskListColorsAndFonts;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
import org.eclipse.mylar.tasks.core.DateRangeContainer;
+import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.ITaskListElement;
import org.eclipse.mylar.tasks.core.TaskArchive;
import org.eclipse.swt.graphics.Color;
@@ -82,7 +83,7 @@ public class TaskTableLabelProvider extends DecoratingLabelProvider implements I
}
public Color getBackground(Object element, int columnIndex) {
- if (element instanceof AbstractTaskContainer) {
+ if (element instanceof AbstractTaskContainer && !(element instanceof ITask)) {
AbstractTaskContainer category = (AbstractTaskContainer) element;
if (category instanceof TaskArchive) {
return TaskListColorsAndFonts.BACKGROUND_ARCHIVE;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeQueryJob.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeQueryJob.java
index a6edeb855..59c7b4ff2 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeQueryJob.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeQueryJob.java
@@ -25,6 +25,7 @@ import org.eclipse.mylar.internal.core.util.DateUtil;
import org.eclipse.mylar.internal.tasks.ui.TasksUiImages;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
+import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.QueryHitCollector;
import org.eclipse.mylar.tasks.core.RepositoryStatus;
import org.eclipse.mylar.tasks.core.TaskList;
@@ -106,8 +107,8 @@ class SynchronizeQueryJob extends Job {
QueryHitCollector collector = new QueryHitCollector(taskList, new TaskFactory(repository));
SubProgressMonitor collectorMonitor = new SubProgressMonitor(monitor, 1);
collector.setProgressMonitor(collectorMonitor);
- final IStatus resultingStatus = connector.performQuery(repositoryQuery, repository,
- collectorMonitor, collector, forced);
+ final IStatus resultingStatus = connector.performQuery(repositoryQuery, repository, collectorMonitor,
+ collector, forced);
if (resultingStatus.getSeverity() == IStatus.CANCEL) {
// do nothing
@@ -118,9 +119,32 @@ class SynchronizeQueryJob extends Job {
QueryHitCollector.MAX_HITS_REACHED + "\n" + repositoryQuery.getSummary(), this);
}
- // TODO: when queries no longer hold onto tasklist, ensure all hits exist in tasklist here
+ // Notification state code
+ // Set<AbstractRepositoryTask> oldHits = repositoryQuery.getHits();
+ // for (AbstractRepositoryTask oldHit : oldHits) {
+ // collector.getTaskHits().
+ // int index = newHits.indexOf(oldHit);
+ // if (index != -1) {
+ // newHits.get(index).setNotified(oldHit.isNotified());
+ // }
+ // }
+ // for (AbstractQueryHit hit : newHits) {
+ // this.addHit(hit);
+ // }
+
+// repositoryQuery.clear();
+// for (AbstractRepositoryTask hit : collector.getTaskHits()) {
+// taskList.addTask(hit, repositoryQuery);
+// }
+
+
+ Set<AbstractRepositoryTask> hits = collector.getTaskHits();
+ hits.removeAll(repositoryQuery.getChildren());
+ //repositoryQuery.clear();
+ for (AbstractRepositoryTask hit : hits) {
+ taskList.addTask(hit, repositoryQuery);
+ }
- repositoryQuery.updateHits(collector.getTaskHits());
if (synchChangedTasks) {
repositories.add(repository);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeTaskJob.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeTaskJob.java
index cc2066dc6..6e6c53796 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeTaskJob.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeTaskJob.java
@@ -116,7 +116,7 @@ class SynchronizeTaskJob extends Job {
return Status.OK_STATUS;
}
- private void syncTask(IProgressMonitor monitor, final AbstractRepositoryTask repositoryTask) throws CoreException {
+ private void syncTask(IProgressMonitor monitor, AbstractRepositoryTask repositoryTask) throws CoreException {
monitor.setTaskName(LABEL_SYNCHRONIZING + repositoryTask.getSummary());
final TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository(
@@ -137,20 +137,24 @@ class SynchronizeTaskJob extends Job {
if (downloadedTaskData != null) {
// HACK: part of hack below
Date oldDueDate = repositoryTask.getDueDate();
-
- TasksUiPlugin.getSynchronizationManager().saveIncoming(repositoryTask, downloadedTaskData, forced);
- connector.updateTaskFromTaskData(repository, repositoryTask, downloadedTaskData);
- repositoryTask.dropSubTasks();
- for (String subId : taskDataHandler.getSubTaskIds(downloadedTaskData)) {
- if (subId == null || subId.trim().equals("")) {
- continue;
- }
- AbstractRepositoryTask subTask = connector.createTaskFromExistingId(repository, subId, false,
- new SubProgressMonitor(monitor, 1));
- if (subTask != null) {
- repositoryTask.addSubTask(subTask);
- }
- }
+
+
+ TaskFactory factory = new TaskFactory(repository);
+ repositoryTask = factory.createTask(downloadedTaskData, true, forced, new SubProgressMonitor(monitor, 1));
+
+// TasksUiPlugin.getSynchronizationManager().saveIncoming(repositoryTask, downloadedTaskData, forced);
+// connector.updateTaskFromTaskData(repository, repositoryTask, downloadedTaskData);
+// repositoryTask.dropSubTasks();
+// for (String subId : taskDataHandler.getSubTaskIds(downloadedTaskData)) {
+// if (subId == null || subId.trim().equals("")) {
+// continue;
+// }
+// AbstractRepositoryTask subTask = factory.createTaskFromExistingId(repository, subId, false,
+// new SubProgressMonitor(monitor, 1));
+// if (subTask != null) {
+// repositoryTask.addSubTask(subTask);
+// }
+// }
// HACK: Remove once connectors can get access to
// TaskDataManager and do this themselves
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskFactory.java
index d94422c6e..ac9c093bb 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskFactory.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskFactory.java
@@ -10,8 +10,10 @@ package org.eclipse.mylar.tasks.ui;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
+import org.eclipse.mylar.tasks.core.ITaskDataHandler;
import org.eclipse.mylar.tasks.core.ITaskFactory;
import org.eclipse.mylar.tasks.core.RepositoryTaskData;
import org.eclipse.mylar.tasks.core.TaskList;
@@ -32,28 +34,35 @@ public class TaskFactory implements ITaskFactory {
private TaskList taskList;
+ //private TaskDataManager dataManager;
+
+ private ITaskDataHandler dataHandler;
+
public TaskFactory(TaskRepository repository) {
this.repository = repository;
connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(repository.getKind());
synchManager = TasksUiPlugin.getSynchronizationManager();
taskList = TasksUiPlugin.getTaskListManager().getTaskList();
+ //dataManager = TasksUiPlugin.getDefault().getTaskDataManager();
+ dataHandler = connector.getTaskDataHandler();
+
}
/**
- * @param synchData -
+ * @param updateTasklist -
* synchronize task with the provided taskData
* @param forced -
* user requested synchronization
* @throws CoreException
*/
- public AbstractRepositoryTask createTask(RepositoryTaskData taskData, boolean synchData, boolean forced,
+ public AbstractRepositoryTask createTask(RepositoryTaskData taskData, boolean updateTasklist, boolean forced,
IProgressMonitor monitor) throws CoreException {
AbstractRepositoryTask repositoryTask = taskList.getTask(taskData.getRepositoryUrl(), taskData.getId());
if (repositoryTask == null) {
repositoryTask = connector.createTaskFromTaskData(repository, taskData, true, monitor);
- if (synchData) {
+ if (updateTasklist) {
taskList.addTask(repositoryTask);
synchManager.saveIncoming(repositoryTask, taskData, forced);
} else {
@@ -61,12 +70,90 @@ public class TaskFactory implements ITaskFactory {
}
} else {
- if (synchData) {
+ if (updateTasklist) {
synchManager.saveIncoming(repositoryTask, taskData, forced);
connector.updateTaskFromTaskData(repository, repositoryTask, taskData);
+ if (dataHandler != null) {
+ repositoryTask.clear();
+ for (String subId : dataHandler.getSubTaskIds(taskData)) {
+ if (subId == null || subId.trim().equals("")) {
+ continue;
+ }
+ AbstractRepositoryTask subTask = connector.createTaskFromExistingId(repository, subId, false,
+ new SubProgressMonitor(monitor, 1));
+ if (subTask != null) {
+ taskList.addTask(subTask, repositoryTask);
+ }
+ }
+ }
}
}
return repositoryTask;
}
+ // TODO: Move all task construction code here
+
+// /**
+// * Create new repository task, adding result to tasklist
+// */
+// public AbstractRepositoryTask createTaskFromExistingId(TaskRepository repository, String id,
+// boolean retrieveSubTasks, IProgressMonitor monitor) throws CoreException {
+// ITask task = taskList.getTask(repository.getUrl(), id);
+// AbstractRepositoryTask repositoryTask = null;
+// if (task instanceof AbstractRepositoryTask) {
+// repositoryTask = (AbstractRepositoryTask) task;
+// } else if (task == null && dataHandler != null) {
+// RepositoryTaskData taskData = null;
+// taskData = dataHandler.getTaskData(repository, id, new SubProgressMonitor(monitor, 1));
+// if (taskData != null) {
+// repositoryTask = createTaskFromTaskData(repository, taskData, retrieveSubTasks, new SubProgressMonitor(
+// monitor, 1));
+// if (repositoryTask != null) {
+// taskList.addTask(repositoryTask);
+// }
+// }
+// } // TODO: Handle case similar to web tasks (no taskDataHandler but
+// // have tasks)
+//
+// return repositoryTask;
+// }
+//
+// /**
+// * Creates a new task from the given task data. Does NOT add resulting task
+// * to the tasklist
+// */
+// public AbstractRepositoryTask createTaskFromTaskData(TaskRepository repository, RepositoryTaskData taskData,
+// boolean retrieveSubTasks, IProgressMonitor monitor) throws CoreException {
+// AbstractRepositoryTask repositoryTask = null;
+// if (monitor == null) {
+// monitor = new NullProgressMonitor();
+// }
+// try {
+// if (taskData != null && dataHandler != null) {
+// // Use connector task factory
+// repositoryTask = connector.createTask(repository.getUrl(), taskData.getId(), taskData.getId() + ": "
+// + taskData.getDescription());
+// connector.updateTaskFromTaskData(repository, repositoryTask, taskData);
+// dataManager.setNewTaskData(repositoryTask.getHandleIdentifier(), taskData);
+//
+// if (retrieveSubTasks) {
+// monitor.beginTask("Creating task", dataHandler.getSubTaskIds(taskData).size());
+// for (String subId : dataHandler.getSubTaskIds(taskData)) {
+// if (subId == null || subId.trim().equals("")) {
+// continue;
+// }
+// AbstractRepositoryTask subTask = createTaskFromExistingId(repository, subId, false,
+// new SubProgressMonitor(monitor, 1));
+// if (subTask != null) {
+// repositoryTask.addSubTask(subTask);
+// }
+// }
+// }
+// }
+// } finally {
+// monitor.done();
+// }
+// return repositoryTask;
+// }
+
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskListManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskListManager.java
index fa787647a..b31a24744 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskListManager.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskListManager.java
@@ -550,7 +550,7 @@ public class TaskListManager implements IPropertyChangeListener {
summary = "Sunday";
break;
}
- DateRangeContainer day = new DateRangeContainer(dayStart, dayEnd, summary, taskList);
+ DateRangeContainer day = new DateRangeContainer(dayStart, dayEnd, summary);
activityWeekDays.add(day);
dateRangeContainers.add(day);
}
@@ -563,7 +563,7 @@ public class TaskListManager implements IPropertyChangeListener {
currentEnd.setFirstDayOfWeek(startDay);
currentEnd.setTime(startTime);
snapToEndOfWeek(currentEnd);
- activityThisWeek = new DateRangeContainer(currentBegin, currentEnd, DESCRIPTION_THIS_WEEK, taskList);
+ activityThisWeek = new DateRangeContainer(currentBegin, currentEnd, DESCRIPTION_THIS_WEEK);
// dateRangeContainers.add(activityThisWeek);
GregorianCalendar previousStart = new GregorianCalendar();
@@ -577,7 +577,7 @@ public class TaskListManager implements IPropertyChangeListener {
previousEnd.add(Calendar.WEEK_OF_YEAR, NUM_WEEKS_PREVIOUS);
snapToEndOfWeek(previousEnd);
activityPreviousWeek = new DateRangeContainer(previousStart.getTime(), previousEnd.getTime(),
- DESCRIPTION_PREVIOUS_WEEK, taskList);
+ DESCRIPTION_PREVIOUS_WEEK);
dateRangeContainers.add(activityPreviousWeek);
GregorianCalendar nextStart = new GregorianCalendar();
@@ -590,8 +590,7 @@ public class TaskListManager implements IPropertyChangeListener {
nextEnd.setTime(startTime);
nextEnd.add(Calendar.WEEK_OF_YEAR, NUM_WEEKS_NEXT);
snapToEndOfWeek(nextEnd);
- activityNextWeek = new DateRangeContainer(nextStart.getTime(), nextEnd.getTime(), DESCRIPTION_NEXT_WEEK,
- taskList);
+ activityNextWeek = new DateRangeContainer(nextStart.getTime(), nextEnd.getTime(), DESCRIPTION_NEXT_WEEK);
dateRangeContainers.add(activityNextWeek);
GregorianCalendar futureStart = new GregorianCalendar();
@@ -604,8 +603,7 @@ public class TaskListManager implements IPropertyChangeListener {
futureEnd.setTime(startTime);
futureEnd.add(Calendar.WEEK_OF_YEAR, NUM_WEEKS_FUTURE_END);
snapToEndOfWeek(futureEnd);
- activityFuture = new DateRangeContainer(futureStart.getTime(), futureEnd.getTime(), DESCRIPTION_FUTURE,
- taskList);
+ activityFuture = new DateRangeContainer(futureStart.getTime(), futureEnd.getTime(), DESCRIPTION_FUTURE);
dateRangeContainers.add(activityFuture);
GregorianCalendar pastStart = new GregorianCalendar();
@@ -618,7 +616,7 @@ public class TaskListManager implements IPropertyChangeListener {
pastEnd.setTime(startTime);
pastEnd.add(Calendar.WEEK_OF_YEAR, NUM_WEEKS_PAST_END);
snapToEndOfWeek(pastEnd);
- activityPast = new DateRangeContainer(pastStart.getTime(), pastEnd.getTime(), DESCRIPTION_PAST, taskList);
+ activityPast = new DateRangeContainer(pastStart.getTime(), pastEnd.getTime(), DESCRIPTION_PAST);
dateRangeContainers.add(activityPast);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java
index 8e04a3288..2ff2e8ffd 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java
@@ -284,7 +284,7 @@ public class TasksUiPlugin extends AbstractUIPlugin implements IStartup {
if (connectorUi != null && !connectorUi.hasCustomNotificationHandling()) {
for (AbstractRepositoryTask repositoryTask : TasksUiPlugin.getTaskListManager().getTaskList()
.getRepositoryTasks(repository.getUrl())) {
- if (repositoryTask.getSyncState() == RepositoryTaskSyncState.INCOMING
+ if ((repositoryTask.getLastSyncDateStamp() == null || repositoryTask.getSyncState() == RepositoryTaskSyncState.INCOMING)
&& repositoryTask.isNotified() == false) {
TaskListNotificationIncoming notification = getIncommingNotification(connector,
repositoryTask);
@@ -407,7 +407,7 @@ public class TasksUiPlugin extends AbstractUIPlugin implements IStartup {
taskListManager.addActivityListener(CONTEXT_TASK_ACTIVITY_LISTENER);
taskListManager.readExistingOrCreateNewList();
initialized = true;
-
+
saveParticipant = new ISaveParticipant() {
public void doneSaving(ISaveContext context) {
@@ -491,8 +491,8 @@ public class TasksUiPlugin extends AbstractUIPlugin implements IStartup {
MylarStatusHandler.fail(t, "Could not finish Tasks UI initialization", false);
}
}
- });
-
+ });
+
Bundle bundle = Platform.getBundle("org.eclipse.ui.workbench");
if (bundle.getLocation().contains("_3.3.")) {
eclipse_3_3_workbench = true;
@@ -764,31 +764,35 @@ public class TasksUiPlugin extends AbstractUIPlugin implements IStartup {
private void readOfflineReports() {
IPath offlineReportsPath = Platform.getStateLocation(TasksUiPlugin.getDefault().getBundle());
-// try {
- taskDataManager = new TaskDataManager(taskRepositoryManager, offlineReportsPath);//, true);
-// } catch (Throwable t) {
-// MylarStatusHandler.log("Recreating offline task cache due to format update.", this);
-// boolean deleted = offlineReportsPath.toFile().delete();
-// if (!deleted) {
-// MylarStatusHandler.log(t, "could not delete offline repository tasks file");
-// }
-// try {
-// taskDataManager = new TaskDataManager(taskRepositoryManager, offlineReportsPath, false);
-// } catch (Exception e1) {
-// MylarStatusHandler.log(e1, "could not reset offline repository tasks file");
-// }
-// }
- }
-
-// /**
-// * Returns the path to the file caching the offline bug reports. PUBLIC FOR
-// * TESTING
-// */
-// public IPath getOfflineReportsFilePath() {
-// IPath stateLocation = Platform.getStateLocation(TasksUiPlugin.getDefault().getBundle());
-// IPath configFile = stateLocation.append("offlineReports");
-// return configFile;
-// }
+// try {
+ taskDataManager = new TaskDataManager(taskRepositoryManager, offlineReportsPath);// ,
+ // true);
+// } catch (Throwable t) {
+// MylarStatusHandler.log("Recreating offline task cache due to format update.",
+// this);
+// boolean deleted = offlineReportsPath.toFile().delete();
+// if (!deleted) {
+// MylarStatusHandler.log(t, "could not delete offline repository tasks file");
+// }
+// try {
+// taskDataManager = new TaskDataManager(taskRepositoryManager,
+// offlineReportsPath, false);
+// } catch (Exception e1) {
+// MylarStatusHandler.log(e1, "could not reset offline repository tasks file");
+// }
+// }
+ }
+
+// /**
+// * Returns the path to the file caching the offline bug reports. PUBLIC FOR
+// * TESTING
+// */
+// public IPath getOfflineReportsFilePath() {
+// IPath stateLocation =
+// Platform.getStateLocation(TasksUiPlugin.getDefault().getBundle());
+// IPath configFile = stateLocation.append("offlineReports");
+// return configFile;
+// }
public TaskDataManager getTaskDataManager() {
if (taskDataManager == null) {
@@ -909,7 +913,7 @@ public class TasksUiPlugin extends AbstractUIPlugin implements IStartup {
public static TaskListNotificationIncoming getIncommingNotification(AbstractRepositoryConnector connector,
AbstractRepositoryTask repositoryTask) {
-
+
TaskListNotificationIncoming notification = new TaskListNotificationIncoming(repositoryTask);
RepositoryTaskData newTaskData = getDefault().getTaskDataManager().getNewTaskData(
@@ -918,14 +922,13 @@ public class TasksUiPlugin extends AbstractUIPlugin implements IStartup {
RepositoryTaskData oldTaskData = getDefault().getTaskDataManager().getOldTaskData(
repositoryTask.getHandleIdentifier());
-
if (newTaskData != null && oldTaskData != null) {
-
+
String descriptionText = getChangedDescription(newTaskData, oldTaskData);
- if(descriptionText != null){
+ if (descriptionText != null) {
notification.setDescription(descriptionText);
}
-
+
if (connector != null) {
ITaskDataHandler offlineHandler = connector.getTaskDataHandler();
if (offlineHandler != null && newTaskData.getLastModified() != null) {
@@ -940,12 +943,12 @@ public class TasksUiPlugin extends AbstractUIPlugin implements IStartup {
}
return notification;
}
-
- private static String getChangedDescription(RepositoryTaskData newTaskData, RepositoryTaskData oldTaskData){
-
+
+ private static String getChangedDescription(RepositoryTaskData newTaskData, RepositoryTaskData oldTaskData) {
+
String descriptionText = "";
-
- if(newTaskData.getComments().size() > oldTaskData.getComments().size()){
+
+ if (newTaskData.getComments().size() > oldTaskData.getComments().size()) {
List<TaskComment> taskComments = newTaskData.getComments();
if (taskComments != null && taskComments.size() > 0) {
TaskComment lastComment = taskComments.get(taskComments.size() - 1);
@@ -959,12 +962,12 @@ public class TasksUiPlugin extends AbstractUIPlugin implements IStartup {
}
}
}
-
+
boolean attributeChanged = false;
-
- for(RepositoryTaskAttribute newAttribute: newTaskData.getAttributes()){
+
+ for (RepositoryTaskAttribute newAttribute : newTaskData.getAttributes()) {
RepositoryTaskAttribute oldAttribute = oldTaskData.getAttribute(newAttribute.getID());
- if (oldAttribute == null){
+ if (oldAttribute == null) {
attributeChanged = true;
break;
}
@@ -976,19 +979,19 @@ public class TasksUiPlugin extends AbstractUIPlugin implements IStartup {
break;
}
}
-
- if(attributeChanged){
- if (descriptionText.equals("")){
+
+ if (attributeChanged) {
+ if (descriptionText.equals("")) {
descriptionText += "Attributes changed";
- }
- }
-// else {
-// String description = taskData.getDescription();
-// if (description != null) {
-// notification.setDescription(description);
-// }
-// }
-
+ }
+ }
+// else {
+// String description = taskData.getDescription();
+// if (description != null) {
+// notification.setDescription(description);
+// }
+// }
+
return descriptionText;
}
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java
index b9efb9910..1a9db086f 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java
@@ -33,7 +33,6 @@ import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.IAttachmentHandler;
-import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.ITaskDataHandler;
import org.eclipse.mylar.tasks.core.QueryHitCollector;
import org.eclipse.mylar.tasks.core.RepositoryOperation;
@@ -260,20 +259,20 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
return clientManager;
}
- public TracTask createTask(TracTicket ticket, String repositoryUrl, String taskId) {
- TracTask task;
- // String handleIdentifier =
- // AbstractRepositoryTask.getHandle(repositoryUrl, taskId);
- ITask existingTask = taskList.getTask(repositoryUrl, taskId);
- if (existingTask instanceof TracTask) {
- task = (TracTask) existingTask;
- } else {
- task = new TracTask(repositoryUrl, taskId, getTicketDescription(ticket));
- task.setCreationDate(new Date());
- taskList.addTask(task);
- }
- return task;
- }
+// public TracTask createTask(TracTicket ticket, String repositoryUrl, String taskId) {
+// TracTask task;
+// // String handleIdentifier =
+// // AbstractRepositoryTask.getHandle(repositoryUrl, taskId);
+// ITask existingTask = taskList.getTask(repositoryUrl, taskId);
+// if (existingTask instanceof TracTask) {
+// task = (TracTask) existingTask;
+// } else {
+// task = new TracTask(repositoryUrl, taskId, getTicketDescription(ticket));
+// task.setCreationDate(new Date());
+// taskList.addTask(task);
+// }
+// return task;
+// }
/**
* Updates fields of <code>task</code> from <code>ticket</code>.
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryQuery.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryQuery.java
index 58816abfe..de5358d1f 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryQuery.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryQuery.java
@@ -13,15 +13,14 @@ package org.eclipse.mylar.internal.trac.core;
import org.eclipse.mylar.internal.trac.core.model.TracSearch;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
-import org.eclipse.mylar.tasks.core.TaskList;
/**
* @author Steffen Pingel
*/
public class TracRepositoryQuery extends AbstractRepositoryQuery {
- public TracRepositoryQuery(String repositoryUrl, String queryUrl, String description, TaskList taskList) {
- super(description, taskList);
+ public TracRepositoryQuery(String repositoryUrl, String queryUrl, String description) {
+ super(description);
assert queryUrl.startsWith(repositoryUrl + ITracClient.QUERY_URL);
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/RepositorySearchQueryTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/RepositorySearchQueryTest.java
index 77b927acd..b75c45fd0 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/RepositorySearchQueryTest.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/RepositorySearchQueryTest.java
@@ -76,7 +76,7 @@ public class RepositorySearchQueryTest extends TestCase {
TracSearch search = new TracSearch();
String queryUrl = repository.getUrl() + ITracClient.QUERY_URL + search.toUrl();
- TracRepositoryQuery query = new TracRepositoryQuery(repository.getUrl(), queryUrl, "description", null);
+ TracRepositoryQuery query = new TracRepositoryQuery(repository.getUrl(), queryUrl, "description");
SearchHitCollector collector = new SearchHitCollector(TasksUiPlugin.getTaskListManager()
.getTaskList(), repository, query, new TaskFactory(repository));
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracQueryTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracQueryTest.java
index a17f63605..bdef3840d 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracQueryTest.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracQueryTest.java
@@ -24,7 +24,7 @@ public class TracQueryTest extends TestCase {
private TracRepositoryQuery createQuery(String parameter) {
String url = "http://oss.steffenpingel.de/mylar-trac-connector";
- return new TracRepositoryQuery(url, url + ITracClient.QUERY_URL + parameter, "description", null);
+ return new TracRepositoryQuery(url, url + ITracClient.QUERY_URL + parameter, "description");
}
public void testGetTracSearch() {
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java
index 0379d5e79..b05d1da08 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java
@@ -47,7 +47,6 @@ import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.QueryHitCollector;
import org.eclipse.mylar.tasks.core.RepositoryTaskData;
import org.eclipse.mylar.tasks.core.Task;
-import org.eclipse.mylar.tasks.core.TaskList;
import org.eclipse.mylar.tasks.core.TaskRepository;
import org.eclipse.mylar.tasks.core.TaskRepositoryManager;
import org.eclipse.mylar.tasks.ui.TaskFactory;
@@ -70,8 +69,6 @@ public class TracRepositoryConnectorTest extends TestCase {
private TracRepositoryConnector connector;
- private TaskList tasklist;
-
@Override
protected void setUp() throws Exception {
super.setUp();
@@ -79,8 +76,6 @@ public class TracRepositoryConnectorTest extends TestCase {
manager = TasksUiPlugin.getRepositoryManager();
manager.clearRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
- tasklist = TasksUiPlugin.getTaskListManager().getTaskList();
-
data = TestFixture.init010();
}
@@ -212,7 +207,7 @@ public class TracRepositoryConnectorTest extends TestCase {
search.setOrderBy("id");
String queryUrl = url + ITracClient.QUERY_URL + search.toUrl();
- TracRepositoryQuery query = new TracRepositoryQuery(url, queryUrl, "description", tasklist);
+ TracRepositoryQuery query = new TracRepositoryQuery(url, queryUrl, "description");
//MultiStatus queryStatus = new MultiStatus(TracUiPlugin.PLUGIN_ID, IStatus.OK, "Query result", null);
final List<RepositoryTaskData> result = new ArrayList<RepositoryTaskData>();
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryQueryTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryQueryTest.java
index 346625c3e..4a41c39b8 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryQueryTest.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryQueryTest.java
@@ -40,7 +40,7 @@ public class TracRepositoryQueryTest extends TestCase {
TracSearch search = new TracSearch();
String queryUrl = repository.getUrl() + ITracClient.QUERY_URL + search.toUrl();
- TracRepositoryQuery query = new TracRepositoryQuery(repository.getUrl(), queryUrl, "description", TasksUiPlugin.getTaskListManager().getTaskList());
+ TracRepositoryQuery query = new TracRepositoryQuery(repository.getUrl(), queryUrl, "description");
TasksUiPlugin.getTaskListManager().getTaskList().addQuery(query);
TracTask task = new TracTask(Constants.TEST_TRAC_096_URL, ""+123, "desc");
@@ -60,7 +60,7 @@ public class TracRepositoryQueryTest extends TestCase {
String repositoryUrl = "https://foo.bar/repo";
String parameterUrl = "&status=new&status=assigned&status=reopened&milestone=0.1";
String queryUrl = repositoryUrl + ITracClient.QUERY_URL + parameterUrl;
- TracRepositoryQuery query = new TracRepositoryQuery(repositoryUrl, queryUrl, "description", TasksUiPlugin.getTaskListManager().getTaskList());
+ TracRepositoryQuery query = new TracRepositoryQuery(repositoryUrl, queryUrl, "description");
TracSearch filterList = query.getTracSearch();
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracTaskExternalizer.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracTaskExternalizer.java
index a12131db1..1a163e309 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracTaskExternalizer.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracTaskExternalizer.java
@@ -152,7 +152,7 @@ public class TracTaskExternalizer extends DelegatingTaskExternalizer {
throw new TaskExternalizationException("Description not stored for task");
}
- return new TracRepositoryQuery(repositoryUrl, queryUrl, label, taskList);
+ return new TracRepositoryQuery(repositoryUrl, queryUrl, label);
}
// @Override
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/NewTracTaskEditor.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/NewTracTaskEditor.java
index 415d355ab..a8db97542 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/NewTracTaskEditor.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/NewTracTaskEditor.java
@@ -43,8 +43,7 @@ public class NewTracTaskEditor extends AbstractNewRepositoryTaskEditor {
sb.append(ITracClient.QUERY_URL);
sb.append(search.toUrl());
- TracRepositoryQuery query = new TracRepositoryQuery(repository.getUrl(), sb.toString(), "<Duplicate Search>",
- TasksUiPlugin.getTaskListManager().getTaskList());
+ TracRepositoryQuery query = new TracRepositoryQuery(repository.getUrl(), sb.toString(), "<Duplicate Search>");
SearchHitCollector collector = new SearchHitCollector(TasksUiPlugin.getTaskListManager().getTaskList(),
repository, query, new TaskFactory(repository));
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracCustomQueryPage.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracCustomQueryPage.java
index ef3d797fd..842b859b0 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracCustomQueryPage.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracCustomQueryPage.java
@@ -466,8 +466,7 @@ public class TracCustomQueryPage extends AbstractRepositoryQueryPage {
@Override
public TracRepositoryQuery getQuery() {
- return new TracRepositoryQuery(repository.getUrl(), getQueryUrl(repository.getUrl()), getTitleText(),
- TasksUiPlugin.getTaskListManager().getTaskList());
+ return new TracRepositoryQuery(repository.getUrl(), getQueryUrl(repository.getUrl()), getTitleText());
}
private String getTitleText() {
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryWizardPage.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryWizardPage.java
index 6c36149d3..c2a2597bc 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryWizardPage.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryWizardPage.java
@@ -25,7 +25,6 @@ import org.eclipse.mylar.internal.trac.core.model.TracSearchFilter;
import org.eclipse.mylar.internal.trac.core.model.TracSearchFilter.CompareOperator;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.TaskRepository;
-import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.KeyEvent;
@@ -231,8 +230,7 @@ public class TracQueryWizardPage extends WizardPage {
}
public TracRepositoryQuery getQuery() {
- return new TracRepositoryQuery(repository.getUrl(), getQueryUrl(repository.getUrl()), titleText.getText(),
- TasksUiPlugin.getTaskListManager().getTaskList());
+ return new TracRepositoryQuery(repository.getUrl(), getQueryUrl(repository.getUrl()), titleText.getText());
}
private void hideSearchField(SearchField field) {

Back to the top