Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java4
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java154
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaQueryHit.java53
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java63
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTask.java8
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryQueryResultsFactory.java26
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxBugzillaQueryContentHandler.java116
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java14
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java7
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java156
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaSearchEngineTest.java18
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskListNotificationManagerTest.java48
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskReportGeneratorTest.java3
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/headless/BugzillaQueryTest.java11
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/test-attach-1181009324093.txt1
-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/tasklist/BugzillaTaskExternalizer.java47
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java6
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WebQueryHit.java54
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractQueryHit.java2
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java6
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryQuery.java80
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryTask.java2
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java15
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java139
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskFactory.java25
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListExternalizer.java10
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/QueryHitCollector.java59
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskList.java131
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/RepositorySettingsPageTest.java10
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java145
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockQueryHit.java30
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryConnector.java15
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryExternalizer.java9
-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/PlanningPerspectiveFactory.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java17
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskCompletionFilter.java15
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskLabelDecorator.java10
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListNotificationQueryIncoming.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskPriorityFilter.java10
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskStatusMenuContributor.java3
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractRepositoryTasksAction.java26
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ActivateTaskDialogAction.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ClearOutgoingAction.java20
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyTaskDetailsAction.java19
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteAction.java22
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/MarkTaskCompleteAction.java25
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/MarkTaskIncompleteAction.java19
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskAction.java15
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenWithBrowserAction.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeSelectedAction.java16
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskSelectionDialog.java15
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/planner/TaskActivityWizardPage.java7
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/planner/TaskReportGenerator.java5
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/OpenSearchResultAction.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java20
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterDescription.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterId.java12
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterPriority.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java35
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskElementLabelProvider.java72
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java16
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java53
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java22
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListTableSorter.java14
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTipHandler.java123
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java86
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java3
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/OpenRepositoryTaskJob.java1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/RepositorySynchronizationManager.java11
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeQueryJob.java160
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskFactory.java71
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskListManager.java11
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java5
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java43
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java80
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/search/AbstractRepositoryQueryPage.java27
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/search/SearchHitCollector.java39
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java52
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracQueryHit.java43
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java17
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/AllTracTests.java1
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/RepositorySearchQueryTest.java18
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracQueryHitTest.java38
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java24
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracTaskExternalizer.java49
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/NewTracTaskEditor.java3
91 files changed, 1234 insertions, 1695 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java
index 1d38274b3..d0ba127db 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java
@@ -57,7 +57,7 @@ public class AbstractReportFactory {
}
final BufferedInputStream is = new BufferedInputStream(inStream, 1024);
-
+
// Remove control characters other than \\n and \\r
InputStream iis = new InputStream() {
public int read() throws IOException {
@@ -70,7 +70,7 @@ public class AbstractReportFactory {
return -1;
}
};
-
+
Reader in;
if (characterEncoding != null) {
in = new InputStreamReader(iis, characterEncoding);
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 3c17f1a3f..2536a6147 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
@@ -21,6 +21,7 @@ import java.nio.charset.Charset;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
@@ -64,7 +65,6 @@ import org.eclipse.mylar.tasks.core.RepositoryStatus;
import org.eclipse.mylar.tasks.core.RepositoryTaskAttribute;
import org.eclipse.mylar.tasks.core.RepositoryTaskData;
import org.eclipse.mylar.tasks.core.Task;
-import org.eclipse.mylar.tasks.core.TaskList;
/**
* @author Mik Kersten
@@ -73,6 +73,8 @@ import org.eclipse.mylar.tasks.core.TaskList;
*/
public class BugzillaClient {
+ private static final int MAX_RETRIEVED_PER_QUERY = 100;
+
private static final String QUERY_DELIMITER = "?";
private static final String KEY_ID = "id";
@@ -436,8 +438,53 @@ public class BugzillaClient {
// }
// }
- public void getSearchHits(AbstractRepositoryQuery query, QueryHitCollector collector, TaskList taskList)
- throws IOException, CoreException {
+// public void getSearchHits(AbstractRepositoryQuery query, QueryHitCollector
+// collector, TaskList taskList)
+// throws IOException, CoreException {
+// GetMethod method = null;
+// try {
+// String queryUrl = query.getUrl();
+// // Test that we don't specify content type twice.
+// // Should only be specified here (not in passed in url if possible)
+// if (!queryUrl.contains("ctype=rdf")) {
+// queryUrl = queryUrl.concat(IBugzillaConstants.CONTENT_TYPE_RDF);
+// }
+//
+// method = getConnect(queryUrl);
+// if (method.getResponseHeader("Content-Type") != null) {
+// Header responseTypeHeader = method.getResponseHeader("Content-Type");
+// for (String type : VALID_CONFIG_CONTENT_TYPES) {
+// if (responseTypeHeader.getValue().toLowerCase(Locale.ENGLISH).contains(type))
+// {
+// RepositoryQueryResultsFactory queryFactory = new
+// RepositoryQueryResultsFactory(method
+// .getResponseBodyAsStream(), characterEncoding);
+// queryFactory.performQuery(taskList, repositoryUrl.toString(), collector,
+// QueryHitCollector.MAX_HITS);
+//
+//
+//
+//
+// //getTaskData(queryFactory.get)
+// // pass t
+//
+// return;
+// }
+// }
+// }
+// parseHtmlError(new BufferedReader(
+// new InputStreamReader(method.getResponseBodyAsStream(), characterEncoding)));
+// } finally {
+// if (method != null) {
+// method.releaseConnection();
+// }
+// }
+// }
+
+ /**
+ * Returns ids of bugs that match given query
+ */
+ public Set<String> getSearchHits(AbstractRepositoryQuery query) throws IOException, CoreException {
GetMethod method = null;
try {
String queryUrl = query.getUrl();
@@ -454,9 +501,9 @@ public class BugzillaClient {
if (responseTypeHeader.getValue().toLowerCase(Locale.ENGLISH).contains(type)) {
RepositoryQueryResultsFactory queryFactory = new RepositoryQueryResultsFactory(method
.getResponseBodyAsStream(), characterEncoding);
- queryFactory.performQuery(taskList, repositoryUrl.toString(), collector,
- QueryHitCollector.MAX_HITS);
- return;
+ queryFactory.performQuery(repositoryUrl.toString(), QueryHitCollector.MAX_HITS);
+
+ return queryFactory.getHits();
}
}
}
@@ -467,6 +514,7 @@ public class BugzillaClient {
method.releaseConnection();
}
}
+ return new HashSet<String>();
}
public static void setupExistingBugAttributes(String serverUrl, RepositoryTaskData existingReport) {
@@ -574,8 +622,12 @@ 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));
- parts.add(new StringPart(IBugzillaConstants.POST_INPUT_BUGZILLA_LOGIN, username, characterEncoding));
- parts.add(new StringPart(IBugzillaConstants.POST_INPUT_BUGZILLA_PASSWORD, password, 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_BUGID, bugReportID, characterEncoding));
parts.add(new StringPart(IBugzillaConstants.POST_INPUT_DESCRIPTION, attachment.getDescription(), characterEncoding));
parts.add(new StringPart(IBugzillaConstants.POST_INPUT_COMMENT, comment, characterEncoding));
@@ -941,8 +993,9 @@ public class BugzillaClient {
}
}
- throw new CoreException(RepositoryStatus.createHtmlStatus(repositoryUrl.toString(), IStatus.INFO, BugzillaCorePlugin.PLUGIN_ID,
- IMylarStatusConstants.REPOSITORY_ERROR, "A repository error has occurred.", body));
+ throw new CoreException(RepositoryStatus.createHtmlStatus(repositoryUrl.toString(), IStatus.INFO,
+ BugzillaCorePlugin.PLUGIN_ID, IMylarStatusConstants.REPOSITORY_ERROR,
+ "A repository error has occurred.", body));
} catch (ParseException e) {
authenticated = false;
@@ -990,45 +1043,66 @@ public class BugzillaClient {
}
public Map<String, RepositoryTaskData> getTaskData(Set<String> taskIds) throws IOException, CoreException {
- GetMethod method = null;
- try {
+ PostMethod method = null;
+ HashMap<String, RepositoryTaskData> taskDataMap = new HashMap<String, RepositoryTaskData>();
+ while (taskIds.size() > 0) {
- // TODO: Handle too long of url (IBugzillaConstants.MAX_URL_LENGTH)
+ try {
- String requestUrl = repositoryUrl + IBugzillaConstants.URL_GET_SHOW_BUG_XML_NOID;
+ Set<String> idsToRetrieve = new HashSet<String>();
+ Iterator<String> itr = taskIds.iterator();
+ for (int x = 0; itr.hasNext() && x < MAX_RETRIEVED_PER_QUERY; x++) {
+ idsToRetrieve.add(itr.next());
+ }
- HashMap<String, RepositoryTaskData> taskDataMap = new HashMap<String, RepositoryTaskData>();
- RepositoryTaskData taskData = null;
- for (String taskId : taskIds) {
- requestUrl += "&id=" + taskId;
- taskData = new RepositoryTaskData(new BugzillaAttributeFactory(), BugzillaCorePlugin.REPOSITORY_KIND,
- repositoryUrl.toString(), taskId, Task.DEFAULT_TASK_KIND);
- setupExistingBugAttributes(repositoryUrl.toString(), taskData);
- taskDataMap.put(taskId, taskData);
- }
+ NameValuePair[] formData = new NameValuePair[idsToRetrieve.size() + 2];
+
+ if (idsToRetrieve.size() == 0)
+ return taskDataMap;
+
+ itr = idsToRetrieve.iterator();
+ int x = 0;
+ for (; itr.hasNext(); x++) {
+ String taskId = itr.next();
+ formData[x] = new NameValuePair("id", taskId);
+ RepositoryTaskData taskData = new RepositoryTaskData(new BugzillaAttributeFactory(),
+ BugzillaCorePlugin.REPOSITORY_KIND, repositoryUrl.toString(), taskId,
+ Task.DEFAULT_TASK_KIND);
+ setupExistingBugAttributes(repositoryUrl.toString(), taskData);
+ taskDataMap.put(taskId, taskData);
+ }
+ formData[x++] = new NameValuePair("ctype", "xml");
+ formData[x] = new NameValuePair("excludefield", "attachmentdata");
- method = getConnect(requestUrl);
- if (method.getResponseHeader("Content-Type") != null) {
- Header responseTypeHeader = method.getResponseHeader("Content-Type");
- for (String type : VALID_CONFIG_CONTENT_TYPES) {
- if (responseTypeHeader.getValue().toLowerCase(Locale.ENGLISH).contains(type)) {
- MultiBugReportFactory factory = new MultiBugReportFactory(method.getResponseBodyAsStream(),
- characterEncoding);
- factory.populateReport(taskDataMap);
- return taskDataMap;
- }
+ method = postFormData(IBugzillaConstants.URL_POST_SHOW_BUG, formData);
+
+ if (method == null) {
+ throw new IOException("Could not post form, client returned null method.");
}
- }
- parseHtmlError(new BufferedReader(
- new InputStreamReader(method.getResponseBodyAsStream(), characterEncoding)));
+ if (method.getResponseHeader("Content-Type") != null) {
+ Header responseTypeHeader = method.getResponseHeader("Content-Type");
+ for (String type : VALID_CONFIG_CONTENT_TYPES) {
+ if (responseTypeHeader.getValue().toLowerCase(Locale.ENGLISH).contains(type)) {
+ MultiBugReportFactory factory = new MultiBugReportFactory(method.getResponseBodyAsStream(),
+ characterEncoding);
+ factory.populateReport(taskDataMap);
+ taskIds.removeAll(idsToRetrieve);
+ }
+ }
+ } else {
- return null;
- } finally {
- if (method != null) {
- method.releaseConnection();
+ parseHtmlError(new BufferedReader(new InputStreamReader(method.getResponseBodyAsStream(),
+ characterEncoding)));
+ }
+ } finally {
+ if (method != null) {
+ method.releaseConnection();
+ }
}
}
+
+ return taskDataMap;
}
}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaQueryHit.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaQueryHit.java
deleted file mode 100644
index 1ef48ff7e..000000000
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaQueryHit.java
+++ /dev/null
@@ -1,53 +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.internal.bugzilla.core;
-
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
-import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
-import org.eclipse.mylar.tasks.core.TaskList;
-
-/**
- * @author Ken Sueda
- * @author Mik Kersten (hardening of prototype)
- */
-public class BugzillaQueryHit extends AbstractQueryHit {
-
- private String status;
-
- public BugzillaQueryHit(TaskList taskList, String description, String priority, String repositoryUrl, String id,
- BugzillaTask task, String status) {
- super(taskList, repositoryUrl, description, id);
- super.priority = priority;
- this.task = task;
- this.status = status;
- }
-
- @Override
- protected AbstractRepositoryTask createTask() {
- return new BugzillaTask(this, true);
- }
-
- @Override
- public String getUrl() {
- return BugzillaClient.getBugUrlWithoutLogin(repositoryUrl, taskId);
- }
-
- @Override
- public boolean isCompleted() {
- if (status != null
- && (status.startsWith("RESO") || status.startsWith("CLO") || status.startsWith("VERI") || status
- .startsWith("FIXED"))) {
- return true;
- }
- return false;
- }
-}
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 4a40730ed..bb1234e07 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
@@ -22,6 +22,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
+import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.CoreException;
@@ -30,13 +31,13 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.mylar.core.MylarStatusHandler;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
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.ITaskFactory;
import org.eclipse.mylar.tasks.core.QueryHitCollector;
import org.eclipse.mylar.tasks.core.RepositoryTaskAttribute;
import org.eclipse.mylar.tasks.core.RepositoryTaskData;
@@ -98,7 +99,7 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
return BugzillaCorePlugin.REPOSITORY_KIND;
}
- protected AbstractRepositoryTask makeTask(String repositoryUrl, String id, String summary) {
+ public AbstractRepositoryTask createTask(String repositoryUrl, String id, String summary) {
return new BugzillaTask(repositoryUrl, id, summary, true);
}
@@ -219,8 +220,7 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
}
}
-
-
+
// TODO: Move to ITaskDataHandler
private List<String> getSubTaskIds(RepositoryTaskData taskData) {
ArrayList<String> result = new ArrayList<String>();
@@ -232,7 +232,7 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
}
}
return result;
-
+
}
@Override
@@ -284,20 +284,26 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
}
}
- private void queryForChanged(TaskRepository repository, Set<AbstractRepositoryTask> changedTasks,
+ private void queryForChanged(final TaskRepository repository, Set<AbstractRepositoryTask> changedTasks,
String urlQueryString) throws UnsupportedEncodingException, CoreException {
- QueryHitCollector collector = new QueryHitCollector(taskList);
+ QueryHitCollector collector = new QueryHitCollector(taskList, new ITaskFactory() {
+
+ public AbstractRepositoryTask createTask(RepositoryTaskData taskData, boolean synchData, boolean forced) {
+ // do not construct actual task objects here as query shouldn't result in new tasks
+ return taskList.getTask(taskData.getRepositoryUrl(), taskData.getId());
+ }
+ });
+
BugzillaRepositoryQuery query = new BugzillaRepositoryQuery(repository.getUrl(), urlQueryString, "", taskList);
- performQuery(query, repository, new NullProgressMonitor(), collector);
+ performQuery(query, repository, new NullProgressMonitor(), collector, false);
- for (AbstractQueryHit hit : collector.getHits()) {
+ for (ITask taskHit : collector.getTaskHits()) {
// String handle =
// AbstractRepositoryTask.getHandle(repository.getUrl(),
// hit.getId());
- ITask correspondingTask = taskList.getTask(repository.getUrl(), hit.getTaskId());
- if (correspondingTask != null && correspondingTask instanceof AbstractRepositoryTask) {
- AbstractRepositoryTask repositoryTask = (AbstractRepositoryTask) correspondingTask;
+ if (taskHit != null && taskHit instanceof AbstractRepositoryTask) {
+ AbstractRepositoryTask repositoryTask = (AbstractRepositoryTask) taskHit;
// Hack to avoid re-syncing last task from previous
// synchronization
// This can be removed once we are getting a query timestamp
@@ -339,19 +345,35 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
@Override
public IStatus performQuery(final AbstractRepositoryQuery query, TaskRepository repository,
- IProgressMonitor monitor, QueryHitCollector resultCollector) {
-
+ IProgressMonitor monitor, QueryHitCollector resultCollector, boolean forced) {
IStatus queryStatus = Status.OK_STATUS;
try {
BugzillaClient client = getClientManager().getClient(repository);
resultCollector.clear();
- client.getSearchHits(query, resultCollector, taskList);
- // XXX: HACK in case of ip change bugzilla can return 0 hits
- // due to invalid authorization token, forcing relogin fixes
- if (resultCollector.getHits().size() == 0) {
+ Set<String> ids = client.getSearchHits(query);
+ if (ids.size() == 0) {
+ // XXX: HACK in case of ip change bugzilla can return 0 hits
+ // due to invalid authorization token, forcing relogin fixes
client.logout();
- client.getSearchHits(query, resultCollector, taskList);
+ ids = client.getSearchHits(query);
}
+
+ if (!forced) {
+ // Only retrieve data for hits we don't already have
+ for (ITask existingTask : query.getChildren()) {
+ AbstractRepositoryTask repositoryTask = (AbstractRepositoryTask) existingTask;
+ if (ids.contains(repositoryTask.getTaskId())) {
+ resultCollector.accept(repositoryTask);
+ ids.remove(repositoryTask.getTaskId());
+ }
+ }
+ }
+
+ Map<String, RepositoryTaskData> hits = client.getTaskData(ids);
+ for (RepositoryTaskData data : hits.values()) {
+ resultCollector.accept(data);
+ }
+
} catch (UnrecognizedReponseException e) {
queryStatus = new Status(IStatus.ERROR, BugzillaCorePlugin.PLUGIN_ID, Status.INFO,
"Unrecognized response from server", e);
@@ -394,7 +416,8 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
}
@Override
- public void updateTaskFromRepository(TaskRepository repository, AbstractRepositoryTask repositoryTask, IProgressMonitor monitor) {
+ public void updateTaskFromRepository(TaskRepository repository, AbstractRepositoryTask repositoryTask,
+ IProgressMonitor monitor) {
// ignore
}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTask.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTask.java
index cc5a7fc64..2c9ae30c4 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTask.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTask.java
@@ -33,10 +33,10 @@ public class BugzillaTask extends AbstractRepositoryTask {
setTaskUrl(BugzillaClient.getBugUrlWithoutLogin(repositoryUrl, id));
}
- public BugzillaTask(BugzillaQueryHit hit, boolean newTask) {
- this(hit.getRepositoryUrl(), hit.getTaskId(), hit.getSummary(), newTask);
- setPriority(hit.getPriority());
- }
+// public BugzillaTask(BugzillaQueryHit hit, boolean newTask) {
+// this(hit.getRepositoryUrl(), hit.getTaskId(), hit.getSummary(), newTask);
+// setPriority(hit.getPriority());
+// }
@Override
public String getTaskKind() {
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
index b80fac253..510829043 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
@@ -85,6 +85,8 @@ public interface IBugzillaConstants {
public static final String URL_GET_SHOW_BUG_XML_NOID = "/show_bug.cgi?ctype=xml&excludefield=attachmentdata";
+ public static final String URL_POST_SHOW_BUG = "/show_bug.cgi";
+
public static final String XML_ERROR_INVALIDBUGID = "invalidbugid";
public static final String XML_ERROR_NOTFOUND = "notfound";
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryQueryResultsFactory.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryQueryResultsFactory.java
index 72fcd83a0..43e0f9dec 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryQueryResultsFactory.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryQueryResultsFactory.java
@@ -14,26 +14,32 @@ package org.eclipse.mylar.internal.bugzilla.core;
import java.io.IOException;
import java.io.InputStream;
import java.security.GeneralSecurityException;
-
-import org.eclipse.mylar.tasks.core.QueryHitCollector;
-import org.eclipse.mylar.tasks.core.TaskList;
-
+import java.util.HashSet;
+import java.util.Set;
/**
* @author Rob Elves
*/
public class RepositoryQueryResultsFactory extends AbstractReportFactory {
+ Set<String> hits = new HashSet<String>();
+
public RepositoryQueryResultsFactory(InputStream inStream, String encoding) {
super(inStream, encoding);
}
- /** expects rdf returned from repository (ctype=rdf in url)
- * @throws GeneralSecurityException */
- public void performQuery(TaskList taskList, String repositoryUrl, QueryHitCollector collector, int maxHits) throws IOException {
-
- SaxBugzillaQueryContentHandler contentHandler = new SaxBugzillaQueryContentHandler(taskList, repositoryUrl,
- collector, maxHits);
+ /**
+ * expects rdf returned from repository (ctype=rdf in url)
+ *
+ * @throws GeneralSecurityException
+ */
+ public void performQuery(String repositoryUrl, int maxHits) throws IOException {
+
+ SaxBugzillaQueryContentHandler contentHandler = new SaxBugzillaQueryContentHandler(repositoryUrl, hits, maxHits);
collectResults(contentHandler, false);
}
+
+ public Set<String> getHits() {
+ return hits;
+ }
}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxBugzillaQueryContentHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxBugzillaQueryContentHandler.java
index 49f9cdb7f..86d82362b 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxBugzillaQueryContentHandler.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxBugzillaQueryContentHandler.java
@@ -12,11 +12,9 @@
package org.eclipse.mylar.internal.bugzilla.core;
import java.util.Locale;
+import java.util.Set;
import org.eclipse.mylar.core.net.HtmlStreamTokenizer;
-import org.eclipse.mylar.tasks.core.QueryHitCollector;
-import org.eclipse.mylar.tasks.core.Task;
-import org.eclipse.mylar.tasks.core.TaskList;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
@@ -31,34 +29,29 @@ public class SaxBugzillaQueryContentHandler extends DefaultHandler {
/** The bug id */
private String id;
- /** The summary of the bug */
- private String description = "";
-
- /** The priority of the bug */
- private String priority = Task.PriorityLevel.getDefault().toString();
-
- /** The state of the bug */
- private String state = "";
+// /** The summary of the bug */
+// private String description = "";
+//
+// /** The priority of the bug */
+// private String priority = Task.PriorityLevel.getDefault().toString();
+//
+// /** The state of the bug */
+// private String state = "";
private StringBuffer characters;
- private QueryHitCollector collector;
-
- private String repositoryUrl;
+// private String repositoryUrl;
- private BugzillaQueryHit hit;
-
- private TaskList taskList;
+ private Set<String> bugIds;
private int maxHits = 100;
private int numCollected = 0;
- public SaxBugzillaQueryContentHandler(TaskList tasklist, String repositoryUrl, QueryHitCollector col, int maxHits) {
- this.taskList = tasklist;
- this.repositoryUrl = repositoryUrl;
- collector = col;
+ public SaxBugzillaQueryContentHandler(String repositoryUrl, Set<String> hits, int maxHits) {
+ //this.repositoryUrl = repositoryUrl;
this.maxHits = maxHits;
+ this.bugIds = hits;
}
@Override
@@ -74,9 +67,9 @@ public class SaxBugzillaQueryContentHandler extends DefaultHandler {
tag = BugzillaReportElement.valueOf(localName.trim().toUpperCase(Locale.ENGLISH));
switch (tag) {
case LI:
-// hit = new BugzillaQueryHit();
-// hit.setRepository(repositoryUrl);
-// break;
+// hit = new BugzillaQueryHit();
+// hit.setRepository(repositoryUrl);
+// break;
}
} catch (RuntimeException e) {
if (e instanceof IllegalArgumentException) {
@@ -90,48 +83,55 @@ public class SaxBugzillaQueryContentHandler extends DefaultHandler {
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
-
+
String parsedText = HtmlStreamTokenizer.unescape(characters.toString());
-
+
BugzillaReportElement tag = BugzillaReportElement.UNKNOWN;
try {
tag = BugzillaReportElement.valueOf(localName.trim().toUpperCase(Locale.ENGLISH));
switch (tag) {
case ID:
id = parsedText;
+ if (numCollected < maxHits || maxHits == IBugzillaConstants.RETURN_ALL_HITS) {
+ //System.err.println(">>> "+id);
+ bugIds.add(id);
+ numCollected++;
+ }
break;
-// case BUG_SEVERITY:
-// severity = parsedText;
-// break;
- case PRIORITY:
- priority = parsedText;
- break;
-// case REP_PLATFORM:
-// platform = parsedText;
-// break;
- case ASSIGNED_TO:
- //hit.setOwner(parsedText);
- break;
- case BUG_STATUS:
- state = parsedText;
- break;
-// case RESOLUTION:
-// resolution = parsedText;
-// break;
- case SHORT_DESC:
- description = parsedText;
- break;
- case SHORT_SHORT_DESC:
- description = parsedText;
- break;
- case LI:
- if (numCollected < maxHits || maxHits == IBugzillaConstants.RETURN_ALL_HITS) {
- hit = new BugzillaQueryHit(taskList, description, priority, repositoryUrl, id, null, state);
- collector.accept(hit);
- numCollected++;
- } else {
- break;
- }
+// // case BUG_SEVERITY:
+// // severity = parsedText;
+// // break;
+// case PRIORITY:
+// priority = parsedText;
+// break;
+// // case REP_PLATFORM:
+// // platform = parsedText;
+// // break;
+// case ASSIGNED_TO:
+// //hit.setOwner(parsedText);
+// break;
+// case BUG_STATUS:
+// state = parsedText;
+// break;
+// // case RESOLUTION:
+// // resolution = parsedText;
+// // break;
+// case SHORT_DESC:
+// description = parsedText;
+// break;
+// case SHORT_SHORT_DESC:
+// description = parsedText;
+// break;
+// case LI:
+// if (numCollected < maxHits || maxHits == IBugzillaConstants.RETURN_ALL_HITS)
+// {
+// hit = new BugzillaQueryHit(taskList, description, priority, repositoryUrl,
+// id, null, state);
+// collector.accept(hit);
+// numCollected++;
+// } else {
+// break;
+// }
}
} catch (RuntimeException e) {
if (e instanceof IllegalArgumentException) {
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java
index e79101a33..bfa6ad14e 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java
@@ -38,19 +38,21 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
private TaskComment taskComment;
- private final Map<String, TaskComment> attachIdToComment = new HashMap<String, TaskComment>();
+ private Map<String, TaskComment> attachIdToComment = new HashMap<String, TaskComment>();
private int commentNum = 0;
private RepositoryAttachment attachment;
- Map<String, RepositoryTaskData> taskDataMap;
+ private Map<String, RepositoryTaskData> taskDataMap;
private RepositoryTaskData repositoryTaskData;
private String errorMessage = null;
private AbstractAttributeFactory attributeFactory;
+
+ private int retrieved = 0;
public SaxMultiBugReportContentHandler(AbstractAttributeFactory factory, Map<String, RepositoryTaskData> taskDataMap) {
this.attributeFactory = factory;
@@ -98,6 +100,9 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
if (attributes != null && (attributes.getValue("error") != null)) {
errorMessage = attributes.getValue("error");
}
+ attachIdToComment = new HashMap<String, TaskComment>();
+ commentNum = 0;
+ taskComment = null;
break;
case LONG_DESC:
taskComment = new TaskComment(attributeFactory, commentNum++);
@@ -247,6 +252,7 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
attachment.setRepositoryUrl(repositoryTaskData.getRepositoryUrl());
attachment.setTaskId(repositoryTaskData.getId());
}
+ retrieved++;
break;
case BLOCKED:
@@ -297,4 +303,8 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
}
}
+ public int getNumRetrieved() {
+ return retrieved;
+ }
+
}
diff --git a/org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF b/org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF
index 34c19c6d8..930253e9e 100644
--- a/org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF
@@ -20,7 +20,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.mylar.context.core,
org.eclipse.mylar.tasks.core,
org.eclipse.ui.forms,
- org.eclipse.mylar
+ org.eclipse.mylar,
+ org.eclipse.search
Eclipse-AutoStart: true
Bundle-Vendor: Eclipse.org
Bundle-ClassPath: bugzilla-test.jar
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java
index 0ed59d695..88158386b 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java
@@ -25,11 +25,13 @@ import org.eclipse.mylar.internal.bugzilla.core.BugzillaTask;
import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
+import org.eclipse.mylar.tasks.core.ITaskFactory;
import org.eclipse.mylar.tasks.core.RepositoryTaskData;
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.core.AbstractRepositoryTask.RepositoryTaskSyncState;
+import org.eclipse.mylar.tasks.ui.TaskFactory;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
/**
@@ -48,6 +50,8 @@ public abstract class AbstractBugzillaTest extends TestCase {
protected TaskRepository repository;
protected TaskList taskList;
+
+ protected ITaskFactory taskFactory;
public AbstractBugzillaTest() {
super();
@@ -57,6 +61,7 @@ public abstract class AbstractBugzillaTest extends TestCase {
protected void setUp() throws Exception {
super.setUp();
manager = TasksUiPlugin.getRepositoryManager();
+ TasksUiPlugin.getTaskListManager().getTaskList().reset();
manager.clearRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
}
@@ -99,6 +104,8 @@ public abstract class AbstractBugzillaTest extends TestCase {
assertEquals(abstractRepositoryClient.getRepositoryType(), DEFAULT_KIND);
connector = (BugzillaRepositoryConnector) abstractRepositoryClient;
+
+ taskFactory = new TaskFactory(repository);
// connector.setForceSynchExecForTesting(true);
TasksUiPlugin.getSynchronizationManager().setForceSyncExec(true);
}
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 0952ef045..e6ee56a95 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
@@ -25,22 +25,20 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.mylar.context.core.ContextCorePlugin;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaClient;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaCorePlugin;
-import org.eclipse.mylar.internal.bugzilla.core.BugzillaQueryHit;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaReportElement;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryQuery;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaTask;
import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants;
import org.eclipse.mylar.internal.bugzilla.core.RepositoryConfiguration;
import org.eclipse.mylar.internal.tasks.core.RepositoryTaskHandleUtil;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
-import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.LocalAttachment;
import org.eclipse.mylar.tasks.core.RepositoryAttachment;
import org.eclipse.mylar.tasks.core.RepositoryTaskAttribute;
import org.eclipse.mylar.tasks.core.RepositoryTaskData;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask.RepositoryTaskSyncState;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
+import org.eclipse.mylar.tasks.ui.search.RepositorySearchResult;
import org.eclipse.mylar.tasks.ui.search.SearchHitCollector;
/**
@@ -49,36 +47,33 @@ import org.eclipse.mylar.tasks.ui.search.SearchHitCollector;
* @author Nathan Hapke
*/
public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
-
-
-
-
+
public void testFocedQuerySynchronization() throws CoreException {
init222();
TasksUiPlugin.getSynchronizationManager().setForceSyncExec(true);
TasksUiPlugin.getDefault().getTaskDataManager().clear();
assertEquals(0, taskList.getAllTasks().size());
- 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",
+ 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);
taskList.addQuery(bugQuery);
-
+
TasksUiPlugin.getSynchronizationManager().synchronize(connector, bugQuery, null, false);
-
+
assertEquals(1, bugQuery.getHits().size());
- AbstractQueryHit hit = (AbstractQueryHit) bugQuery.getHits().toArray()[0];
+ AbstractRepositoryTask hit = (AbstractRepositoryTask) bugQuery.getHits().toArray()[0];
assertTrue(TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(hit.getHandleIdentifier()) != null);
TasksUiPlugin.getDefault().getTaskDataManager().remove(hit.getHandleIdentifier());
- assertTrue(hit.getCorrespondingTask() == null);
-
+
TasksUiPlugin.getSynchronizationManager().synchronize(connector, bugQuery, null, true);
assertEquals(1, bugQuery.getHits().size());
- hit = (AbstractQueryHit) bugQuery.getHits().toArray()[0];
+ hit = (AbstractRepositoryTask) bugQuery.getHits().toArray()[0];
assertTrue(TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(hit.getHandleIdentifier()) != null);
-
+
}
-
-
+
public void testCreateTaskFromExistingId() throws Exception {
init222();
try {
@@ -119,15 +114,16 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
BugzillaRepositoryQuery bugzillaQuery = new BugzillaRepositoryQuery(repository.getUrl(), queryUrl, "search",
taskList);
- SearchHitCollector collector = new SearchHitCollector(TasksUiPlugin.getTaskListManager().getTaskList(),
- repository, bugzillaQuery);
-
+ SearchHitCollector collector = new SearchHitCollector(taskList, repository, bugzillaQuery, taskFactory);
+ RepositorySearchResult result = (RepositorySearchResult)collector.getSearchResult();
+
+
// operation.run(new NullProgressMonitor());
// BugzillaSearchQuery searchQuery = new BugzillaSearchQuery(collector);
collector.run(new NullProgressMonitor());
- assertEquals(2, collector.getHits().size());
+ assertEquals(2, result.getElements().length);
- for (AbstractQueryHit hit : collector.getHits()) {
+ for (AbstractRepositoryTask hit : collector.getTaskHits()) {
assertTrue(hit.getSummary().contains("search-match-test"));
}
@@ -136,7 +132,7 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
assertNotNull(config);
assertTrue(config.getComponents().size() > 0);
}
-
+
public void testUpdate() throws Exception {
init222();
String taskNumber = "3";
@@ -148,7 +144,8 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
assertEquals("P1", task.getPriority());
assertEquals("blocker", task.getSeverity());
assertEquals("nhapke@cs.ubc.ca", task.getOwner());
- //assertEquals("2007-04-18 14:21:40", task.getCompletionDate().toString());
+ // assertEquals("2007-04-18 14:21:40",
+ // task.getCompletionDate().toString());
assertFalse(task.isCompleted());
assertEquals("http://mylar.eclipse.org/bugs222/show_bug.cgi?id=3", task.getTaskUrl());
}
@@ -162,7 +159,7 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
assertNotNull(task.getChildren());
assertEquals(2, task.getChildren().size());
}
-
+
public void testContextAttachFailure() throws Exception {
init218();
BugzillaTask task = this.generateLocalTaskAndDownload("3");
@@ -242,75 +239,30 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
}
- public void testUniqueTaskObjects() {
- init222();
- String repositoryURL = "repositoryURL";
- BugzillaQueryHit hit1 = new BugzillaQueryHit(taskList, "summary", "P1", repositoryURL, "1", null, "status");
- ITask task1 = hit1.getOrCreateCorrespondingTask();
- assertNotNull(task1);
- // taskList.renameTask(task1, "testing");
- // task1.setDescription("testing");
-
- BugzillaQueryHit hit1Twin = new BugzillaQueryHit(taskList, "summary", "P1", repositoryURL, "1", null, "status");
- ITask task2 = hit1Twin.getOrCreateCorrespondingTask();
- assertEquals(task1.getSummary(), task2.getSummary());
-
- }
-
public void testUniqueQueryHitObjects() {
init222();
BugzillaRepositoryQuery query1 = new BugzillaRepositoryQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL,
"queryurl", "description1", taskList);
- BugzillaQueryHit query1Hit = new BugzillaQueryHit(taskList, "description1", "P1",
- IBugzillaConstants.TEST_BUGZILLA_222_URL, "1", null, "status");
+ BugzillaTask query1Hit = new BugzillaTask(IBugzillaConstants.TEST_BUGZILLA_222_URL, "1", "description1", true);
query1.addHit(query1Hit);
taskList.addQuery(query1);
BugzillaRepositoryQuery query2 = new BugzillaRepositoryQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL,
"queryurl2", "description2", taskList);
- BugzillaQueryHit query2Hit = new BugzillaQueryHit(taskList, "description2", "P1",
- IBugzillaConstants.TEST_BUGZILLA_222_URL, "1", null, "status");
+ BugzillaTask query2Hit = new BugzillaTask(IBugzillaConstants.TEST_BUGZILLA_222_URL, "1", "description2", true);
query2.addHit(query2Hit);
taskList.addQuery(query2);
assertEquals(2, taskList.getQueries().size());
- assertEquals(1, taskList.getQueryHits().size());
- for (AbstractQueryHit hit : query1.getHits()) {
- for (AbstractQueryHit hit2 : query2.getHits()) {
+ assertEquals(1, taskList.getAllTasks().size());
+ for (AbstractRepositoryTask hit : query1.getHits()) {
+ for (AbstractRepositoryTask hit2 : query2.getHits()) {
assertTrue(hit.getClass().equals(hit2.getClass()));
}
}
taskList.deleteQuery(query1);
taskList.deleteQuery(query2);
- assertEquals(1, taskList.getQueryHits().size());
- taskList.removeOrphanedHits();
- assertEquals(0, taskList.getQueryHits().size());
-
- // List<AbstractQueryHit> hitsForHandle = new
- // ArrayList<AbstractQueryHit>();
- // for (AbstractRepositoryQuery query : taskList.getQueries()) {
- // AbstractQueryHit foundHit =
- // query.findQueryHit(AbstractRepositoryTask.getHandle(
- // IBugzillaConstants.TEST_BUGZILLA_222_URL, "1"));
- // if (foundHit != null) {
- // hitsForHandle.add(foundHit);
- // }
- // }
- //
- // // IF two queries have the same hit there should only be one instance
- // of
- // // a hit with a given handle.
- // assertEquals(1, hitsForHandle.size());
-
- // IF two queries have the same hit there should only be one instance of
- // a hit for a given handle.
- // Note that getQueryHitsForHandle will always return a set of unique
- // elements (even if there are duplicates among queries because
- // it returns a set.
- // assertEquals(1, taskList.getQueryHits(
- // AbstractRepositoryTask.getHandle(IBugzillaConstants.TEST_BUGZILLA_222_URL,
- // "1")).size());
-
+ assertEquals(1, taskList.getAllTasks().size());
}
public void testAttachToExistingReport() throws Exception {
@@ -606,8 +558,7 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
synchAndAssertState(tasks, RepositoryTaskSyncState.SYNCHRONIZED);
- bugtaskdata = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(
- bugtask.getHandleIdentifier());
+ bugtaskdata = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(bugtask.getHandleIdentifier());
assertEquals(estimatedTime, Float.parseFloat(bugtaskdata.getAttributeValue(BugzillaReportElement.ESTIMATED_TIME
.getKeyString())));
@@ -659,36 +610,39 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
private boolean validateAttachmentAttributes(RepositoryAttachment att, boolean isPatch, boolean isObsolete) {
return (att.isPatch() == isPatch) && (att.isObsolete() == isObsolete);
}
-
-
-// public void testSimpleLoad() throws Exception {
-// repository = new TaskRepository(DEFAULT_KIND, IBugzillaConstants.ECLIPSE_BUGZILLA_URL);
-// //Credentials credentials = MylarTestUtils.readCredentials();
-// //repository.setAuthenticationCredentials(credentials.username, credentials.password);
+
+// public void testSimpleLoad() throws Exception {
+// repository = new TaskRepository(DEFAULT_KIND,
+// IBugzillaConstants.ECLIPSE_BUGZILLA_URL);
+// //Credentials credentials = MylarTestUtils.readCredentials();
+// //repository.setAuthenticationCredentials(credentials.username,
+// credentials.password);
//
-// //repository.setTimeZoneId("Canada/Eastern");
-// assertNotNull(manager);
-// manager.addRepository(repository, TasksUiPlugin.getDefault().getRepositoriesFilePath());
+// //repository.setTimeZoneId("Canada/Eastern");
+// assertNotNull(manager);
+// manager.addRepository(repository,
+// TasksUiPlugin.getDefault().getRepositoriesFilePath());
//
-// taskList = TasksUiPlugin.getTaskListManager().getTaskList();
+// taskList = TasksUiPlugin.getTaskListManager().getTaskList();
//
-// AbstractRepositoryConnector abstractRepositoryConnector = manager.getRepositoryConnector(DEFAULT_KIND);
+// AbstractRepositoryConnector abstractRepositoryConnector =
+// manager.getRepositoryConnector(DEFAULT_KIND);
//
-// assertEquals(abstractRepositoryConnector.getRepositoryType(), DEFAULT_KIND);
+// assertEquals(abstractRepositoryConnector.getRepositoryType(), DEFAULT_KIND);
//
-// connector = (BugzillaRepositoryConnector) abstractRepositoryConnector;
+// connector = (BugzillaRepositoryConnector) abstractRepositoryConnector;
//
-// long start = System.currentTimeMillis();
-// BugzillaTask task = null;
-// for(int x = 1; x < 5; x++) {
-// if(task != null)
-// taskList.deleteTask(task);
+// long start = System.currentTimeMillis();
+// BugzillaTask task = null;
+// for(int x = 1; x < 5; x++) {
+// if(task != null)
+// taskList.deleteTask(task);
//
-// task = this.generateLocalTaskAndDownload("154100");
-// assertNotNull(task);
-// }
-// System.err.println("Total: "+((System.currentTimeMillis() - start)/1000));
-// }
+// task = this.generateLocalTaskAndDownload("154100");
+// assertNotNull(task);
+// }
+// System.err.println("Total: "+((System.currentTimeMillis() - start)/1000));
+// }
// class MockBugzillaReportSubmitForm extends BugzillaReportSubmitForm {
//
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 8c5a8205c..d9966f3c3 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
@@ -11,7 +11,7 @@
package org.eclipse.mylar.bugzilla.tests;
-import java.util.List;
+import java.util.Set;
import junit.framework.TestCase;
@@ -19,10 +19,12 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaCorePlugin;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryQuery;
import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
+import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.QueryHitCollector;
+import org.eclipse.mylar.tasks.core.TaskList;
import org.eclipse.mylar.tasks.core.TaskRepository;
+import org.eclipse.mylar.tasks.ui.TaskFactory;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
/**
@@ -82,11 +84,11 @@ public class BugzillaSearchEngineTest extends TestCase {
TaskRepository repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND,
IBugzillaConstants.TEST_BUGZILLA_222_URL, IBugzillaConstants.BugzillaServerVersion.SERVER_222.toString());
TasksUiPlugin.getRepositoryManager().addRepository(repository, TasksUiPlugin.getDefault().getRepositoriesFilePath());
- List<AbstractQueryHit> hits = runQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL, SEARCH_DESCRIPTION);
+ Set<AbstractRepositoryTask> hits = runQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL, SEARCH_DESCRIPTION);
assertEquals(NUM_EXPECTED_HITS, hits.size());
}
- private List<AbstractQueryHit> runQuery(String repositoryURL, String SearchString) throws Exception {
+ private Set<AbstractRepositoryTask> runQuery(String repositoryURL, String SearchString) throws Exception {
TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository(BugzillaCorePlugin.REPOSITORY_KIND, repositoryURL);
assertNotNull(repository);
@@ -97,13 +99,13 @@ public class BugzillaSearchEngineTest extends TestCase {
TasksUiPlugin.getTaskListManager().getTaskList());
AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(BugzillaCorePlugin.REPOSITORY_KIND);
+ TaskList taskList = TasksUiPlugin.getTaskListManager().getTaskList();
+ QueryHitCollector collector = new QueryHitCollector(taskList, new TaskFactory(repository));
- QueryHitCollector collector = new QueryHitCollector(TasksUiPlugin.getTaskListManager().getTaskList());
-
- connector.performQuery(repositoryQuery, repository, new NullProgressMonitor(), collector);
+ 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.getHits();
+ return collector.getTaskHits();
}
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 002fbcc70..b40903aff 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
@@ -15,12 +15,11 @@ import java.util.Date;
import junit.framework.TestCase;
-import org.eclipse.mylar.internal.bugzilla.core.BugzillaQueryHit;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryQuery;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaTask;
+import org.eclipse.mylar.internal.tasks.ui.ITaskListNotification;
import org.eclipse.mylar.internal.tasks.ui.TaskListNotificationIncoming;
import org.eclipse.mylar.internal.tasks.ui.TaskListNotificationManager;
-import org.eclipse.mylar.internal.tasks.ui.TaskListNotificationQueryIncoming;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.Task;
@@ -59,8 +58,7 @@ public class TaskListNotificationManagerTest extends TestCase {
TasksUiPlugin.getTaskListManager().getTaskList().addTask(task1);
TasksUiPlugin.getTaskListManager().getTaskList().addTask(task2);
- TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault()
- .getTaskListNotificationManager();
+ TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault().getTaskListNotificationManager();
notificationManager.collectNotifications();
task0 = TasksUiPlugin.getTaskListManager().getTaskList().getTask("t0");
@@ -78,14 +76,14 @@ public class TaskListNotificationManagerTest extends TestCase {
public void testTaskListNotificationIncoming() {
TaskRepository repository = new TaskRepository("bugzilla", "https://bugs.eclipse.org/bugs");
- TasksUiPlugin.getRepositoryManager().addRepository(repository, TasksUiPlugin.getDefault().getRepositoriesFilePath());
+ TasksUiPlugin.getRepositoryManager().addRepository(repository,
+ TasksUiPlugin.getDefault().getRepositoriesFilePath());
AbstractRepositoryTask task = new BugzillaTask("https://bugs.eclipse.org/bugs", "142891", "label", true);
assertTrue(task.getSyncState() == RepositoryTaskSyncState.INCOMING);
- assertTrue(task.isNotified());
+ assertFalse(task.isNotified());
task.setNotified(false);
TasksUiPlugin.getTaskListManager().getTaskList().addTask(task);
- TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault()
- .getTaskListNotificationManager();
+ TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault().getTaskListNotificationManager();
notificationManager.collectNotifications();
assertTrue(notificationManager.getNotifications().contains(new TaskListNotificationIncoming(task)));
task = (AbstractRepositoryTask) TasksUiPlugin.getTaskListManager().getTaskList().getTask(
@@ -95,45 +93,47 @@ public class TaskListNotificationManagerTest extends TestCase {
}
public void testTaskListNotificationQueryIncoming() {
- BugzillaQueryHit hit = new BugzillaQueryHit(null, "summary", "priority", "https://bugs.eclipse.org/bugs", "1",
- null, "status");
+ BugzillaTask hit = new BugzillaTask("https://bugs.eclipse.org/bugs", "1", "summary", true);
assertFalse(hit.isNotified());
BugzillaRepositoryQuery query = new BugzillaRepositoryQuery("https://bugs.eclipse.org/bugs", "queryUrl",
"summary", TasksUiPlugin.getTaskListManager().getTaskList());
query.addHit(hit);
TasksUiPlugin.getTaskListManager().getTaskList().addQuery(query);
- TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault()
- .getTaskListNotificationManager();
+ TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault().getTaskListNotificationManager();
+ assertFalse(hit.isNotified());
notificationManager.collectNotifications();
- assertTrue(notificationManager.getNotifications().contains(new TaskListNotificationQueryIncoming(hit)));
+ for (ITaskListNotification notification : notificationManager.getNotifications()) {
+ notification.getLabel().equals(hit.getSummary());
+ }
+ //assertTrue(notificationManager.getNotifications().contains(new TaskListNotificationQueryIncoming(hit)));
assertTrue(hit.isNotified());
}
-
+
public void testTaskListNotificationQueryIncomingRepeats() {
TasksUiPlugin.getTaskListManager().resetTaskList();
- BugzillaQueryHit hit = new BugzillaQueryHit(null, "summary", "priority", "https://bugs.eclipse.org/bugs", "1",
- null, "status");
+ BugzillaTask hit = new BugzillaTask("https://bugs.eclipse.org/bugs", "1", "summary", true);
String hitHandle = hit.getHandleIdentifier();
assertFalse(hit.isNotified());
BugzillaRepositoryQuery query = new BugzillaRepositoryQuery("https://bugs.eclipse.org/bugs", "queryUrl",
- "summary", TasksUiPlugin.getTaskListManager().getTaskList());
+ "summary", TasksUiPlugin.getTaskListManager().getTaskList());
query.addHit(hit);
- TasksUiPlugin.getTaskListManager().getTaskList().addQuery(query);
- TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault()
- .getTaskListNotificationManager();
+ TasksUiPlugin.getTaskListManager().getTaskList().addQuery(query);
+ TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault().getTaskListNotificationManager();
notificationManager.collectNotifications();
- assertTrue(notificationManager.getNotifications().contains(new TaskListNotificationQueryIncoming(hit)));
+ for (ITaskListNotification notification : notificationManager.getNotifications()) {
+ notification.getLabel().equals(hit.getSummary());
+ }
+ //assertTrue(notificationManager.getNotifications().iterator().next().equals(new TaskListNotificationQueryIncoming(hit)));
assertTrue(hit.isNotified());
-
+
TasksUiPlugin.getTaskListManager().saveTaskList();
TasksUiPlugin.getTaskListManager().resetTaskList();
assertEquals(0, TasksUiPlugin.getTaskListManager().getTaskList().getQueries().size());
assertTrue(TasksUiPlugin.getTaskListManager().readExistingOrCreateNewList());
assertEquals(1, TasksUiPlugin.getTaskListManager().getTaskList().getQueries().size());
- BugzillaQueryHit hitLoaded = (BugzillaQueryHit)TasksUiPlugin.getTaskListManager().getTaskList().getQueryHit(hitHandle);
+ BugzillaTask hitLoaded = (BugzillaTask) TasksUiPlugin.getTaskListManager().getTaskList().getTask(hitHandle);
assertNotNull(hitLoaded);
assertTrue(hitLoaded.isNotified());
-
}
}
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 43e18baa2..fc4668494 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
@@ -19,7 +19,6 @@ import java.util.Set;
import junit.framework.TestCase;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.mylar.internal.bugzilla.core.BugzillaQueryHit;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryQuery;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaTask;
import org.eclipse.mylar.internal.tasks.ui.planner.CompletedTaskCollector;
@@ -176,7 +175,7 @@ public class TaskReportGeneratorTest extends TestCase {
generator.run(new NullProgressMonitor());
assertEquals(0, generator.getAllCollectedTasks().size());
- bugQuery.addHit(new BugzillaQueryHit(null, "task1description", "low", "repositoryURL", "1", task1, "FIXED"));
+ bugQuery.addHit(task1);
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 7a7ae36a5..5f43da257 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
@@ -21,12 +21,13 @@ import org.eclipse.mylar.internal.bugzilla.core.BugzillaReportElement;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryConnector;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryQuery;
import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
+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.RepositoryTaskData;
import org.eclipse.mylar.tasks.core.TaskList;
import org.eclipse.mylar.tasks.core.TaskRepository;
+import org.eclipse.mylar.tasks.ui.TaskFactory;
// import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
@@ -131,14 +132,14 @@ public class BugzillaQueryTest extends TestCase {
// holds onto actual hit objects
TaskList taskList = new TaskList();
- QueryHitCollector collector = new QueryHitCollector(new TaskList());
+ QueryHitCollector collector = new QueryHitCollector(taskList, new TaskFactory(repository));
BugzillaRepositoryConnector connector = new BugzillaRepositoryConnector();
connector.init(taskList);
BugzillaRepositoryQuery query = new BugzillaRepositoryQuery(repository.getUrl(), queryUrlString, "summary",
taskList);
- connector.performQuery(query, repository, new NullProgressMonitor(), collector);
- assertEquals(2, collector.getHits().size());
- for (AbstractQueryHit hit : collector.getHits()) {
+ connector.performQuery(query, repository, new NullProgressMonitor(), collector, false);
+ assertEquals(2, collector.getTaskHits().size());
+ for (ITask hit : collector.getTaskHits()) {
assertTrue(hit.getSummary().contains("search-match-test"));
}
}
diff --git a/org.eclipse.mylyn.bugzilla.tests/test-attach-1181009324093.txt b/org.eclipse.mylyn.bugzilla.tests/test-attach-1181009324093.txt
new file mode 100644
index 000000000..bdf08de0f
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.tests/test-attach-1181009324093.txt
@@ -0,0 +1 @@
+test file \ No newline at end of file
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 6003fddb1..f9bb142da 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
@@ -20,6 +20,7 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.mylar.core.MylarStatusHandler;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryQuery;
import org.eclipse.mylar.tasks.core.RepositoryTaskAttribute;
+import org.eclipse.mylar.tasks.ui.TaskFactory;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
import org.eclipse.mylar.tasks.ui.editors.AbstractNewRepositoryTaskEditor;
import org.eclipse.mylar.tasks.ui.search.SearchHitCollector;
@@ -117,7 +118,7 @@ public class NewBugzillaTaskEditor extends AbstractNewRepositoryTaskEditor {
TasksUiPlugin.getTaskListManager().getTaskList());
SearchHitCollector collector = new SearchHitCollector(TasksUiPlugin.getTaskListManager().getTaskList(),
- repository, bugzillaQuery);
+ repository, bugzillaQuery, new TaskFactory(repository));
return collector;
}
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 f29fa1a0a..c483eb7df 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
@@ -11,10 +11,8 @@
package org.eclipse.mylar.internal.bugzilla.ui.tasklist;
-import org.eclipse.mylar.internal.bugzilla.core.BugzillaQueryHit;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryQuery;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaTask;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
import org.eclipse.mylar.tasks.core.DelegatingTaskExternalizer;
@@ -31,16 +29,10 @@ import org.w3c.dom.Node;
public class BugzillaTaskExternalizer extends DelegatingTaskExternalizer {
private static final String KEY_SEVERITY = "bugzilla.severity";
-
- private static final String KEY_PRODUCT = "bugzilla.product";
-
- private static final String STATUS_RESO = "RESO";
- private static final String STATUS_NEW = "NEW";
+ private static final String KEY_PRODUCT = "bugzilla.product";
private static final String TAG_BUGZILLA = "Bugzilla";
-
- private static final String TAG_BUGZILLA_QUERY_HIT = TAG_BUGZILLA + KEY_QUERY_HIT;
private static final String TAG_BUGZILLA_QUERY = TAG_BUGZILLA + KEY_QUERY;
@@ -82,11 +74,11 @@ public class BugzillaTaskExternalizer extends DelegatingTaskExternalizer {
@Override
public Element createTaskElement(ITask task, Document doc, Element parent) {
Element node = super.createTaskElement(task, doc, parent);
- node.setAttribute(KEY_SEVERITY, ((BugzillaTask)task).getSeverity());
- node.setAttribute(KEY_PRODUCT, ((BugzillaTask)task).getProduct());
+ node.setAttribute(KEY_SEVERITY, ((BugzillaTask) task).getSeverity());
+ node.setAttribute(KEY_PRODUCT, ((BugzillaTask) task).getProduct());
return node;
}
-
+
@Override
public boolean canCreateElementFor(AbstractRepositoryQuery category) {
return category instanceof BugzillaRepositoryQuery;
@@ -103,44 +95,21 @@ public class BugzillaTaskExternalizer extends DelegatingTaskExternalizer {
}
@Override
- public ITask createTask(String repositoryUrl, String taskId, String summary, Element element, TaskList taskList, AbstractTaskContainer category, ITask parent)
- throws TaskExternalizationException {
+ public ITask createTask(String repositoryUrl, String taskId, String summary, Element element, TaskList taskList,
+ AbstractTaskContainer category, ITask parent) throws TaskExternalizationException {
BugzillaTask task = new BugzillaTask(repositoryUrl, taskId, summary, false);
- if(element.hasAttribute(KEY_SEVERITY)) {
+ if (element.hasAttribute(KEY_SEVERITY)) {
task.setSeverity(element.getAttribute(KEY_SEVERITY));
}
- if(element.hasAttribute(KEY_PRODUCT)) {
+ if (element.hasAttribute(KEY_PRODUCT)) {
task.setProduct(element.getAttribute(KEY_PRODUCT));
}
return task;
}
@Override
- public boolean canReadQueryHit(Node node) {
- return node.getNodeName().equals(getQueryHitTagName());
- }
-
- @Override
- public AbstractQueryHit createQueryHit(String repositoryUrl, String taskId, String summary, Element element, TaskList taskList, AbstractRepositoryQuery query)
- throws TaskExternalizationException {
- String status = STATUS_NEW;
- if (element.hasAttribute(KEY_COMPLETE)) {
- status = element.getAttribute(KEY_COMPLETE);
- if (status.equals(VAL_TRUE)) {
- status = STATUS_RESO;
- }
- }
- BugzillaQueryHit hit = new BugzillaQueryHit(taskList, summary, "", repositoryUrl, taskId, null, status);
- return hit;
- }
-
- @Override
public String getTaskTagName() {
return TAG_BUGZILLA_REPORT;
}
- @Override
- public String getQueryHitTagName() {
- return TAG_BUGZILLA_QUERY_HIT;
- }
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java
index 69d4aa22d..f42cb6ff5 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java
@@ -40,7 +40,6 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.mylar.core.MylarStatusHandler;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaCorePlugin;
-import org.eclipse.mylar.internal.bugzilla.core.BugzillaQueryHit;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaReportElement;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryConnector;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryQuery;
@@ -300,11 +299,6 @@ public class BugzillaProductPage extends WizardPage {
if (element instanceof BugzillaRepositoryQuery) {
query = (BugzillaRepositoryQuery) element;
- } else if (element instanceof BugzillaQueryHit) {
- BugzillaQueryHit hit = (BugzillaQueryHit) element;
- if (hit.getParent() != null && hit.getParent() instanceof BugzillaRepositoryQuery) {
- query = (BugzillaRepositoryQuery) hit.getParent();
- }
}
if (query != null) {
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WebQueryHit.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WebQueryHit.java
deleted file mode 100644
index 4f434cee1..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WebQueryHit.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2006 Mylar committers 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
- *******************************************************************************/
-
-package org.eclipse.mylar.internal.tasks.core;
-
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
-import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
-import org.eclipse.mylar.tasks.core.TaskList;
-
-/**
- * Represents issue returned by <code>WebQuery</code>
- *
- * @author Eugene Kuleshov
- */
-public class WebQueryHit extends AbstractQueryHit {
-
- private final String taskPrefix;
-
- public WebQueryHit(TaskList taskList, String repositoryUrl, String description, String id, String taskPrefix) {
- super(taskList, repositoryUrl, description, id);
- this.taskPrefix = taskPrefix;
- }
-
- @Override
- public String getPriority() {
- return "?";
- }
-
- @Override
- public boolean isCompleted() {
- return false;
- }
-
- @Override
- protected AbstractRepositoryTask createTask() {
- return new WebTask(taskId, summary, taskPrefix, repositoryUrl, WebTask.REPOSITORY_TYPE);
- }
-
- @Override
- public String getIdentifyingLabel() {
- return taskPrefix.equals("") ? "" : super.getIdentifyingLabel();
- }
-
- public String getTaskPrefix() {
- return this.taskPrefix;
- }
-
-}
-
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
index 46dfa1835..74940e0a4 100644
--- 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
@@ -17,7 +17,7 @@ import org.eclipse.mylar.tasks.core.Task.PriorityLevel;
/**
* @author Mik Kersten
*/
-public abstract class AbstractQueryHit extends PlatformObject implements ITaskListElement {
+/*public*/ abstract class AbstractQueryHit extends PlatformObject implements ITaskListElement {
protected TaskList taskList;
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 d46a35a7a..5402dfdfd 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
@@ -107,7 +107,7 @@ public abstract class AbstractRepositoryConnector {
taskData = getTaskDataHandler().getTaskData(repository, id, monitor);
if (taskData != null) {
// Use connector task factory
- repositoryTask = makeTask(repository.getUrl(), id, taskData.getId() + ": " + taskData.getDescription());
+ repositoryTask = createTask(repository.getUrl(), id, taskData.getId() + ": " + taskData.getDescription());
updateTaskFromTaskData(repository, repositoryTask, taskData, retrieveSubTasks);
taskList.addTask(repositoryTask);
@@ -125,7 +125,7 @@ public abstract class AbstractRepositoryConnector {
*
* @return instance of AbstractRepositoryTask
*/
- protected abstract AbstractRepositoryTask makeTask(String repositoryUrl, String id, String summary);
+ public abstract AbstractRepositoryTask createTask(String repositoryUrl, String id, String summary);
/**
* Implementors must execute query synchronously.
@@ -138,7 +138,7 @@ public abstract class AbstractRepositoryConnector {
* IQueryHitCollector that collects the hits found
*/
public abstract IStatus performQuery(AbstractRepositoryQuery query, TaskRepository repository,
- IProgressMonitor monitor, QueryHitCollector resultCollector);
+ IProgressMonitor monitor, QueryHitCollector resultCollector, boolean forced);
/**
* The connector's summary i.e. "JIRA (supports 3.3.1 and later)"
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 347de8b3f..427f2e2d1 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,8 +10,8 @@
*******************************************************************************/
package org.eclipse.mylar.tasks.core;
+import java.util.Collection;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import org.eclipse.core.runtime.IStatus;
@@ -19,13 +19,12 @@ import org.eclipse.core.runtime.IStatus;
/**
* @author Mik Kersten
* @author Eugene Kuleshov
+ * @author Rob Elves
*/
public abstract class AbstractRepositoryQuery extends AbstractTaskContainer {
protected String repositoryUrl;
- private Set<String> hitHandles = new HashSet<String>();
-
protected String lastRefreshTimeStamp = "<never>";
private boolean currentlySynchronizing = false;
@@ -43,19 +42,6 @@ public abstract class AbstractRepositoryQuery extends AbstractTaskContainer {
super(description, taskList);
}
- // TODO: this overriding is a bit weird
- @Override
- public Set<ITask> getChildren() {
- Set<ITask> tasks = new HashSet<ITask>();
- for (AbstractQueryHit hit : getHits()) {
- ITask task = hit.getCorrespondingTask();
- if (task != null) {
- tasks.add(task);
- }
- }
- return tasks;
- }
-
public boolean isArchive() {
return false;
}
@@ -64,56 +50,41 @@ public abstract class AbstractRepositoryQuery extends AbstractTaskContainer {
// ignore
}
- public /*synchronized*/ AbstractQueryHit findQueryHit(String handle) {
- if (hitHandles.contains(handle)) {
- return taskList.getQueryHit(handle);
- }
- return null;
- }
-
- public synchronized Set<AbstractQueryHit> getHits() {
- return taskList.getQueryHits(hitHandles);
- }
-
- public synchronized void updateHits(List<AbstractQueryHit> newHits, TaskList taskList) {
- Set<AbstractQueryHit> oldHits = getHits();
- hitHandles.clear();
- for (AbstractQueryHit oldHit : oldHits) {
- int index = newHits.indexOf(oldHit);
- if (index != -1) {
- newHits.get(index).setNotified(oldHit.isNotified());
+ public synchronized Set<AbstractRepositoryTask> getHits() {
+ Set<AbstractRepositoryTask> repositoryTasks = new HashSet<AbstractRepositoryTask>();
+ for (ITask task : super.getChildren()) {
+ if (task instanceof AbstractRepositoryTask) {
+ repositoryTasks.add((AbstractRepositoryTask) task);
}
}
- for (AbstractQueryHit hit : newHits) {
- this.addHit(hit);
- }
+ return repositoryTasks;
}
- public synchronized void addHit(AbstractQueryHit hit) {
- if (hit.getCorrespondingTask() == null) {
- ITask correspondingTask = taskList.getTask(hit.getHandleIdentifier());
- if (correspondingTask instanceof AbstractRepositoryTask) {
- hit.setCorrespondingTask((AbstractRepositoryTask) correspondingTask);
- }
+ public synchronized void updateHits(Collection<AbstractRepositoryTask> newHits) {
+ clear();
+ for (AbstractRepositoryTask abstractRepositoryTask : newHits) {
+ addHit(abstractRepositoryTask);
}
- // Always replace even if exists (may have new summary etc.)
- taskList.addQueryHit(hit);
+ }
- // TODO: this is meaningless since only one hit object exists now
- hit.setParent(this);
- hitHandles.add(hit.getHandleIdentifier());
+ public synchronized void addHit(AbstractRepositoryTask hit) {
+ // TODO: Move up?
+ if(!taskList.getAllTasks().contains(hit)) {
+ taskList.addTask(hit);
+ }
+ super.add(hit);
}
- public synchronized void removeHit(AbstractQueryHit hit) {
- hitHandles.remove(hit.getHandleIdentifier());
+ public synchronized void removeHit(AbstractRepositoryTask hit) {
+ super.remove(hit);
}
public synchronized String getPriority() {
- if (hitHandles.isEmpty()) {
+ if (super.isEmpty()) {
return Task.PriorityLevel.P1.toString();
}
String highestPriority = Task.PriorityLevel.P5.toString();
- for (AbstractQueryHit hit : getHits()) {
+ for (AbstractRepositoryTask hit : getHits()) {
if (highestPriority.compareTo(hit.getPriority()) > 0) {
highestPriority = hit.getPriority();
}
@@ -152,11 +123,6 @@ public abstract class AbstractRepositoryQuery extends AbstractTaskContainer {
this.currentlySynchronizing = currentlySynchronizing;
}
- @Override
- final void add(ITask task) {
- // ignore, can not add tasks to a query
- }
-
public String getLastRefreshTimeStamp() {
return lastRefreshTimeStamp;
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryTask.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryTask.java
index 9209db3cd..d7d5db1c3 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryTask.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryTask.java
@@ -31,7 +31,7 @@ public abstract class AbstractRepositoryTask extends Task {
protected String owner;
- protected boolean isNotifiedIncoming = true;
+ protected boolean isNotifiedIncoming = false;
public enum RepositoryTaskSyncState {
OUTGOING, SYNCHRONIZED, INCOMING, CONFLICT
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 5da3be760..f2fdd7796 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
@@ -12,6 +12,7 @@ package org.eclipse.mylar.tasks.core;
import java.util.HashSet;
import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
import org.eclipse.core.runtime.PlatformObject;
@@ -24,7 +25,7 @@ public abstract class AbstractTaskContainer extends PlatformObject implements IT
private String handle = "";
- private Set<String> childHandles = new HashSet<String>();
+ private Set<String> childHandles = new CopyOnWriteArraySet<String>();
protected TaskList taskList;
@@ -52,11 +53,23 @@ public abstract class AbstractTaskContainer extends PlatformObject implements IT
}
return children;
}
+
+ public boolean contains(String handle) {
+ return childHandles.contains(handle);
+ }
public String getSummary() {
return handle;
}
+
+ /**
+ * @since 2.0
+ */
+ public boolean isEmpty() {
+ return childHandles.isEmpty();
+ }
+
public String getHandleIdentifier() {
return handle;
}
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 ac3472a36..f101c0e43 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
@@ -231,7 +231,7 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
for (ITask t : task.getChildren()) {
createSubTaskElement(t, doc, node);
}
-
+
parent.appendChild(node);
return node;
}
@@ -359,6 +359,7 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
if (task != null) {
readTaskInfo(task, taskList, element, parent, category);
}
+
return task;
}
@@ -594,15 +595,15 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
if (query.getLastRefreshTimeStamp() != null) {
node.setAttribute(KEY_LAST_REFRESH, query.getLastRefreshTimeStamp());
}
- for (AbstractQueryHit hit : query.getHits()) {
+ for (AbstractRepositoryTask hit : query.getHits()) {
try {
- Element element = null;
- for (ITaskListExternalizer externalizer : delegateExternalizers) {
- if (externalizer.canCreateElementFor(hit))
- element = externalizer.createQueryHitElement(hit, doc, node);
- }
- if (element == null)
- createQueryHitElement(hit, doc, node);
+// Element element = null;
+// for (ITaskListExternalizer externalizer : delegateExternalizers) {
+// if (externalizer.canCreateElementFor(hit))
+// element = externalizer.createQueryHitElement(hit, doc, node);
+// }
+// if (element == null)
+ createQueryHitElement(hit, doc, node);
} catch (Exception e) {
MylarStatusHandler.log(e, e.getMessage());
}
@@ -628,7 +629,7 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
return KEY_QUERY;
}
- public String getQueryHitTagName() {
+ private String getQueryHitTagName() {
return KEY_QUERY_HIT;
}
@@ -636,21 +637,21 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
return false;
}
- public Element createQueryHitElement(AbstractQueryHit queryHit, Document doc, Element parent) {
+ public Element createQueryHitElement(AbstractRepositoryTask queryHit, Document doc, Element parent) {
Element node = doc.createElement(getQueryHitTagName());
- node.setAttribute(KEY_NAME, queryHit.getSummary());
+// 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);
- }
+// 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;
}
@@ -661,66 +662,58 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
public final void readQueryHit(Element element, TaskList taskList, AbstractRepositoryQuery query)
throws TaskExternalizationException {
- AbstractQueryHit hit = null;
- String summary = "";
- if (element.hasAttribute(KEY_NAME)) {
- summary = element.getAttribute(KEY_NAME);
- }
if (element.hasAttribute(KEY_HANDLE)) {
String handle = element.getAttribute(KEY_HANDLE);
- String repositoryUrl = RepositoryTaskHandleUtil.getRepositoryUrl(handle);
- String taskId = RepositoryTaskHandleUtil.getTaskId(handle);
- for (ITaskListExternalizer externalizer : delegateExternalizers) {
- if (externalizer.canReadQueryHit((Node) element)) {
- hit = externalizer.createQueryHit(repositoryUrl, taskId, summary, element, taskList, query);
- break;
- }
+ ITask hit = taskList.getTask(handle);
+ if (hit != null) {
+ query.addHit((AbstractRepositoryTask) hit);
}
+
} else {
throw new TaskExternalizationException("Handle not stored for repository task");
}
-
- if (hit != null) {
- readQueryHitInfo(hit, taskList, query, element);
- }
- }
-
- /**
- * 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);
- }
+// /**
+// * 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;
+// }
- query.addHit(hit);
- }
+// 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/ITaskFactory.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskFactory.java
new file mode 100644
index 000000000..e06b3b91c
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskFactory.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2004 - 2006 Mylar committers 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
+ *******************************************************************************/
+
+package org.eclipse.mylar.tasks.core;
+
+
+/**
+ * @author Rob Elves
+ */
+public interface ITaskFactory {
+
+ /**
+ * @param synchData -
+ * synchronize task with the provided taskData
+ * @param forced -
+ * user requested synchronization
+ */
+ public abstract AbstractRepositoryTask createTask(RepositoryTaskData taskData, boolean synchData, boolean forced);
+
+} \ No newline at end of file
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 ed48bd3a7..e248bca75 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,7 +32,7 @@ public interface ITaskListExternalizer {
public abstract String getQueryTagNameForElement(AbstractRepositoryQuery query);
- public abstract String getQueryHitTagName();
+// public abstract String getQueryHitTagName();
/**
* @return the element that was created, null if failed
@@ -65,10 +65,10 @@ public interface ITaskListExternalizer {
public abstract boolean canCreateElementFor(AbstractQueryHit queryHit);
- public abstract Element createQueryHitElement(AbstractQueryHit queryHit, Document doc, Element parent);
+// public abstract Element createQueryHitElement(AbstractRepositoryTask queryHit, Document doc, Element parent);
- public abstract boolean canReadQueryHit(Node node);
+// public abstract boolean canReadQueryHit(Node node);
- public abstract AbstractQueryHit createQueryHit(String repositoryUrl, String taskId, String summary, Element element, TaskList tlist, AbstractRepositoryQuery query)
- throws TaskExternalizationException;
+// 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 1910209d5..275be8868 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
@@ -11,8 +11,8 @@
package org.eclipse.mylar.tasks.core;
import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -30,7 +30,7 @@ public class QueryHitCollector {
public static final String MAX_HITS_REACHED = "Max allowed number of hits returned exceeded. Some hits may not be displayed. Please narrow query scope.";
- private List<AbstractQueryHit> results = new ArrayList<AbstractQueryHit>();
+ protected Set<AbstractRepositoryTask> taskResults = new HashSet<AbstractRepositoryTask>();
/** The progress monitor for the search operation */
private IProgressMonitor monitor = new NullProgressMonitor();
@@ -50,35 +50,48 @@ public class QueryHitCollector {
/** The string to display to the user when the query is done */
private static final String DONE = "done";
- private TaskList taskList;
+ protected TaskList taskList;
- public QueryHitCollector(TaskList tasklist) {
+ protected ITaskFactory taskFactory;
+
+ public QueryHitCollector(TaskList tasklist, ITaskFactory taskFactory) {
this.taskList = tasklist;
+ this.taskFactory = taskFactory;
}
public void aboutToStart(int startMatchCount) throws CoreException {
- results.clear();
+ taskResults.clear();
matchCount = startMatchCount;
monitor.setTaskName(STARTING);
}
-
- public void accept(AbstractQueryHit hit) {
-
- ITask correspondingTask = taskList.getTask(hit.getHandleIdentifier());
- if (correspondingTask instanceof AbstractRepositoryTask) {
- hit.setCorrespondingTask((AbstractRepositoryTask) correspondingTask);
- }
+ public void accept(AbstractRepositoryTask task) {
- addMatch(hit);
- matchCount++;
-
if (!getProgressMonitor().isCanceled()) {
- // if the operation is canceled finish with whatever data was
- // already found
getProgressMonitor().subTask(getFormattedMatchesString(matchCount));
getProgressMonitor().worked(1);
}
+
+ if (task == null)
+ return;
+
+ ITask hitTask = taskList.getTask(task.getHandleIdentifier());
+ if (hitTask == null) {
+ hitTask = task;
+ // task is new, add to tasklist
+ taskList.addTask(hitTask);
+ }
+ taskResults.add((AbstractRepositoryTask) hitTask);
+ matchCount++;
+ }
+
+ public void accept(RepositoryTaskData taskData) {
+ if (taskData == null)
+ return;
+
+ AbstractRepositoryTask task = taskFactory.createTask(taskData, true, false);
+ taskResults.add(task);
+ matchCount++;
}
public void done() {
@@ -110,16 +123,12 @@ public class QueryHitCollector {
this.monitor = monitor;
}
- public void addMatch(AbstractQueryHit hit) {
- results.add(hit);
- }
-
- public List<AbstractQueryHit> getHits() {
- return results;
+ public Set<AbstractRepositoryTask> getTaskHits() {
+ return taskResults;
}
public void clear() {
- results.clear();
+ taskResults.clear();
}
}
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 2714f918c..7382a8ba0 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
@@ -32,7 +32,7 @@ import org.eclipse.mylar.internal.tasks.core.RepositoryTaskHandleUtil;
*/
public class TaskList {
- //public static final String LABEL_ROOT = "Uncategorized";// "Root
+ // public static final String LABEL_ROOT = "Uncategorized";// "Root
// (automatic)";
@@ -42,8 +42,6 @@ public class TaskList {
private Map<String, ITask> tasks;
- private Map<String, AbstractQueryHit> queryHits;
-
private Map<String, AbstractTaskContainer> categories;
private Map<String, AbstractRepositoryQuery> queries;
@@ -63,7 +61,6 @@ public class TaskList {
*/
public void reset() {
tasks = new ConcurrentHashMap<String, ITask>();
- queryHits = new ConcurrentHashMap<String, AbstractQueryHit>();
categories = new ConcurrentHashMap<String, AbstractTaskContainer>();
queries = new ConcurrentHashMap<String, AbstractRepositoryQuery>();
@@ -81,6 +78,23 @@ public class TaskList {
addTask(task, archiveContainer);
}
+ /**
+ * Returns an ITask for each of the given handles
+ *
+ * @since 2.0
+ */
+ public Set<ITask> getTasks(Set<String> handles) {
+ HashSet<ITask> result = new HashSet<ITask>();
+ Map<String, ITask> tempTasks = Collections.unmodifiableMap(tasks);
+ for (String handle : handles) {
+ ITask tempTask = tempTasks.get(handle);
+ if (tempTask != null) {
+ result.add(tempTask);
+ }
+ }
+ return result;
+ }
+
public void addTask(ITask task, AbstractTaskContainer category) {
tasks.put(task.getHandleIdentifier(), task);
if (category != null) {
@@ -96,17 +110,12 @@ public class TaskList {
}
public void refactorRepositoryUrl(String oldRepositoryUrl, String newRepositoryUrl) {
- // TODO: update mappings in offline task data, will currently lose them
for (ITask task : tasks.values()) {
if (task instanceof AbstractRepositoryTask) {
AbstractRepositoryTask repositoryTask = (AbstractRepositoryTask) task;
if (oldRepositoryUrl.equals(RepositoryTaskHandleUtil.getRepositoryUrl(repositoryTask
.getHandleIdentifier()))) {
tasks.remove(repositoryTask.getHandleIdentifier());
-// String taskId =
-// AbstractRepositoryTask.getTaskId(repositoryTask.getHandleIdentifier());
-// String newHandle = AbstractRepositoryTask.getHandle(newUrl, taskId);
-// repositoryTask.setHandleIdentifier(newHandle);
repositoryTask.setRepositoryUrl(newRepositoryUrl);
tasks.put(repositoryTask.getHandleIdentifier(), repositoryTask);
@@ -121,11 +130,6 @@ public class TaskList {
for (AbstractRepositoryQuery query : queries.values()) {
if (query.getRepositoryUrl().equals(oldRepositoryUrl)) {
query.setRepositoryUrl(newRepositoryUrl);
- for (AbstractQueryHit hit : query.getHits()) {
- queryHits.remove(hit.getHandleIdentifier());
- hit.setRepositoryUrl(newRepositoryUrl);
- queryHits.put(hit.getHandleIdentifier(), hit);
- }
for (ITaskListChangeListener listener : changeListeners) {
listener.containerInfoChanged(query);
}
@@ -359,7 +363,8 @@ public class TaskList {
public Set<AbstractTaskContainer> getTaskContainers() {
Set<AbstractTaskContainer> containers = new HashSet<AbstractTaskContainer>();
for (AbstractTaskContainer container : categories.values()) {
- if (container instanceof TaskCategory || container instanceof TaskArchive || container instanceof UncategorizedCategory) {
+ if (container instanceof TaskCategory || container instanceof TaskArchive
+ || container instanceof UncategorizedCategory) {
containers.add(container);
}
}
@@ -371,7 +376,7 @@ public class TaskList {
return null;
}
for (AbstractRepositoryQuery query : queries.values()) {
- if (query.findQueryHit(handle) != null) {
+ if (query.contains(handle)) {
return query;
}
}
@@ -455,45 +460,45 @@ public class TaskList {
}
Set<AbstractRepositoryQuery> queriesForHandle = new HashSet<AbstractRepositoryQuery>();
for (AbstractRepositoryQuery query : queries.values()) {
- if (query.findQueryHit(handle) != null) {
+ if (query.contains(handle)) {
queriesForHandle.add(query);
}
}
return queriesForHandle;
}
- /** if handle == null or no query hits found an empty set is returned * */
- public Set<AbstractQueryHit> getQueryHits(Set<String> handles) {
- if (handles == null) {
- return Collections.emptySet();
- }
- HashSet<AbstractQueryHit> result = new HashSet<AbstractQueryHit>();
- for (String handle : handles) {
- AbstractQueryHit hit = queryHits.get(handle);
- if (hit != null) {
- result.add(hit);
- }
- }
- return result;
- }
-
- public AbstractQueryHit getQueryHit(String handle) {
- if (handle != null) {
- return queryHits.get(handle);
- }
- return null;
- }
-
- /** for testing */
- public Set<AbstractQueryHit> getQueryHits() {
- // TODO: remove wrapping once API can change
- return new HashSet<AbstractQueryHit>(queryHits.values());
- }
-
- /** called by AbstractRepositoryQuery */
- public void addQueryHit(AbstractQueryHit hit) {
- queryHits.put(hit.getHandleIdentifier(), hit);
- }
+// /** if handle == null or no query hits found an empty set is returned * */
+// public Set<AbstractQueryHit> getQueryHits(Set<String> handles) {
+// if (handles == null) {
+// return Collections.emptySet();
+// }
+// HashSet<AbstractQueryHit> result = new HashSet<AbstractQueryHit>();
+// for (String handle : handles) {
+// AbstractQueryHit hit = queryHits.get(handle);
+// if (hit != null) {
+// result.add(hit);
+// }
+// }
+// return result;
+// }
+//
+// public AbstractQueryHit getQueryHit(String handle) {
+// if (handle != null) {
+// return queryHits.get(handle);
+// }
+// return null;
+// }
+
+// /** for testing */
+// public Set<AbstractQueryHit> getQueryHits() {
+// // TODO: remove wrapping once API can change
+// return new HashSet<AbstractQueryHit>(queryHits.values());
+// }
+//
+// /** called by AbstractRepositoryQuery */
+// public void addQueryHit(AbstractQueryHit hit) {
+// queryHits.put(hit.getHandleIdentifier(), hit);
+// }
/**
* return all queries for the given repository url
@@ -612,18 +617,18 @@ public class TaskList {
return max;
}
- /**
- * Orphaned hits arise when no query in the tasklist references a hit in the
- * master list maintained by the tasklist. Orphaned hits don't span
- * workbench re-start but this just helps maintain the list in case of
- * prolonged workbench uptime.
- */
- public void removeOrphanedHits() {
- for (String handle : new HashSet<String>(queryHits.keySet())) {
- Set<AbstractRepositoryQuery> queries = getQueriesForHandle(handle);
- if (queries == null || queries.isEmpty()) {
- queryHits.remove(handle);
- }
- }
- }
+// /**
+// * Orphaned hits arise when no query in the tasklist references a hit in the
+// * master list maintained by the tasklist. Orphaned hits don't span
+// * workbench re-start but this just helps maintain the list in case of
+// * prolonged workbench uptime.
+// */
+// public void removeOrphanedHits() {
+// for (String handle : new HashSet<String>(queryHits.keySet())) {
+// Set<AbstractRepositoryQuery> queries = getQueriesForHandle(handle);
+// if (queries == null || queries.isEmpty()) {
+// queryHits.remove(handle);
+// }
+// }
+// }
}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/RepositorySettingsPageTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/RepositorySettingsPageTest.java
index 274a7a73f..c7f3532ef 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/RepositorySettingsPageTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/RepositorySettingsPageTest.java
@@ -14,6 +14,7 @@ import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.mylar.tasks.core.TaskRepository;
import org.eclipse.mylar.tasks.tests.connector.MockRepositoryUi;
import org.eclipse.mylar.tasks.ui.AbstractRepositoryConnectorUi;
+import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
import org.eclipse.mylar.tasks.ui.wizards.AbstractRepositorySettingsPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
@@ -83,6 +84,9 @@ public class RepositorySettingsPageTest extends TestCase {
public void testNeedsAnonyoumousLogin() {
TaskRepository repository = new TaskRepository("kind", "http://localhost/");
+
+ TasksUiPlugin.addRepositoryConnectorUi(new MockRepositoryUi());
+
MockRepositorySettingsPage page = new MockRepositorySettingsPage(new MockRepositoryUi());
page.setNeedsAnonymousLogin(true);
page.setRepository(repository);
@@ -127,15 +131,13 @@ public class RepositorySettingsPageTest extends TestCase {
private class MockRepositorySettingsPage extends AbstractRepositorySettingsPage {
- private Composite parent;
-
public MockRepositorySettingsPage(AbstractRepositoryConnectorUi repositoryUi) {
super("title", "summary", repositoryUi);
}
@Override
protected void createAdditionalControls(Composite parent) {
- this.parent = parent;
+ // ignore
}
@Override
@@ -162,7 +164,7 @@ public class RepositorySettingsPageTest extends TestCase {
}
Composite getParent() {
- return parent;
+ return compositeContainer;
}
@Override
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 468834f3e..3ffe99be5 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
@@ -15,6 +15,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
+import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
@@ -31,7 +32,6 @@ import org.eclipse.mylar.internal.tasks.ui.TaskListPreferenceConstants;
import org.eclipse.mylar.internal.tasks.ui.TaskListSynchronizationScheduler;
import org.eclipse.mylar.internal.tasks.ui.actions.MarkTaskReadAction;
import org.eclipse.mylar.internal.tasks.ui.actions.MarkTaskUnreadAction;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
@@ -45,7 +45,6 @@ import org.eclipse.mylar.tasks.core.TaskRepository;
import org.eclipse.mylar.tasks.core.UncategorizedCategory;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask.RepositoryTaskSyncState;
import org.eclipse.mylar.tasks.tests.connector.MockAttributeFactory;
-import org.eclipse.mylar.tasks.tests.connector.MockQueryHit;
import org.eclipse.mylar.tasks.tests.connector.MockRepositoryConnector;
import org.eclipse.mylar.tasks.tests.connector.MockRepositoryQuery;
import org.eclipse.mylar.tasks.tests.connector.MockRepositoryTask;
@@ -144,7 +143,10 @@ public class TaskListManagerTest extends TestCase {
query.setRepositoryUrl("http://foo.bar");
query.setUrl("http://foo.bar/b");
manager.getTaskList().addQuery(query);
+ assertTrue(manager.getTaskList().getRepositoryQueries("http://foo.bar").size() > 0);
manager.refactorRepositoryUrl("http://foo.bar", "http://bar.baz");
+ assertTrue(manager.getTaskList().getRepositoryQueries("http://foo.bar").size() == 0);
+ assertTrue(manager.getTaskList().getRepositoryQueries("http://bar.baz").size() > 0);
AbstractRepositoryQuery changedQuery = manager.getTaskList().getRepositoryQueries("http://bar.baz").iterator()
.next();
assertEquals("http://bar.baz/b", changedQuery.getUrl());
@@ -159,41 +161,46 @@ public class TaskListManagerTest extends TestCase {
assertTrue(manager.getTaskList().getRepositoryQueries("http://a").isEmpty());
}
- public void testMigrateQueryHits() {
- AbstractRepositoryQuery query = new MockRepositoryQuery("mquery", manager.getTaskList());
- query.setRepositoryUrl("http://a");
- manager.getTaskList().addQuery(query);
- AbstractQueryHit hit = new MockQueryHit(manager.getTaskList(), "http://a", "", "123");
- query.addHit(hit);
- manager.refactorRepositoryUrl("http://a", "http://b");
- assertNotNull(manager.getTaskList().getQueryHit("http://b-123"));
- assertEquals("http://b-123", hit.getHandleIdentifier());
- }
+// public void testMigrateQueryHits() {
+// AbstractRepositoryQuery query = new MockRepositoryQuery("mquery",
+// manager.getTaskList());
+// query.setRepositoryUrl("http://a");
+// manager.getTaskList().addQuery(query);
+// AbstractQueryHit hit = new MockQueryHit(manager.getTaskList(), "http://a",
+// "", "123");
+// query.addHit(hit);
+// manager.refactorRepositoryUrl("http://a", "http://b");
+// assertNotNull(manager.getTaskList().getQueryHit("http://b-123"));
+// assertEquals("http://b-123", hit.getHandleIdentifier());
+// }
public void testMigrateTaskHandles() {
AbstractRepositoryTask task = new MockRepositoryTask("http://a", "123");
AbstractRepositoryTask task2 = new MockRepositoryTask("http://other", "other");
manager.getTaskList().addTask(task);
manager.getTaskList().addTask(task2);
-
- RepositoryTaskData taskData = new RepositoryTaskData(new MockAttributeFactory(), task.getRepositoryKind(), task.getRepositoryUrl(), task.getTaskId(), task.getTaskKind());
+
+ RepositoryTaskData taskData = new RepositoryTaskData(new MockAttributeFactory(), task.getRepositoryKind(), task
+ .getRepositoryUrl(), task.getTaskId(), task.getTaskKind());
TasksUiPlugin.getDefault().getTaskDataManager().setNewTaskData(task.getHandleIdentifier(), taskData);
assertNotNull(TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(task.getHandleIdentifier()));
-
- RepositoryTaskData taskData2 = new RepositoryTaskData(new MockAttributeFactory(), task2.getRepositoryKind(), task2.getRepositoryUrl(), task2.getTaskId(), task2.getTaskKind());
+
+ RepositoryTaskData taskData2 = new RepositoryTaskData(new MockAttributeFactory(), task2.getRepositoryKind(),
+ task2.getRepositoryUrl(), task2.getTaskId(), task2.getTaskKind());
taskData2.setNewComment("TEST");
TasksUiPlugin.getDefault().getTaskDataManager().setNewTaskData(task2.getHandleIdentifier(), taskData2);
assertNotNull(TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(task2.getHandleIdentifier()));
-
+
manager.refactorRepositoryUrl("http://a", "http://b");
assertNull(manager.getTaskList().getTask("http://a-123"));
assertNotNull(manager.getTaskList().getTask("http://b-123"));
assertNotNull(TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData("http://b-123"));
- RepositoryTaskData otherData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(task2.getHandleIdentifier());
+ RepositoryTaskData otherData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(
+ task2.getHandleIdentifier());
assertNotNull(otherData);
assertEquals("TEST", otherData.getNewComment());
- }
-
+ }
+
public void testMigrateTaskHandlesWithExplicitSet() {
AbstractRepositoryTask task = new MockRepositoryTask("http://a", "123");
task.setTaskUrl("http://a/task/123");
@@ -202,7 +209,7 @@ public class TaskListManagerTest extends TestCase {
assertNull(manager.getTaskList().getTask("http://a-123"));
assertNotNull(manager.getTaskList().getTask("http://b-123"));
assertEquals("http://b/task/123", task.getTaskUrl());
- }
+ }
public void testIsActiveToday() {
ITask task = new Task("1", "task-1", true);
@@ -254,7 +261,7 @@ public class TaskListManagerTest extends TestCase {
task.setCompleted(true);
task.setCompletionDate(new Date());
assertTrue(manager.isCompletedToday(task));
-
+
MockRepositoryTask mockTask = new MockRepositoryTask("1");
mockTask.setOwner("unknown");
manager.getTaskList().addTask(mockTask);
@@ -438,9 +445,7 @@ public class TaskListManagerTest extends TestCase {
TaskList taskList = TasksUiPlugin.getTaskListManager().getTaskList();
taskList.moveToRoot(task);
MockRepositoryQuery query = new MockRepositoryQuery("query", taskList);
- MockQueryHit hit = new MockQueryHit(taskList, repositoryUrl, task.getSummary(), "1");
- hit.setCorrespondingTask(task);
- query.addHit(new MockQueryHit(taskList, repositoryUrl, task.getSummary(), "1"));
+ query.addHit(task);
taskList.addQuery(query);
assertEquals(1, taskList.getAllTasks().size());
assertEquals(1, taskList.getRootTasks().size());
@@ -508,11 +513,12 @@ public class TaskListManagerTest extends TestCase {
Task task1 = new Task(manager.genUniqueTaskHandle(), "task 1", true);
manager.getTaskList().moveToRoot(task1);
rootTasks.add(task1);
-
- Task sub1 = new Task(manager.genUniqueTaskHandle(), "sub 1", true);
+
+ Task sub1 = new Task("subtask-1", "sub 1", true);
task1.addSubTask(sub1);
+ manager.getTaskList().addTask(sub1);
sub1.setParent(task1);
-
+
Task task2 = new Task(manager.genUniqueTaskHandle(), "task 2", true);
manager.getTaskList().moveToRoot(task2);
rootTasks.add(task2);
@@ -577,7 +583,8 @@ public class TaskListManagerTest extends TestCase {
public void testExternalizationOfHandlesWithDash() {
Set<ITask> rootTasks = new HashSet<ITask>();
-// String handle = AbstractRepositoryTask.getHandle("http://url/repo-location", 1);
+// String handle = AbstractRepositoryTask.getHandle("http://url/repo-location",
+// 1);
Task task1 = new Task("http://url/repo-location-1", "task 1", true);
manager.getTaskList().moveToRoot(task1);
rootTasks.add(task1);
@@ -612,40 +619,40 @@ public class TaskListManagerTest extends TestCase {
public void testgetQueriesAndHitsForHandle() {
TaskList taskList = manager.getTaskList();
- MockQueryHit hit1 = new MockQueryHit(taskList, "repositoryURL", "description1", "1");
- MockQueryHit hit2 = new MockQueryHit(taskList, "repositoryURL", "description2", "2");
- MockQueryHit hit3 = new MockQueryHit(taskList, "repositoryURL", "description3", "3");
-
- MockQueryHit hit1twin = new MockQueryHit(taskList, "repositoryURL", "description1", "1");
- MockQueryHit hit2twin = new MockQueryHit(taskList, "repositoryURL", "description2", "2");
- MockQueryHit hit3twin = new MockQueryHit(taskList, "repositoryURL", "description3", "3");
+ MockRepositoryTask hit1 = new MockRepositoryTask("1");
+ MockRepositoryTask hit2 = new MockRepositoryTask("2");
+ MockRepositoryTask hit3 = new MockRepositoryTask("3");
+ MockRepositoryTask hit1twin = new MockRepositoryTask("1");
+ 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);
- assertEquals(query1.getHits().size(), 3);
+ assertEquals(3, query1.getHits().size());
query2.addHit(hit1twin);
query2.addHit(hit2twin);
query2.addHit(hit3twin);
- assertEquals(query2.getHits().size(), 3);
+ assertEquals(3, query2.getHits().size());
manager.getTaskList().addQuery(query1);
manager.getTaskList().addQuery(query2);
Set<AbstractRepositoryQuery> queriesReturned = taskList.getQueriesForHandle(RepositoryTaskHandleUtil.getHandle(
- "repositoryURL", "1"));
+ MockRepositoryConnector.REPOSITORY_URL, "1"));
assertNotNull(queriesReturned);
assertEquals(2, queriesReturned.size());
assertTrue(queriesReturned.contains(query1));
assertTrue(queriesReturned.contains(query2));
Set<String> handles = new HashSet<String>();
- handles.add(RepositoryTaskHandleUtil.getHandle("repositoryURL", "2"));
- Set<AbstractQueryHit> hitsReturned = taskList.getQueryHits(handles);
+ handles.add(RepositoryTaskHandleUtil.getHandle(MockRepositoryConnector.REPOSITORY_URL, "2"));
+ Collection<ITask> hitsReturned = taskList.getTasks(handles);
assertNotNull(hitsReturned);
assertEquals(1, hitsReturned.size());
assertTrue(hitsReturned.contains(hit2));
@@ -653,53 +660,54 @@ public class TaskListManagerTest extends TestCase {
}
- public void testQueryHitHasParent() {
- TaskList taskList = manager.getTaskList();
-
- MockQueryHit hit1 = new MockQueryHit(taskList, MockRepositoryConnector.REPOSITORY_URL, "description1", "1");
- assertNull(hit1.getParent());
- MockRepositoryQuery query1 = new MockRepositoryQuery("query1", manager.getTaskList());
- query1.addHit(hit1);
- assertEquals(query1, hit1.getParent());
-
- }
+// public void testQueryHitHasParent() {
+// TaskList taskList = manager.getTaskList();
+//
+// MockQueryHit hit1 = new MockQueryHit(taskList,
+// MockRepositoryConnector.REPOSITORY_URL, "description1", "1");
+// assertNull(hit1.getParent());
+// MockRepositoryQuery query1 = new MockRepositoryQuery("query1",
+// manager.getTaskList());
+// query1.addHit(hit1);
+// assertEquals(query1, hit1.getParent());
+//
+// }
public void testUpdateQueryHits() {
- TaskList taskList = manager.getTaskList();
+ MockRepositoryTask hit1 = new MockRepositoryTask("1");
+ MockRepositoryTask hit2 = new MockRepositoryTask("2");
+ MockRepositoryTask hit3 = new MockRepositoryTask("3");
- MockQueryHit hit1 = new MockQueryHit(taskList, "repositoryURL", "description1", "1");
- MockQueryHit hit2 = new MockQueryHit(taskList, "repositoryURL", "description2", "2");
- MockQueryHit hit3 = new MockQueryHit(taskList, "repositoryURL", "description3", "3");
-
- MockQueryHit hit1twin = new MockQueryHit(taskList, "repositoryURL", "description1", "1");
- MockQueryHit hit2twin = new MockQueryHit(taskList, "repositoryURL", "description2", "2");
- MockQueryHit hit3twin = new MockQueryHit(taskList, "repositoryURL", "description3", "3");
+ MockRepositoryTask hit1twin = new MockRepositoryTask("1");
+ 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);
+
assertEquals(3, query1.getHits().size());
- List<AbstractQueryHit> newHits = new ArrayList<AbstractQueryHit>();
- query1.updateHits(newHits, manager.getTaskList());
+ Set<AbstractRepositoryTask> newHits = new HashSet<AbstractRepositoryTask>();
+ query1.updateHits(newHits);
assertEquals(0, query1.getHits().size());
newHits.add(hit1);
newHits.add(hit2);
- query1.updateHits(newHits, manager.getTaskList());
+ query1.updateHits(newHits);
assertEquals(2, query1.getHits().size());
hit1.setNotified(true);
newHits.clear();
newHits.add(hit1twin);
newHits.add(hit2twin);
newHits.add(hit3twin);
- query1.updateHits(newHits, manager.getTaskList());
+ query1.updateHits(newHits);
assertEquals(3, query1.getHits().size());
assertTrue(query1.getHits().contains(hit1twin));
assertTrue(query1.getHits().contains(hit2twin));
assertTrue(query1.getHits().contains(hit3twin));
- for (AbstractQueryHit hit : query1.getHits()) {
+ for (AbstractRepositoryTask hit : query1.getHits()) {
if (hit.equals(hit1twin)) {
assertTrue(hit.isNotified());
} else {
@@ -758,11 +766,12 @@ public class TaskListManagerTest extends TestCase {
assertEquals(RepositoryTaskSyncState.SYNCHRONIZED, task2.getSyncState());
manager.getTaskList().reset();
- MockQueryHit hit1 = new MockQueryHit(manager.getTaskList(), repositoryUrl, "summary", "1");
- MockQueryHit hit2 = new MockQueryHit(manager.getTaskList(), repositoryUrl, "summary", "2");
+ MockRepositoryTask hit1 = new MockRepositoryTask("1");
+ MockRepositoryTask hit2 = new MockRepositoryTask("2");
MockRepositoryQuery query = new MockRepositoryQuery("summary", manager.getTaskList());
query.addHit(hit1);
query.addHit(hit2);
+
manager.getTaskList().addQuery(query);
elements.clear();
@@ -794,8 +803,8 @@ public class TaskListManagerTest extends TestCase {
assertEquals(RepositoryTaskSyncState.INCOMING, task2.getSyncState());
manager.getTaskList().reset();
- MockQueryHit hit1 = new MockQueryHit(manager.getTaskList(), repositoryUrl, "summary", "1");
- MockQueryHit hit2 = new MockQueryHit(manager.getTaskList(), repositoryUrl, "summary", "2");
+ MockRepositoryTask hit1 = new MockRepositoryTask("1");
+ MockRepositoryTask hit2 = new MockRepositoryTask("2");
MockRepositoryQuery query = new MockRepositoryQuery("summary", manager.getTaskList());
query.addHit(hit1);
query.addHit(hit2);
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockQueryHit.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockQueryHit.java
deleted file mode 100644
index f9c73f5e1..000000000
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockQueryHit.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2006 Mylar committers 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
- *******************************************************************************/
-
-package org.eclipse.mylar.tasks.tests.connector;
-
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
-import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
-import org.eclipse.mylar.tasks.core.TaskList;
-
-/**
- * @author Rob Elves
- *
- */
-public class MockQueryHit extends AbstractQueryHit {
-
- public MockQueryHit(TaskList taskList, String repositoryUrl, String description, String id) {
- super(taskList, repositoryUrl, description, id);
- }
-
- @Override
- protected AbstractRepositoryTask createTask() {
- return new MockRepositoryTask(repositoryUrl, taskId, taskId);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryConnector.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryConnector.java
index db2122557..e79bc0a5e 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryConnector.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryConnector.java
@@ -128,19 +128,13 @@ public class MockRepositoryConnector extends AbstractRepositoryConnector {
}
@Override
- public IStatus performQuery(AbstractRepositoryQuery query, TaskRepository repository, IProgressMonitor monitor,
- QueryHitCollector resultCollector) {
- return null;
- }
-
- @Override
public Set<AbstractRepositoryTask> getChangedSinceLastSync(TaskRepository repository,
Set<AbstractRepositoryTask> tasks) throws CoreException {
return Collections.emptySet();
}
@Override
- protected AbstractRepositoryTask makeTask(String repositoryUrl, String id, String summary) {
+ public AbstractRepositoryTask createTask(String repositoryUrl, String id, String summary) {
// ignore
return null;
}
@@ -152,4 +146,11 @@ public class MockRepositoryConnector extends AbstractRepositoryConnector {
}
+ @Override
+ public IStatus performQuery(AbstractRepositoryQuery query, TaskRepository repository, IProgressMonitor monitor,
+ QueryHitCollector resultCollector, boolean forced) {
+ // ignore
+ return null;
+ }
+
}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryExternalizer.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryExternalizer.java
index aedc146da..0b5fc8c3a 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryExternalizer.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryExternalizer.java
@@ -11,7 +11,6 @@
package org.eclipse.mylar.tasks.tests.connector;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
import org.eclipse.mylar.tasks.core.DelegatingTaskExternalizer;
@@ -38,10 +37,10 @@ public class MockRepositoryExternalizer extends DelegatingTaskExternalizer {
return task instanceof MockRepositoryTask;
}
- @Override
- public boolean canCreateElementFor(AbstractQueryHit queryHit) {
- return queryHit instanceof AbstractQueryHit;
- }
+// @Override
+// public boolean canCreateElementFor(AbstractQueryHit queryHit) {
+// return queryHit instanceof AbstractQueryHit;
+// }
@Override
public boolean canReadCategory(Node node) {
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 7d3f8cf47..d4f0b2376 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.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
import org.eclipse.mylar.tasks.core.ITask;
@@ -101,12 +100,6 @@ public class MoveToCategoryMenuContributor implements IDynamicSubMenuContributor
if (element instanceof ITask) {
TasksUiPlugin.getTaskListManager().getTaskList().moveToContainer(category,
(ITask) element);
- } else if (element instanceof AbstractQueryHit) {
- ITask task = ((AbstractQueryHit) element).getOrCreateCorrespondingTask();
- if (task != null) {
- TasksUiPlugin.getTaskListManager().getTaskList().moveToContainer(category,
- task);
- }
}
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PlanningPerspectiveFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PlanningPerspectiveFactory.java
index 5fc737a8a..2f0a42302 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PlanningPerspectiveFactory.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PlanningPerspectiveFactory.java
@@ -34,7 +34,7 @@ public class PlanningPerspectiveFactory implements IPerspectiveFactory {
public void defineActions(IPageLayout layout) {
layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
layout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET);
- layout.addShowViewShortcut(TaskListView.ID_VIEW);
+ layout.addShowViewShortcut(TaskListView.ID);
// layout.addShowViewShortcut(TaskActivityView.ID);
layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
@@ -45,7 +45,7 @@ public class PlanningPerspectiveFactory implements IPerspectiveFactory {
String editorArea = layout.getEditorArea();
IFolderLayout topRight = layout.createFolder("topRight", IPageLayout.RIGHT, (float) 0.6, editorArea);//$NON-NLS-1$
- topRight.addView(TaskListView.ID_VIEW);
+ topRight.addView(TaskListView.ID);
// IFolderLayout bottomLeft = layout.createFolder(
// "bottomLeft", IPageLayout.BOTTOM, (float) 0.50,//$NON-NLS-1$
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 8434852fa..2fe25b772 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,7 +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.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
import org.eclipse.mylar.tasks.core.ITask;
@@ -55,7 +54,7 @@ public class ScheduleTaskMenuContributor implements IDynamicSubMenuContributor {
public MenuManager getSubMenuManager(final List<ITaskListElement> selectedElements) {
final TaskListManager tasklistManager = TasksUiPlugin.getTaskListManager();
-
+
final MenuManager subMenuManager = new MenuManager(LABEL_REMINDER);
subMenuManager
@@ -65,14 +64,14 @@ public class ScheduleTaskMenuContributor implements IDynamicSubMenuContributor {
ITaskListElement singleSelection = null;
if (selectedElements.size() == 1) {
ITaskListElement selectedElement = selectedElements.get(0);
- if (selectedElement instanceof ITask || selectedElement instanceof AbstractQueryHit) {
+ if (selectedElement instanceof ITask) {
singleSelection = selectedElement;
}
}
final ITask singleTaskSelection = tasklistManager.getTaskForElement(singleSelection, false);
final List<ITaskListElement> taskListElementsToSchedule = new ArrayList<ITaskListElement>();
for (ITaskListElement selectedElement : selectedElements) {
- if (selectedElement instanceof ITask || selectedElement instanceof AbstractQueryHit) {
+ if (selectedElement instanceof ITask) {
taskListElementsToSchedule.add(selectedElement);
}
// if (selectedElement instanceof ITask) {
@@ -148,7 +147,7 @@ public class ScheduleTaskMenuContributor implements IDynamicSubMenuContributor {
ITask task = tasklistManager.getTaskForElement(element, true);
Calendar startNextWeek = Calendar.getInstance();
TasksUiPlugin.getTaskListManager().setScheduledNextWeek(startNextWeek);
- TasksUiPlugin.getTaskListManager().setScheduledFor(task, startNextWeek.getTime());
+ TasksUiPlugin.getTaskListManager().setScheduledFor(task, startNextWeek.getTime());
}
}
};
@@ -197,9 +196,7 @@ public class ScheduleTaskMenuContributor implements IDynamicSubMenuContributor {
if (result == Window.OK) {
for (ITaskListElement element : taskListElementsToSchedule) {
ITask task = null;
- if (element instanceof AbstractQueryHit) {
- task = ((AbstractQueryHit) element).getOrCreateCorrespondingTask();
- } else if (element instanceof ITask) {
+ if (element instanceof ITask) {
task = (ITask) element;
}
TasksUiPlugin.getTaskListManager().setScheduledFor(task, reminderDialog.getDate());
@@ -257,11 +254,9 @@ public class ScheduleTaskMenuContributor implements IDynamicSubMenuContributor {
private boolean canSchedule(ITaskListElement singleSelection, List<ITaskListElement> elements) {
if (singleSelection instanceof ITask) {
return ((!((ITask) singleSelection).isCompleted()) || elements.size() > 0);
- } else if (singleSelection instanceof AbstractQueryHit) {
- return ((!((AbstractQueryHit) singleSelection).isCompleted()) || elements.size() > 0);
} else {
return elements.size() > 0;
- }
+ }
// return (singleSelection != null && !singleSelection.isCompleted())
// || elements.size() > 0;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskCompletionFilter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskCompletionFilter.java
index 0f8612b82..252fae5f5 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskCompletionFilter.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskCompletionFilter.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.mylar.internal.tasks.ui;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
@@ -21,24 +20,14 @@ public class TaskCompletionFilter extends AbstractTaskListFilter {
@Override
public boolean select(Object parent, Object element) {
- boolean exposeSubTasks = !TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(TaskListPreferenceConstants.FILTER_SUBTASKS);
+ boolean exposeSubTasks = !TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
+ TaskListPreferenceConstants.FILTER_SUBTASKS);
if (element instanceof ITask) {
ITask task = (ITask) element;
if (shouldAlwaysShow(parent, task, exposeSubTasks)) {
return true;
}
return !task.isCompleted();
- } else if (element instanceof AbstractQueryHit) {
- AbstractQueryHit hit = (AbstractQueryHit) element;
- if (hit.getCorrespondingTask() != null) {
- if (shouldAlwaysShow(parent, hit.getCorrespondingTask(), exposeSubTasks)) {
- return true;
- } else {
- return !hit.getCorrespondingTask().isCompleted();
- }
- } else {
- return !hit.isCompleted();
- }
}
return true;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskLabelDecorator.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskLabelDecorator.java
index 330dcc22c..c26b97f4e 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskLabelDecorator.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskLabelDecorator.java
@@ -19,7 +19,6 @@ import org.eclipse.jface.viewers.IDecoration;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ILightweightLabelDecorator;
import org.eclipse.mylar.internal.tasks.ui.views.TaskElementLabelProvider;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.ITask;
@@ -32,12 +31,12 @@ import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
public class TaskLabelDecorator implements ILightweightLabelDecorator {
public void decorate(Object element, IDecoration decoration) {
-
+
ImageDescriptor priorityOverlay = TaskElementLabelProvider.getPriorityImageDescriptor(element);
if (priorityOverlay != null) {
decoration.addOverlay(priorityOverlay, IDecoration.BOTTOM_LEFT);
}
-
+
if (element instanceof AbstractRepositoryQuery) {
AbstractRepositoryQuery query = (AbstractRepositoryQuery) element;
String repositoryUrl = query.getRepositoryUrl();
@@ -61,9 +60,6 @@ public class TaskLabelDecorator implements ILightweightLabelDecorator {
} else if (!task.isCompleted() && task.getDueDate() != null) {
decoration.addOverlay(TasksUiImages.OVERLAY_HAS_DUE, IDecoration.TOP_RIGHT);
}
- } else if (element instanceof AbstractQueryHit) {
- ITask correspondingTask = ((AbstractQueryHit) element).getCorrespondingTask();
- decorate(correspondingTask, decoration);
} else if (element instanceof ITask) {
ITask task = (ITask) element;
if (!task.isCompleted() && TasksUiPlugin.getTaskListManager().isOverdue(task)) {
@@ -76,7 +72,7 @@ public class TaskLabelDecorator implements ILightweightLabelDecorator {
}
}
}
-
+
public void addListener(ILabelProviderListener listener) {
// ignore
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListNotificationQueryIncoming.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListNotificationQueryIncoming.java
index d9e71f08e..0078a1575 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListNotificationQueryIncoming.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListNotificationQueryIncoming.java
@@ -15,7 +15,7 @@ import java.util.Date;
import org.eclipse.jface.viewers.DecoratingLabelProvider;
import org.eclipse.mylar.internal.tasks.ui.views.TaskElementLabelProvider;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
+import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.ui.TasksUiUtil;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.PlatformUI;
@@ -25,14 +25,14 @@ import org.eclipse.ui.PlatformUI;
*/
public class TaskListNotificationQueryIncoming implements ITaskListNotification {
- private final AbstractQueryHit hit;
+ private final AbstractRepositoryTask hit;
private DecoratingLabelProvider labelProvider = new DecoratingLabelProvider(new TaskElementLabelProvider(),
PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator());
private Date date;
- public TaskListNotificationQueryIncoming(AbstractQueryHit hit) {
+ public TaskListNotificationQueryIncoming(AbstractRepositoryTask hit) {
this.hit = hit;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskPriorityFilter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskPriorityFilter.java
index f870923d8..a2f2b8cb6 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskPriorityFilter.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskPriorityFilter.java
@@ -11,7 +11,6 @@
package org.eclipse.mylar.internal.tasks.ui;
import org.eclipse.mylar.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.ITaskListElement;
import org.eclipse.mylar.tasks.core.Task;
@@ -30,19 +29,16 @@ public class TaskPriorityFilter extends AbstractTaskListFilter {
public TaskPriorityFilter() {
displayPrioritiesAbove(TaskListView.getCurrentPriorityLevel());
}
-
+
public void displayPrioritiesAbove(String level) {
priorityLevel = level;
}
@Override
public boolean select(Object parent, Object element) {
- boolean exposeSubTasks = !TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(TaskListPreferenceConstants.FILTER_SUBTASKS);
+ boolean exposeSubTasks = !TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
+ TaskListPreferenceConstants.FILTER_SUBTASKS);
if (element instanceof ITaskListElement) {
- if (element instanceof AbstractQueryHit && ((AbstractQueryHit) element).getCorrespondingTask() != null) {
- element = ((AbstractQueryHit) element).getCorrespondingTask();
- }
-
if (element instanceof ITask) {
ITask task = (ITask) element;
if (shouldAlwaysShow(parent, task, exposeSubTasks)) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskStatusMenuContributor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskStatusMenuContributor.java
index 57be115e9..98d28275d 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskStatusMenuContributor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskStatusMenuContributor.java
@@ -13,7 +13,6 @@ import java.util.List;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.mylar.internal.tasks.core.WebQueryHit;
import org.eclipse.mylar.internal.tasks.ui.actions.ClearOutgoingAction;
import org.eclipse.mylar.internal.tasks.ui.actions.MarkTaskCompleteAction;
import org.eclipse.mylar.internal.tasks.ui.actions.MarkTaskIncompleteAction;
@@ -35,8 +34,6 @@ public class TaskStatusMenuContributor implements IDynamicSubMenuContributor {
if (selectedElements.size() == 1) {
if (selectedElements.get(0) instanceof ITask) {
singleTask = (ITask)selectedElements.get(0);
- } else if (selectedElements.get(0) instanceof WebQueryHit) {
- singleTask = ((WebQueryHit)selectedElements.get(0)).getCorrespondingTask();
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractRepositoryTasksAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractRepositoryTasksAction.java
index 32eb07297..4b026be72 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractRepositoryTasksAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractRepositoryTasksAction.java
@@ -11,7 +11,6 @@ package org.eclipse.mylar.internal.tasks.ui.actions;
import java.util.List;
import org.eclipse.jface.action.Action;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
@@ -25,26 +24,17 @@ import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
public abstract class AbstractRepositoryTasksAction extends Action {
protected List<ITaskListElement> selectedElements;
-
+
@Override
public void run() {
- for (ITaskListElement element : selectedElements) {
+ for (ITaskListElement element : selectedElements) {
if (element instanceof AbstractRepositoryTask) {
AbstractRepositoryTask repositoryTask = (AbstractRepositoryTask) element;
performActionOnTask(repositoryTask);
- } else if (element instanceof AbstractQueryHit) {
- AbstractQueryHit queryHit = (AbstractQueryHit) element;
- AbstractRepositoryTask repositoryTask = queryHit.getOrCreateCorrespondingTask();
- if (repositoryTask != null) {
- performActionOnTask(repositoryTask);
- }
} else if (element instanceof AbstractRepositoryQuery) {
AbstractRepositoryQuery repositoryQuery = (AbstractRepositoryQuery) element;
- for (AbstractQueryHit queryHit : repositoryQuery.getHits()) {
- AbstractRepositoryTask repositoryTask = queryHit.getOrCreateCorrespondingTask();
- if (repositoryTask != null) {
- performActionOnTask(repositoryTask);
- }
+ for (AbstractRepositoryTask queryHit : repositoryQuery.getHits()) {
+ performActionOnTask(queryHit);
}
} else if (element instanceof AbstractTaskContainer) {
AbstractTaskContainer container = (AbstractTaskContainer) element;
@@ -56,12 +46,12 @@ public abstract class AbstractRepositoryTasksAction extends Action {
}
}
}
- }
-
+ }
+
protected abstract void performActionOnTask(AbstractRepositoryTask repositoryTask);
-
+
protected boolean containsArchiveContainer(List<ITaskListElement> selectedElements) {
return selectedElements.contains(TasksUiPlugin.getTaskListManager().getTaskList().getArchiveContainer());
}
-
+
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ActivateTaskDialogAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ActivateTaskDialogAction.java
index a70951abd..6ce491c89 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ActivateTaskDialogAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ActivateTaskDialogAction.java
@@ -13,7 +13,6 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.window.Window;
import org.eclipse.mylar.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.ui.TaskListManager;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
@@ -57,13 +56,6 @@ public class ActivateTaskDialogAction extends ActionDelegate implements IWorkben
ITask task = (ITask) result;
manager.activateTask(task);
manager.getTaskActivationHistory().addTask(task);
- } else if (result instanceof AbstractQueryHit) {
- AbstractQueryHit hit = (AbstractQueryHit) result;
- ITask task = hit.getOrCreateCorrespondingTask();
- if (task != null) {
- manager.activateTask(task);
- manager.getTaskActivationHistory().addTask(task);
- }
}
if (TaskListView.getFromActivePerspective() != null) {
TaskListView.getFromActivePerspective().refreshAndFocus(false);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ClearOutgoingAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ClearOutgoingAction.java
index d7112c23b..d2d26db16 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ClearOutgoingAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ClearOutgoingAction.java
@@ -16,16 +16,14 @@ import java.util.List;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
-import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.ITaskListElement;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask.RepositoryTaskSyncState;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
/**
- * Discard outgoing changes on selected task
- * TODO: Enable multi task discard?
+ * Discard outgoing changes on selected task TODO: Enable multi task discard?
+ *
* @author Rob Elves
*/
public class ClearOutgoingAction extends Action {
@@ -35,7 +33,7 @@ public class ClearOutgoingAction extends Action {
public static final String ID = "org.eclipse.mylar.tasklist.actions.mark.discard";
private List<ITaskListElement> selectedElements;
-
+
public ClearOutgoingAction(List<ITaskListElement> selectedElements) {
this.selectedElements = selectedElements;
setText(ACTION_NAME);
@@ -44,10 +42,6 @@ public class ClearOutgoingAction extends Action {
if (selectedElements.size() == 1 && (selectedElements.get(0) instanceof AbstractRepositoryTask)) {
AbstractRepositoryTask task = (AbstractRepositoryTask) selectedElements.get(0);
setEnabled(task.getSyncState().equals(RepositoryTaskSyncState.OUTGOING));
- } else if (selectedElements.size() == 1 && (selectedElements.get(0) instanceof AbstractQueryHit)) {
- AbstractQueryHit hit = ((AbstractQueryHit)(selectedElements.get(0)));
- AbstractRepositoryTask task = hit.getCorrespondingTask();
- setEnabled(task != null && task.getSyncState().equals(RepositoryTaskSyncState.OUTGOING));
} else {
setEnabled(false);
}
@@ -61,15 +55,11 @@ public class ClearOutgoingAction extends Action {
&& ((AbstractRepositoryTask) selectedObject).getSyncState()
.equals(RepositoryTaskSyncState.OUTGOING)) {
toClear.add(((AbstractRepositoryTask) selectedObject));
- } else if (selectedObject instanceof AbstractQueryHit) {
- ITask task = ((AbstractQueryHit) selectedObject).getCorrespondingTask();
- if (task instanceof AbstractRepositoryTask) {
- toClear.add(((AbstractRepositoryTask) task));
- }
}
}
if (toClear.size() > 0) {
- boolean confirm = MessageDialog.openConfirm(null, "Confirm discard", "Discard all outgoing changes?\n\n"+(toClear.get(0)).getSummary());
+ boolean confirm = MessageDialog.openConfirm(null, "Confirm discard", "Discard all outgoing changes?\n\n"
+ + (toClear.get(0)).getSummary());
if (confirm) {
TasksUiPlugin.getSynchronizationManager().discardOutgoing(toClear.get(0));
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyTaskDetailsAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyTaskDetailsAction.java
index fd1b6a326..22f538664 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyTaskDetailsAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyTaskDetailsAction.java
@@ -13,7 +13,6 @@ package org.eclipse.mylar.internal.tasks.ui.actions;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylar.internal.tasks.ui.TasksUiImages;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
@@ -39,7 +38,7 @@ public class CopyTaskDetailsAction extends BaseSelectionListenerAction {
public static final String ID = "org.eclipse.mylar.tasklist.actions.copy";
private Clipboard clipboard;
-
+
public CopyTaskDetailsAction(boolean setAccelerator) {
super(LABEL);
setToolTipText(LABEL);
@@ -48,9 +47,9 @@ public class CopyTaskDetailsAction extends BaseSelectionListenerAction {
if (setAccelerator) {
setAccelerator(SWT.MOD1 + 'c');
}
-
+
Display display = PlatformUI.getWorkbench().getDisplay();
- clipboard = new Clipboard(display);
+ clipboard = new Clipboard(display);
}
@Override
@@ -59,19 +58,15 @@ public class CopyTaskDetailsAction extends BaseSelectionListenerAction {
Object object = ((IStructuredSelection) selection).getFirstElement();
String text = getTextForTask(object);
-
TextTransfer textTransfer = TextTransfer.getInstance();
- clipboard.setContents(new Object[] { text },
- new Transfer[] { textTransfer });
+ clipboard.setContents(new Object[] { text }, new Transfer[] { textTransfer });
}
public static String getTextForTask(Object object) {
String text = "";
- if (object instanceof ITask || object instanceof AbstractQueryHit) {
+ if (object instanceof ITask) {
ITask task = null;
- if (object instanceof AbstractQueryHit) {
- task = ((AbstractQueryHit) object).getCorrespondingTask();
- } else if (object instanceof ITask) {
+ if (object instanceof ITask) {
task = (ITask) object;
}
if (task != null) {
@@ -83,8 +78,6 @@ public class CopyTaskDetailsAction extends BaseSelectionListenerAction {
if (task.hasValidUrl()) {
text += "\n" + task.getTaskUrl();
}
- } else {
- text += ((AbstractQueryHit) object).getSummary();
}
} else if (object instanceof AbstractRepositoryQuery) {
AbstractRepositoryQuery query = (AbstractRepositoryQuery) object;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteAction.java
index 42e235200..ac55de265 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteAction.java
@@ -19,7 +19,6 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylar.context.core.ContextCorePlugin;
import org.eclipse.mylar.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.ITaskListElement;
@@ -51,7 +50,8 @@ public class DeleteAction extends Action {
String message = "Delete the elements listed? If categories or queries are selected contained tasks"
+ " will not be deleted. Contexts will be deleted for selected tasks.\n\n";
-// + "This operation cannot be undone (the Task List can be restored from history).\n\n";
+// + "This operation cannot be undone (the Task List can be restored from
+// history).\n\n";
int i = 0;
for (Object object : toDelete) {
i++;
@@ -71,19 +71,13 @@ public class DeleteAction extends Action {
}
for (Object selectedObject : toDelete) {
- if (selectedObject instanceof ITask || selectedObject instanceof AbstractQueryHit) {
+ if (selectedObject instanceof ITask) {
ITask task = null;
- if (selectedObject instanceof AbstractQueryHit) {
- task = ((AbstractQueryHit) selectedObject).getCorrespondingTask();
- } else {
- task = (ITask) selectedObject;
- }
- if (task != null) {
- TasksUiPlugin.getTaskListManager().deactivateTask(task);
- TasksUiPlugin.getTaskListManager().getTaskList().deleteTask(task);
- ContextCorePlugin.getContextManager().deleteContext(task.getHandleIdentifier());
- TasksUiUtil.closeEditorInActivePage(task);
- }
+ task = (ITask) selectedObject;
+ TasksUiPlugin.getTaskListManager().deactivateTask(task);
+ TasksUiPlugin.getTaskListManager().getTaskList().deleteTask(task);
+ ContextCorePlugin.getContextManager().deleteContext(task.getHandleIdentifier());
+ TasksUiUtil.closeEditorInActivePage(task);
} else if (selectedObject instanceof AbstractRepositoryQuery) {
// boolean deleteConfirmed =
// MessageDialog.openQuestion(PlatformUI.getWorkbench()
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/MarkTaskCompleteAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/MarkTaskCompleteAction.java
index fa7c8861d..6b42f8662 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/MarkTaskCompleteAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/MarkTaskCompleteAction.java
@@ -14,10 +14,8 @@ package org.eclipse.mylar.internal.tasks.ui.actions;
import java.util.List;
import org.eclipse.jface.action.Action;
-import org.eclipse.mylar.internal.tasks.core.WebQueryHit;
import org.eclipse.mylar.internal.tasks.core.WebTask;
import org.eclipse.mylar.internal.tasks.ui.TasksUiImages;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.ITaskListElement;
import org.eclipse.mylar.tasks.core.Task;
@@ -29,29 +27,29 @@ import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
public class MarkTaskCompleteAction extends Action {
public static final String ID = "org.eclipse.mylar.tasklist.actions.mark.completed";
-
+
private static final String ACTION_NAME = "Complete";
-
+
private List<ITaskListElement> selectedElements;
-
+
public MarkTaskCompleteAction(List<ITaskListElement> selectedElements) {
this.selectedElements = selectedElements;
setText(ACTION_NAME);
- setToolTipText("Mark "+ACTION_NAME);
+ setToolTipText("Mark " + ACTION_NAME);
setId(ID);
setImageDescriptor(TasksUiImages.TASK_COMPLETE);
- if(selectedElements.size() == 1 && (selectedElements.get(0) instanceof Task)) {
- Task task = (Task)selectedElements.get(0);
+ if (selectedElements.size() == 1 && (selectedElements.get(0) instanceof Task)) {
+ Task task = (Task) selectedElements.get(0);
if (task instanceof WebTask) {
setEnabled(true);
} else {
setEnabled(task.isLocal());
}
- } else if (selectedElements.size() == 1 && (selectedElements.get(0) instanceof WebQueryHit)) {
- setEnabled(true);
+// } else if (selectedElements.size() == 1 && (selectedElements.get(0) instanceof WebQueryHit)) {
+// setEnabled(true);
} else {
setEnabled(false);
- }
+ }
}
@Override
@@ -59,11 +57,6 @@ public class MarkTaskCompleteAction extends Action {
for (Object selectedObject : selectedElements) {
if (selectedObject instanceof ITask) {
TasksUiPlugin.getTaskListManager().getTaskList().markComplete(((ITask) selectedObject), true);
- } else if (selectedObject instanceof AbstractQueryHit) {
- ITask task = ((AbstractQueryHit)selectedObject).getCorrespondingTask();
- if (task instanceof WebTask) {
- TasksUiPlugin.getTaskListManager().getTaskList().markComplete(task, true);
- }
}
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/MarkTaskIncompleteAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/MarkTaskIncompleteAction.java
index 9b56d973e..ff53f836a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/MarkTaskIncompleteAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/MarkTaskIncompleteAction.java
@@ -14,10 +14,7 @@ package org.eclipse.mylar.internal.tasks.ui.actions;
import java.util.List;
import org.eclipse.jface.action.Action;
-import org.eclipse.mylar.internal.tasks.core.WebQueryHit;
-import org.eclipse.mylar.internal.tasks.core.WebTask;
import org.eclipse.mylar.internal.tasks.ui.TasksUiImages;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.ITaskListElement;
import org.eclipse.mylar.tasks.core.Task;
@@ -33,17 +30,18 @@ public class MarkTaskIncompleteAction extends Action {
public static final String ID = "org.eclipse.mylar.tasklist.actions.mark.incomplete";
private List<ITaskListElement> selectedElements;
+
public MarkTaskIncompleteAction(List<ITaskListElement> selectedElements) {
this.selectedElements = selectedElements;
setText(ACTION_NAME);
- setToolTipText("Mark "+ACTION_NAME);
+ setToolTipText("Mark " + ACTION_NAME);
setId(ID);
setImageDescriptor(TasksUiImages.TASK_INCOMPLETE);
- if(selectedElements.size() == 1 && (selectedElements.get(0) instanceof ITask)) {
- Task task = (Task)selectedElements.get(0);
+ if (selectedElements.size() == 1 && (selectedElements.get(0) instanceof ITask)) {
+ Task task = (Task) selectedElements.get(0);
setEnabled(task.isLocal());
- } else if (selectedElements.size() == 1 && (selectedElements.get(0) instanceof WebQueryHit)) {
- setEnabled(true);
+// } else if (selectedElements.size() == 1 && (selectedElements.get(0) instanceof WebQueryHit)) {
+// setEnabled(true);
} else {
setEnabled(false);
}
@@ -54,11 +52,6 @@ public class MarkTaskIncompleteAction extends Action {
for (Object selectedObject : selectedElements) {
if (selectedObject instanceof ITask) {
TasksUiPlugin.getTaskListManager().getTaskList().markComplete(((ITask) selectedObject), false);
- } else if (selectedObject instanceof AbstractQueryHit) {
- ITask task = ((AbstractQueryHit)selectedObject).getCorrespondingTask();
- if (task instanceof WebTask) {
- TasksUiPlugin.getTaskListManager().getTaskList().markComplete(task, false);
- }
}
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskAction.java
index b904e1902..613eec0bf 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskAction.java
@@ -12,7 +12,6 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.window.Window;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
import org.eclipse.mylar.tasks.ui.TasksUiUtil;
@@ -67,20 +66,6 @@ public class OpenTaskAction extends ActionDelegate implements IWorkbenchWindowAc
TasksUiUtil.refreshAndOpenTaskListElement(task);
TasksUiPlugin.getTaskListManager().getTaskActivationHistory().addTask(task);
}
- } else if (result instanceof AbstractQueryHit) {
- AbstractQueryHit hit = (AbstractQueryHit) result;
- ITask task = hit.getOrCreateCorrespondingTask();
- if (task != null) {
- if (dlg.getOpenInBrowser()) {
- if (task.hasValidUrl()) {
- TasksUiUtil.openUrl(task.getTaskUrl(), false);
- TasksUiPlugin.getTaskListManager().getTaskActivationHistory().addTask(task);
- }
- } else {
- TasksUiUtil.refreshAndOpenTaskListElement(task);
- TasksUiPlugin.getTaskListManager().getTaskActivationHistory().addTask(task);
- }
- }
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenWithBrowserAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenWithBrowserAction.java
index 46c8441f5..c56a49656 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenWithBrowserAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenWithBrowserAction.java
@@ -13,7 +13,6 @@ package org.eclipse.mylar.internal.tasks.ui.actions;
import java.util.Iterator;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.ui.TasksUiUtil;
@@ -52,9 +51,6 @@ public class OpenWithBrowserAction extends BaseSelectionListenerAction {
if (task != null && task.hasValidUrl()) {
urlString = task.getTaskUrl();
}
- } else if (selectedObject instanceof AbstractQueryHit) {
- AbstractQueryHit hit = (AbstractQueryHit) selectedObject;
- urlString = hit.getUrl();
} else if (selectedObject instanceof AbstractTaskContainer) {
AbstractTaskContainer query = (AbstractTaskContainer) selectedObject;
urlString = query.getUrl();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeSelectedAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeSelectedAction.java
index 3202db169..a772a4f62 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeSelectedAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeSelectedAction.java
@@ -24,7 +24,6 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylar.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
@@ -81,13 +80,6 @@ public class SynchronizeSelectedAction extends ActionDelegate implements IViewAc
AbstractRepositoryConnector client = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
repositoryTask.getRepositoryKind());
addTaskToSync(client, repositoryTask);
- } else if (obj instanceof AbstractQueryHit) {
- AbstractQueryHit hit = (AbstractQueryHit) obj;
- if (hit.getOrCreateCorrespondingTask() != null) {
- AbstractRepositoryConnector client = TasksUiPlugin.getRepositoryManager()
- .getRepositoryConnector(hit.getCorrespondingTask().getRepositoryKind());
- addTaskToSync(client, hit.getCorrespondingTask());
- }
}
}
@@ -115,10 +107,10 @@ public class SynchronizeSelectedAction extends ActionDelegate implements IViewAc
TasksUiPlugin.getSynchronizationManager().synchronize(connector, new HashSet<AbstractRepositoryQuery>(queriesToSync), null, Job.LONG, 0,
false, true);
}
-
- for (TaskRepository taskRepository : repositoriesToSync.get(connector.getRepositoryType())) {
- TasksUiPlugin.getSynchronizationManager().synchronizeChanged(connector, taskRepository);
- }
+ //XXX enable?
+// for (TaskRepository taskRepository : repositoriesToSync.get(connector.getRepositoryType())) {
+// TasksUiPlugin.getSynchronizationManager().synchronizeChanged(connector, taskRepository);
+// }
}
}
if (!tasksToSyncMap.isEmpty()) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskSelectionDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskSelectionDialog.java
index d45d22772..478a1a431 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskSelectionDialog.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskSelectionDialog.java
@@ -28,7 +28,6 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.mylar.internal.tasks.ui.views.TaskElementLabelProvider;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.ITask;
@@ -92,11 +91,7 @@ public class TaskSelectionDialog extends SelectionStatusDialog {
} else if (element instanceof ITask) {
String taskString = ((ITask) element).getSummary();
return pattern.matcher(taskString).find();
- } else if (element instanceof AbstractQueryHit) {
- AbstractQueryHit hit = (AbstractQueryHit) element;
- String taskString = hit.getIdentifyingLabel() + ": " + hit.getSummary();
- return pattern.matcher(taskString).find();
- }
+ }
return false;
}
}
@@ -166,10 +161,8 @@ public class TaskSelectionDialog extends SelectionStatusDialog {
for (AbstractRepositoryQuery query : taskList.getQueries()) {
allTasks.addAll(query.getChildren());
// TODO: should not need to do this
- for (AbstractQueryHit hit : query.getHits()) {
- if (hit.getCorrespondingTask() == null) {
+ for (ITask hit : query.getHits()) {
allTasks.add(hit);
- }
}
}
@@ -194,10 +187,6 @@ public class TaskSelectionDialog extends SelectionStatusDialog {
if (o instanceof ITask) {
return (ITask) o;
}
- if (o instanceof AbstractQueryHit) {
- AbstractQueryHit hit = (AbstractQueryHit) o;
- return hit.getCorrespondingTask();
- }
return null;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java
index 6fcd3b6b7..913a0c43a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java
@@ -37,7 +37,6 @@ import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.mylar.core.MylarStatusHandler;
import org.eclipse.mylar.internal.tasks.ui.views.TaskElementLabelProvider;
import org.eclipse.mylar.internal.tasks.ui.views.TaskRepositoryLabelProvider;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
@@ -278,13 +277,6 @@ public class RemoteTaskSelectionDialog extends SelectionStatusDialog {
AbstractRepositoryQuery query = (AbstractRepositoryQuery) element;
return getRepository(query.getRepositoryUrl(), query.getRepositoryKind());
- } else if (element instanceof AbstractQueryHit) {
- AbstractQueryHit queryHit = (AbstractQueryHit) element;
- if (queryHit.getParent() != null) {
- return getRepository(queryHit.getRepositoryUrl(), queryHit.getParent().getRepositoryKind());
- } else {
- return TasksUiPlugin.getRepositoryManager().getRepository(queryHit.getRepositoryUrl());
- }
} else if (element instanceof AbstractRepositoryTask) {
AbstractRepositoryTask task = (AbstractRepositoryTask) element;
return getRepository(task.getRepositoryUrl(), task.getRepositoryKind());
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/planner/TaskActivityWizardPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/planner/TaskActivityWizardPage.java
index 16b4eaa4e..9677bb3a0 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/planner/TaskActivityWizardPage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/planner/TaskActivityWizardPage.java
@@ -55,8 +55,6 @@ public class TaskActivityWizardPage extends WizardPage {
private static final String DESCRIPTION = "Summarizes task activity and assists planning future tasks.";
- public static final String ROOT_CATEGORY_HACK = "Root Tasks";
-
private long DAY = 24 * 3600 * 1000;
protected String[] columnNames = new String[] { "", "Description" };
@@ -189,11 +187,6 @@ public class TaskActivityWizardPage extends WizardPage {
return;
}
- // TODO: Hack to allow selection of a 'root tasks' category
- TableItem rootItem = new TableItem(filtersTable, SWT.NONE);
- rootItem.setText(ROOT_CATEGORY_HACK);
- rootItem.setData(ROOT_CATEGORY_HACK);
-
// populate categories
for (AbstractTaskContainer category : manager.getTaskList().getTaskContainers()) {
TableItem item = new TableItem(filtersTable, SWT.NONE);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/planner/TaskReportGenerator.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/planner/TaskReportGenerator.java
index a6878a93a..4aafde118 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/planner/TaskReportGenerator.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/planner/TaskReportGenerator.java
@@ -75,11 +75,6 @@ public class TaskReportGenerator implements IRunnableWithProgress {
Set<ITaskListElement> rootElements;
if (filterCategories.size() == 0) {
rootElements = tasklist.getRootElements();
- } else if(filterCategories.contains(TaskActivityWizardPage.ROOT_CATEGORY_HACK)) {
- // TODO: Remove when root category issues fixed
- rootElements = new HashSet<ITaskListElement>(tasklist.getRootTasks());
- filterCategories.remove(TaskActivityWizardPage.ROOT_CATEGORY_HACK);
- rootElements.addAll(filterCategories);
} else {
rootElements = filterCategories;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/OpenSearchResultAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/OpenSearchResultAction.java
index c0cf8fac1..887764428 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/OpenSearchResultAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/OpenSearchResultAction.java
@@ -15,7 +15,7 @@ import java.util.Iterator;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
+import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.ui.TasksUiUtil;
/**
@@ -53,9 +53,9 @@ public class OpenSearchResultAction extends Action {
IStructuredSelection selection = (IStructuredSelection) s;
// go through each of the selected items and show it in an editor
- for (Iterator<AbstractQueryHit> it = selection.iterator(); it.hasNext();) {
- AbstractQueryHit repositoryHit = it.next();
- TasksUiUtil.openRepositoryTask(repositoryHit.getRepositoryUrl(), repositoryHit.getTaskId(), repositoryHit.getUrl());
+ for (Iterator<AbstractRepositoryTask> it = selection.iterator(); it.hasNext();) {
+ AbstractRepositoryTask repositoryHit = it.next();
+ TasksUiUtil.openRepositoryTask(repositoryHit.getRepositoryUrl(), repositoryHit.getTaskId(), repositoryHit.getTaskUrl());
// try {
// int taskId = Integer.parseInt(repositoryHit.getId());
// String bugUrl =
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java
index 1c3c673f1..759bcb498 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java
@@ -21,7 +21,7 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.mylar.internal.tasks.ui.TaskListColorsAndFonts;
import org.eclipse.mylar.internal.tasks.ui.views.TaskElementLabelProvider;
import org.eclipse.mylar.internal.tasks.ui.views.TaskTableLabelProvider;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
+import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
import org.eclipse.mylar.tasks.ui.TasksUiUtil;
import org.eclipse.search.internal.ui.SearchMessages;
@@ -41,10 +41,11 @@ import org.eclipse.ui.themes.IThemeManager;
/**
* Displays the results of a Repository search.
+ *
* @see org.eclipse.search.ui.text.AbstractTextSearchViewPage
*
* @author Rob Elves
- * @author Mik Kersten
+ * @author Mik Kersten
*/
public class RepositorySearchResultView extends AbstractTextSearchViewPage implements IAdaptable {
@@ -149,10 +150,10 @@ public class RepositorySearchResultView extends AbstractTextSearchViewPage imple
IThemeManager themeManager = getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
Color categoryBackground = themeManager.getCurrentTheme().getColorRegistry().get(
TaskListColorsAndFonts.THEME_COLOR_TASKLIST_CATEGORY);
-
+
SearchViewTableLabelProvider taskListTableLabelProvider = new SearchViewTableLabelProvider(
- new TaskElementLabelProvider(true), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(),
- categoryBackground);
+ new TaskElementLabelProvider(true),
+ PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(), categoryBackground);
viewer.setLabelProvider(taskListTableLabelProvider);
viewer.setContentProvider(new SearchResultTableContentProvider(this));
@@ -209,9 +210,10 @@ public class RepositorySearchResultView extends AbstractTextSearchViewPage imple
@Override
protected void showMatch(Match match, int currentOffset, int currentLength, boolean activate)
throws PartInitException {
- AbstractQueryHit repositoryHit = (AbstractQueryHit) match.getElement();
-
- TasksUiUtil.openRepositoryTask(repositoryHit.getRepositoryUrl(), repositoryHit.getTaskId(), repositoryHit.getUrl());
+ AbstractRepositoryTask repositoryHit = (AbstractRepositoryTask) match.getElement();
+
+ TasksUiUtil.openRepositoryTask(repositoryHit.getRepositoryUrl(), repositoryHit.getTaskId(), repositoryHit
+ .getTaskUrl());
}
@Override
@@ -219,7 +221,7 @@ public class RepositorySearchResultView extends AbstractTextSearchViewPage imple
super.fillContextMenu(mgr);
// Create the submenu for sorting
- MenuManager sortMenu = new MenuManager(SearchMessages.SortDropDownAction_label);
+ MenuManager sortMenu = new MenuManager(SearchMessages.SortDropDownAction_label);
sortMenu.add(sortByPriorityAction);
sortMenu.add(sortByDescriptionAction);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterDescription.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterDescription.java
index e93a5d2ef..ade1d14a7 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterDescription.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterDescription.java
@@ -14,7 +14,7 @@ package org.eclipse.mylar.internal.tasks.ui.search;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.mylar.internal.tasks.ui.views.TaskKeyComparator;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
+import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
/**
* Sorts search results by summary.
@@ -38,8 +38,8 @@ public class SearchResultSorterDescription extends ViewerSorter {
public int compare(Viewer viewer, Object e1, Object e2) {
try {
- AbstractQueryHit entry1 = (AbstractQueryHit) e1;
- AbstractQueryHit entry2 = (AbstractQueryHit) e2;
+ AbstractRepositoryTask entry1 = (AbstractRepositoryTask) e1;
+ AbstractRepositoryTask entry2 = (AbstractRepositoryTask) e2;
// NOTE we just comparing ids here, once summary and taskId separated
// they should have their own column/sorter.
return taskKeyComparator.compare(entry1.getTaskId(), entry2.getTaskId());
@@ -65,7 +65,7 @@ public class SearchResultSorterDescription extends ViewerSorter {
@Override
public int category(Object element) {
try {
- AbstractQueryHit hit = (AbstractQueryHit) element;
+ AbstractRepositoryTask hit = (AbstractRepositoryTask) element;
return Integer.parseInt(hit.getTaskId());
} catch (Exception ignored) {
// ignore if
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterId.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterId.java
index fb7edc7a5..bf5080eda 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterId.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterId.java
@@ -13,7 +13,7 @@ package org.eclipse.mylar.internal.tasks.ui.search;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
+import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
/**
* Sorts search results (AbstractQueryHit) by taskId.
@@ -22,8 +22,8 @@ public class SearchResultSorterId extends ViewerSorter {
/**
* Returns a negative, zero, or positive number depending on whether the
- * first bug's taskId is less than, equal to, or greater than the second bug's
- * taskId.
+ * first bug's taskId is less than, equal to, or greater than the second
+ * bug's taskId.
* <p>
*
* @see org.eclipse.jface.viewers.ViewerSorter#compare(org.eclipse.jface.viewers.Viewer,
@@ -33,11 +33,11 @@ public class SearchResultSorterId extends ViewerSorter {
public int compare(Viewer viewer, Object e1, Object e2) {
try {
// cast the object and get its bug taskId
- AbstractQueryHit entry1 = (AbstractQueryHit) e1;
+ AbstractRepositoryTask entry1 = (AbstractRepositoryTask) e1;
Integer id1 = Integer.parseInt(entry1.getTaskId());
// cast the other object and get its bug taskId
- AbstractQueryHit entry2 = (AbstractQueryHit) e2;
+ AbstractRepositoryTask entry2 = (AbstractRepositoryTask) e2;
Integer id2 = Integer.parseInt(entry2.getTaskId());
// if neither is null, compare the bug taskId's
@@ -64,7 +64,7 @@ public class SearchResultSorterId extends ViewerSorter {
@Override
public int category(Object element) {
try {
- AbstractQueryHit hit = (AbstractQueryHit) element;
+ AbstractRepositoryTask hit = (AbstractRepositoryTask) element;
return Integer.parseInt(hit.getTaskId());
} catch (Exception ignored) {
// ignore
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterPriority.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterPriority.java
index f2e7def51..12cca444c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterPriority.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterPriority.java
@@ -13,7 +13,7 @@ package org.eclipse.mylar.internal.tasks.ui.search;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
+import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
/**
* Sorts results of Bugzilla search by bug priority.
@@ -33,8 +33,8 @@ public class SearchResultSorterPriority extends ViewerSorter {
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
try {
- AbstractQueryHit hit1 = (AbstractQueryHit) e1;
- AbstractQueryHit hit2 = (AbstractQueryHit) e2;
+ AbstractRepositoryTask hit1 = (AbstractRepositoryTask) e1;
+ AbstractRepositoryTask hit2 = (AbstractRepositoryTask) e2;
return hit1.getPriority().compareTo(hit2.getPriority());
} catch (Exception ignored) {
// do nothing
@@ -55,7 +55,7 @@ public class SearchResultSorterPriority extends ViewerSorter {
@Override
public int category(Object element) {
try {
- AbstractQueryHit hit = (AbstractQueryHit) element;
+ AbstractRepositoryTask hit = (AbstractRepositoryTask) element;
return Integer.parseInt(hit.getTaskId());
} catch (Exception ignored) {
// ignore if there is a problem
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 523850d54..d8bd103b8 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
@@ -13,8 +13,6 @@ import java.util.Arrays;
import org.eclipse.mylar.context.core.ContextCorePlugin;
import org.eclipse.mylar.internal.tasks.ui.TaskListPreferenceConstants;
import org.eclipse.mylar.internal.tasks.ui.TasksUiImages;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
-import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
import org.eclipse.mylar.tasks.core.ITask;
@@ -42,15 +40,15 @@ class CustomTaskListDecorationDrawer implements Listener {
private Image taskInactiveContext = TasksUiImages.getImage(TasksUiImages.TASK_INACTIVE_CONTEXT);
- // see bug 185004
+ // see bug 185004
private int platformSpecificSquish = 0;
-
+
CustomTaskListDecorationDrawer(TaskListView taskListView, int activationImageOffset) {
this.taskListView = taskListView;
this.activationImageOffset = activationImageOffset;
this.taskListView.synchronizationOverlaid = TasksUiPlugin.getDefault().getPluginPreferences().getBoolean(
TaskListPreferenceConstants.INCOMING_OVERLAID);
-
+
if (SWT.getPlatform().equals("gtk")) {
platformSpecificSquish = 8;
} else if (SWT.getPlatform().equals("carbon")) {
@@ -69,8 +67,6 @@ class CustomTaskListDecorationDrawer implements Listener {
Image activationImage = null;
if (data instanceof ITask) {
task = (ITask) data;
- } else if (data instanceof AbstractQueryHit) {
- task = ((AbstractQueryHit) data).getCorrespondingTask();
}
if (task != null) {
if (task.isActive()) {
@@ -80,8 +76,6 @@ class CustomTaskListDecorationDrawer implements Listener {
} else {
activationImage = taskInactive;
}
- } else if (data instanceof AbstractQueryHit) {
- activationImage = taskInactive;
}
if (data instanceof ITaskListElement) {
switch (event.type) {
@@ -124,7 +118,7 @@ class CustomTaskListDecorationDrawer implements Listener {
int additionalSquish = 0;
if (platformSpecificSquish > 0 && taskListView.synchronizationOverlaid) {
additionalSquish = platformSpecificSquish + 3;
- } else if (platformSpecificSquish >0) {
+ } else if (platformSpecificSquish > 0) {
additionalSquish = platformSpecificSquish / 2;
}
if (taskListView.synchronizationOverlaid) {
@@ -132,12 +126,13 @@ class CustomTaskListDecorationDrawer implements Listener {
offsetX = 42 - additionalSquish;
} else {
image = TasksUiImages.getImage(TasksUiImages.OVERLAY_INCOMMING);
- offsetX = 24 - additionalSquish;
+ offsetX = 24 - additionalSquish;
}
}
}
} else {
- image = TasksUiImages.getImage(TaskElementLabelProvider.getSynchronizationImageDescriptor(element, taskListView.synchronizationOverlaid));
+ image = TasksUiImages.getImage(TaskElementLabelProvider.getSynchronizationImageDescriptor(element,
+ taskListView.synchronizationOverlaid));
}
if (image != null) {
event.gc.drawImage(image, offsetX, event.y + offsetY);
@@ -153,14 +148,14 @@ class CustomTaskListDecorationDrawer implements Listener {
}
}
}
- if (container instanceof AbstractRepositoryQuery) {
- AbstractRepositoryQuery query = (AbstractRepositoryQuery) container;
- for (AbstractQueryHit hit : query.getHits()) {
- if (hit.getCorrespondingTask() == null) {
- 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/TaskElementLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskElementLabelProvider.java
index 4795cb2e2..7db291f7d 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
@@ -20,7 +20,6 @@ import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.mylar.internal.tasks.ui.ITaskHighlighter;
import org.eclipse.mylar.internal.tasks.ui.TaskListColorsAndFonts;
import org.eclipse.mylar.internal.tasks.ui.TasksUiImages;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
@@ -78,7 +77,7 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
@Override
public Image getImage(Object element) {
CompositeImageDescriptor compositeDescriptor = getImageDescriptor(element, compositeImages);
- if (element instanceof ITask || element instanceof AbstractQueryHit) {
+ if (element instanceof ITask) {
if (compositeDescriptor.overlayKind == null) {
compositeDescriptor.overlayKind = TasksUiImages.OVERLAY_BLANK;
}
@@ -116,11 +115,6 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
if (showSynchState) {
compositeDescriptor.overlaySynch = getSynchronizationImageDescriptor(element, false);
}
- } else if (element instanceof AbstractQueryHit) {
- AbstractRepositoryTask repositoryTask = ((AbstractQueryHit) element).getCorrespondingTask();
- if (repositoryTask != null) {
- return getImageDescriptor(repositoryTask, showSynchState);
- }
} else if (element instanceof AbstractRepositoryQuery) {
connectorUi = TasksUiPlugin.getRepositoryUi(((AbstractRepositoryQuery) element).getRepositoryKind());
}
@@ -133,16 +127,10 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
if (showSynchState) {
compositeDescriptor.overlaySynch = getSynchronizationImageDescriptor(element, false);
}
- } else if (element instanceof AbstractQueryHit) {
- if (showSynchState) {
- compositeDescriptor.overlaySynch = getSynchronizationImageDescriptor(element, false);
- }
}
if (element instanceof AbstractRepositoryQuery) {
compositeDescriptor.icon = TasksUiImages.QUERY;
- } else if (element instanceof AbstractQueryHit) {
- compositeDescriptor.icon = TasksUiImages.TASK;
} else if (element instanceof ITask) {
compositeDescriptor.icon = TasksUiImages.TASK;
} else if (element instanceof DateRangeContainer) {
@@ -157,19 +145,17 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
public static ImageDescriptor getSynchronizationImageDescriptor(Object element, boolean synchViewStyle) {
AbstractRepositoryTask repositoryTask = null;
ImageDescriptor imageDescriptor = null;
- if (element instanceof AbstractQueryHit) {
- repositoryTask = ((AbstractQueryHit) element).getCorrespondingTask();
- if (repositoryTask == null) {
+ if (element instanceof AbstractRepositoryTask) {
+ repositoryTask = (AbstractRepositoryTask) element;
+ }
+ if (repositoryTask != null) {
+ if (repositoryTask.getLastSyncDateStamp() == null) {
if (synchViewStyle) {
return TasksUiImages.OVERLAY_SYNCH_INCOMMING_NEW;
} else {
return TasksUiImages.OVERLAY_INCOMMING_NEW;
}
}
- } else if (element instanceof AbstractRepositoryTask) {
- repositoryTask = (AbstractRepositoryTask) element;
- }
- if (repositoryTask != null) {
if (repositoryTask.getSyncState() == RepositoryTaskSyncState.OUTGOING) {
if (synchViewStyle) {
imageDescriptor = TasksUiImages.OVERLAY_SYNCH_OUTGOING;
@@ -190,12 +176,6 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
} else if (imageDescriptor != null) {
return imageDescriptor;
}
- } else if (element instanceof AbstractQueryHit) {
- if (synchViewStyle) {
- return TasksUiImages.OVERLAY_SYNCH_INCOMMING;
- } else {
- return TasksUiImages.OVERLAY_INCOMMING;
- }
} else if (element instanceof AbstractTaskContainer) {
AbstractTaskContainer container = (AbstractTaskContainer) element;
if (container instanceof AbstractRepositoryQuery) {
@@ -218,13 +198,10 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
return connectorUi.getTaskPriorityOverlay(repositoryTask);
}
}
- if (element instanceof ITask || element instanceof AbstractQueryHit) {
+ if (element instanceof ITask) {
ITask task = TaskElementLabelProvider.getCorrespondingTask((ITaskListElement) element);
if (task != null) {
return TasksUiImages.getImageDescriptorForPriority(PriorityLevel.fromString(task.getPriority()));
- } else if (element instanceof AbstractQueryHit) {
- return TasksUiImages.getImageDescriptorForPriority(PriorityLevel
- .fromString(((AbstractQueryHit) element).getPriority()));
}
}
return null;
@@ -232,21 +209,7 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
@Override
public String getText(Object object) {
- if (object instanceof AbstractQueryHit) {
- AbstractQueryHit hit = (AbstractQueryHit) object;
- if (hit.getSummary() == null) {
- if (hit.getIdentifyingLabel() != null) {
- return hit.getIdentifyingLabel() + NO_SUMMARY_AVAILABLE;
- } else {
- return hit.getTaskId() + NO_SUMMARY_AVAILABLE;
- }
- } else if (!pattern.matcher(hit.getSummary()).matches() && hit.getIdentifyingLabel() != null
- && !hit.getIdentifyingLabel().equals("")) {
- return hit.getIdentifyingLabel() + ": " + hit.getSummary();
- } else {
- return hit.getSummary();
- }
- } else if (object instanceof AbstractRepositoryTask) {
+ if (object instanceof AbstractRepositoryTask) {
AbstractRepositoryTask task = (AbstractRepositoryTask) object;
if (task.getSummary() == null) {
if (task.getTaskKey() != null) {
@@ -281,18 +244,11 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
TaskListColorsAndFonts.THEME_COLOR_TASK_OVERDUE);
}
}
- } else if (object instanceof AbstractQueryHit && ((AbstractQueryHit) object).getCorrespondingTask() == null) {
- AbstractQueryHit hit = (AbstractQueryHit) object;
- if ((hit.getCorrespondingTask() != null && hit.getCorrespondingTask().isCompleted()) || hit.isCompleted()) {
- return themeManager.getCurrentTheme().getColorRegistry().get(
- TaskListColorsAndFonts.THEME_COLOR_COMPLETED);
- }
} else if (object instanceof AbstractRepositoryQuery) {
// FIXME AbstractRepositoryQuery is a subclass of
// AbstractTaskContainer so this is probably a dead branch!
- for (AbstractQueryHit child : ((AbstractRepositoryQuery) object).getHits()) {
- ITask task = (child).getCorrespondingTask();
- if (task != null && task.isActive()) {
+ for (AbstractRepositoryTask child : ((AbstractRepositoryQuery) object).getHits()) {
+ if (child != null && child.isActive()) {
return TaskListColorsAndFonts.COLOR_TASK_ACTIVE;
}
}
@@ -328,8 +284,6 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
public static ITask getCorrespondingTask(ITaskListElement element) {
if (element instanceof ITask) {
return (ITask) element;
- } else if (element instanceof AbstractQueryHit) {
- return ((AbstractQueryHit) element).getCorrespondingTask();
} else {
return null;
}
@@ -342,8 +296,6 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
if (highlighter != null) {
return highlighter.getHighlightColor(task);
}
- } else if (element instanceof AbstractQueryHit) {
- return getBackground(((AbstractQueryHit) element).getCorrespondingTask());
}
return null;
}
@@ -382,10 +334,6 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
return TaskListColorsAndFonts.BOLD;
}
}
- } else if (element instanceof AbstractQueryHit) {
- if (((AbstractQueryHit) element).isCompleted()) {
- return TaskListColorsAndFonts.STRIKETHROUGH;
- }
}
return null;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java
index ad524b208..a01486ca6 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java
@@ -14,7 +14,6 @@ import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.mylar.core.MylarStatusHandler;
import org.eclipse.mylar.internal.tasks.ui.actions.TaskActivateAction;
import org.eclipse.mylar.internal.tasks.ui.actions.TaskDeactivateAction;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
import org.eclipse.mylar.tasks.core.ITask;
@@ -51,7 +50,7 @@ class TaskListCellModifier implements ICellModifier {
case 2:
return "";
}
- }
+ }
} catch (Exception e) {
MylarStatusHandler.log(e, e.getMessage());
}
@@ -78,10 +77,6 @@ class TaskListCellModifier implements ICellModifier {
ITask task = null;
if (taskListElement instanceof ITask) {
task = (ITask) taskListElement;
- } else if (taskListElement instanceof AbstractQueryHit) {
- if (((AbstractQueryHit) taskListElement).getCorrespondingTask() != null) {
- task = ((AbstractQueryHit) taskListElement).getCorrespondingTask();
- }
}
switch (columnIndex) {
case 0:
@@ -107,15 +102,8 @@ class TaskListCellModifier implements ICellModifier {
ITask task = null;
if (taskListElement instanceof ITask) {
task = (ITask) taskListElement;
- } else if (taskListElement instanceof AbstractQueryHit) {
- if (((AbstractQueryHit) taskListElement).getCorrespondingTask() != null) {
- task = ((AbstractQueryHit) taskListElement).getCorrespondingTask();
- }
- }
-
- if (taskListElement instanceof AbstractQueryHit) {
- task = ((AbstractQueryHit) taskListElement).getOrCreateCorrespondingTask();
}
+
if (task != null) {
if (task.isActive()) {
new TaskDeactivateAction().run(task);
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 6233aa887..0fb5e4fd3 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
@@ -21,7 +21,6 @@ import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.mylar.internal.tasks.ui.AbstractTaskListFilter;
import org.eclipse.mylar.internal.tasks.ui.TaskListPreferenceConstants;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
@@ -84,28 +83,22 @@ public class TaskListContentProvider implements IStructuredContentProvider, ITre
public boolean hasChildren(Object parent) {
if (parent instanceof AbstractRepositoryQuery) {
AbstractRepositoryQuery t = (AbstractRepositoryQuery) parent;
- Set<AbstractQueryHit> hits = t.getHits();
- // TODO: should provide hasHits() method!
- return hits != null && hits.size() > 0;
+ return !t.isEmpty();
} 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);
- } else if (parent instanceof AbstractQueryHit) {
- if (((AbstractQueryHit) parent).getCorrespondingTask() != null) {
- return taskHasUnfilteredChildren(((AbstractQueryHit) parent).getCorrespondingTask());
- } else {
- return false;
- }
}
return false;
}
private boolean taskHasUnfilteredChildren(ITask parent) {
- boolean filterSubtasks = TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(TaskListPreferenceConstants.FILTER_SUBTASKS);
- if(filterSubtasks) return false;
+ boolean filterSubtasks = TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
+ TaskListPreferenceConstants.FILTER_SUBTASKS);
+ if (filterSubtasks)
+ return false;
Set<ITask> children = parent.getChildren();
if (children != null) {
for (ITask task : children) {
@@ -141,7 +134,7 @@ public class TaskListContentProvider implements IStructuredContentProvider, ITre
return new ArrayList<ITaskListElement>(roots);
}
}
-
+
/**
* See bug 109693
*/
@@ -151,11 +144,11 @@ public class TaskListContentProvider implements IStructuredContentProvider, ITre
// TODO: should only know about containers, not queries
private boolean selectQuery(AbstractRepositoryQuery query) {
- Set<AbstractQueryHit> hits = query.getHits();
+ Set<AbstractRepositoryTask> hits = query.getHits();
if (hits.size() == 0) {
return true;
}
- for (AbstractQueryHit element : hits) {
+ for (AbstractRepositoryTask element : hits) {
if (!filter(query, element)) {
return true;
}
@@ -200,7 +193,8 @@ public class TaskListContentProvider implements IStructuredContentProvider, ITre
private boolean shouldAlwaysShow(Object parent, ITask task) {
for (AbstractTaskListFilter filter : this.view.getFilters()) {
- if (filter.shouldAlwaysShow(parent, task, !TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(TaskListPreferenceConstants.FILTER_SUBTASKS))) {
+ if (filter.shouldAlwaysShow(parent, task, !TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
+ TaskListPreferenceConstants.FILTER_SUBTASKS))) {
return true;
}
}
@@ -216,8 +210,8 @@ public class TaskListContentProvider implements IStructuredContentProvider, ITre
for (ITask task : ((AbstractTaskContainer) parent).getChildren()) {
if (shouldAlwaysShow(parent, task)) {
// TODO: archive logic?
- if (TasksUiPlugin.getTaskListManager().getTaskList().getQueryHit(
- task.getHandleIdentifier()) == null) {
+ if (TasksUiPlugin.getTaskListManager().getTaskList().getQueriesForHandle(
+ task.getHandleIdentifier()).size() == 0) {
children.add(task);
}
}
@@ -247,17 +241,18 @@ 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/TaskListDropAdapter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java
index 976cdc01e..053dd640e 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java
@@ -16,15 +16,8 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.TransferData;
-
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
-
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -32,14 +25,12 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerDropAdapter;
-
import org.eclipse.mylar.context.core.ContextCorePlugin;
import org.eclipse.mylar.core.MylarStatusHandler;
import org.eclipse.mylar.internal.tasks.ui.ITasksUiConstants;
import org.eclipse.mylar.internal.tasks.ui.RetrieveTitleFromUrlJob;
import org.eclipse.mylar.internal.tasks.ui.actions.NewLocalTaskAction;
import org.eclipse.mylar.internal.tasks.ui.actions.TaskActivateAction;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.DateRangeContainer;
@@ -51,6 +42,11 @@ import org.eclipse.mylar.tasks.core.TaskRepository;
import org.eclipse.mylar.tasks.ui.TaskTransfer;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
import org.eclipse.mylar.tasks.ui.TasksUiUtil;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.TransferData;
/**
* @author Mik Kersten
@@ -88,9 +84,7 @@ public class TaskListDropAdapter extends ViewerDropAdapter {
ITask toMove = null;
if (selectedObject instanceof ITask) {
toMove = (ITask) selectedObject;
- } else if (selectedObject instanceof AbstractQueryHit) {
- toMove = ((AbstractQueryHit) selectedObject).getOrCreateCorrespondingTask();
- }
+ }
if (toMove != null) {
tasksToMove.add(toMove);
}
@@ -101,8 +95,6 @@ public class TaskListDropAdapter extends ViewerDropAdapter {
ITask targetTask = null;
if (getCurrentTarget() instanceof ITask) {
targetTask = (ITask) getCurrentTarget();
- } else if (getCurrentTarget() instanceof AbstractQueryHit) {
- targetTask = ((AbstractQueryHit) getCurrentTarget()).getCorrespondingTask();
}
if (targetTask != null) {
final String[] names = (String[]) data;
@@ -269,8 +261,6 @@ public class TaskListDropAdapter extends ViewerDropAdapter {
if (FileTransfer.getInstance().isSupportedType(currentTransfer)) {
if (getCurrentTarget() instanceof ITask) {
return true;
- } else if (getCurrentTarget() instanceof AbstractQueryHit) {
- return ((AbstractQueryHit) getCurrentTarget()).getCorrespondingTask() != null;
}
} else if (selectedObject != null && !(selectedObject instanceof AbstractRepositoryQuery)) {
if (getCurrentTarget() instanceof TaskCategory) {
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 f48c4b02e..6986c8dca 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
@@ -15,7 +15,6 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.mylar.internal.tasks.ui.ITasksUiConstants;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
@@ -124,13 +123,9 @@ public class TaskListTableSorter extends ViewerSorter {
ITask t2 = null;
if (element1 instanceof ITask) {
t1 = (ITask)element1;
- } else if (element1 instanceof AbstractQueryHit) {
- t1 = ((AbstractQueryHit)element1).getCorrespondingTask();
}
if (element2 instanceof ITask) {
t2 = (ITask)element2;
- }else if (element2 instanceof AbstractQueryHit) {
- t2 = ((AbstractQueryHit)element2).getCorrespondingTask();
}
if (t1 != null && t2 != null) {
if (t1.getCreationDate() != null) {
@@ -149,14 +144,7 @@ public class TaskListTableSorter extends ViewerSorter {
public static String getSortableSummaryFromElement(ITaskListElement element) {
String summary = element.getSummary();
- if (element instanceof AbstractQueryHit) {
- AbstractRepositoryTask task1 = ((AbstractQueryHit) element).getCorrespondingTask();
- if (task1 != null && task1.getTaskKey() != null) {
- summary = task1.getTaskKey() + ": " + summary;
- } else {
- summary = ((AbstractQueryHit) element).getIdentifyingLabel() + ": " + summary;
- }
- } else if (element instanceof AbstractRepositoryTask) {
+ if (element instanceof AbstractRepositoryTask) {
AbstractRepositoryTask task1 = (AbstractRepositoryTask) element;
if (task1.getTaskKey() != null) {
summary = task1.getTaskKey() + ": " + summary;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTipHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTipHandler.java
index 0c75785bf..25503c2de 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTipHandler.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTipHandler.java
@@ -22,7 +22,6 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.mylar.internal.core.util.DateUtil;
import org.eclipse.mylar.internal.tasks.ui.ITaskListNotification;
import org.eclipse.mylar.internal.tasks.ui.TasksUiImages;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
@@ -78,11 +77,11 @@ public class TaskListToolTipHandler {
private Label scheduledTipLabelImage;
private Label scheduledTipLabelText;
-
+
private Label incommingTipLabelImage;
private Label incommingTipLabelText;
-
+
private WorkweekProgressBar taskProgressBar;
private Widget tipWidget;
@@ -119,43 +118,40 @@ public class TaskListToolTipHandler {
GridData textGridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
tipLabelText.setLayoutData(textGridData);
-
-
- if(showScheduled){
-
+
+ if (showScheduled) {
+
scheduledTipLabelImage = new Label(tipShell, SWT.NONE);
scheduledTipLabelImage.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
scheduledTipLabelImage.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
-
+
imageGridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
scheduledTipLabelImage.setLayoutData(imageGridData);
-
+
scheduledTipLabelText = new Label(tipShell, SWT.NONE);
scheduledTipLabelText.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
scheduledTipLabelText.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
-
+
textGridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
scheduledTipLabelText.setLayoutData(textGridData);
}
-
-
-
- if(showIncomming){
+
+ if (showIncomming) {
incommingTipLabelImage = new Label(tipShell, SWT.NONE);
incommingTipLabelImage.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
incommingTipLabelImage.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
-
+
imageGridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
incommingTipLabelImage.setLayoutData(imageGridData);
-
+
incommingTipLabelText = new Label(tipShell, SWT.NONE);
incommingTipLabelText.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
incommingTipLabelText.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
-
+
textGridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
incommingTipLabelText.setLayoutData(textGridData);
}
-
+
ITaskListElement element = getTaskListElement(widget);
if (element instanceof AbstractTaskContainer) {
Composite progressComposite = new Composite(tipShell, SWT.NONE);
@@ -191,7 +187,7 @@ public class TaskListToolTipHandler {
total = 0;
completed = 0;
total += query.getHits().size();
- for (AbstractQueryHit hit : query.getHits()) {
+ for (AbstractRepositoryTask hit : query.getHits()) {
if (hit.isCompleted()) {
completed++;
}
@@ -263,27 +259,24 @@ public class TaskListToolTipHandler {
return tooltip;
}
- if (element instanceof AbstractRepositoryTask || element instanceof AbstractQueryHit) {
-
- AbstractRepositoryTask repositoryTask;
- if (element instanceof AbstractQueryHit) {
- repositoryTask = ((AbstractQueryHit) element).getCorrespondingTask();
- } else {
- repositoryTask = (AbstractRepositoryTask) element;
- }
+ if (element instanceof AbstractRepositoryTask) {
+
+ AbstractRepositoryTask repositoryTask = (AbstractRepositoryTask) element;
+
tooltip += (element).getSummary();
if (repositoryTask != null) {
- String taskKindLabel = TasksUiPlugin.getRepositoryUi(repositoryTask.getRepositoryKind()).getTaskKindLabel(repositoryTask);
-
+ String taskKindLabel = TasksUiPlugin.getRepositoryUi(repositoryTask.getRepositoryKind())
+ .getTaskKindLabel(repositoryTask);
+
tooltip += "\n" + taskKindLabel + ", " + repositoryTask.getPriority();
-
+
TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository(
repositoryTask.getRepositoryKind(), repositoryTask.getRepositoryUrl());
if (repository != null) {
tooltip += " [" + repository.getRepositoryLabel() + "]";
}
-
+
if (repositoryTask.getStatus() != null) {
tooltip += SEPARATOR + "Last Error: " + repositoryTask.getStatus().getMessage();
}
@@ -299,9 +292,7 @@ public class TaskListToolTipHandler {
}
private String getActivityText(ITaskListElement element) {
- if(element instanceof AbstractQueryHit){
- element = ((AbstractQueryHit)element).getCorrespondingTask();
- }
+
if (element != null && element instanceof ITask) {
try {
String result = "";
@@ -323,27 +314,25 @@ public class TaskListToolTipHandler {
}
return null;
}
-
- private String getIncommingText(ITaskListElement element){
- if (element instanceof AbstractRepositoryTask || element instanceof AbstractQueryHit) {
-
- AbstractRepositoryTask repositoryTask;
- if (element instanceof AbstractQueryHit) {
- repositoryTask = ((AbstractQueryHit) element).getCorrespondingTask();
- } else {
- repositoryTask = (AbstractRepositoryTask) element;
- }
- if(repositoryTask != null && repositoryTask.getSyncState() == RepositoryTaskSyncState.INCOMING){
- AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(repositoryTask);
- if(connector != null){
- ITaskListNotification notification = TasksUiPlugin.getIncommingNotification(connector, repositoryTask);
- if(notification != null){
+
+ private String getIncommingText(ITaskListElement element) {
+ if (element instanceof AbstractRepositoryTask) {
+
+ AbstractRepositoryTask repositoryTask = (AbstractRepositoryTask) element;
+
+ if (repositoryTask != null && repositoryTask.getSyncState() == RepositoryTaskSyncState.INCOMING) {
+ AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
+ repositoryTask);
+ if (connector != null) {
+ ITaskListNotification notification = TasksUiPlugin.getIncommingNotification(connector,
+ repositoryTask);
+ if (notification != null) {
String descriptionText = null;
if (notification.getDescription() != null) {
descriptionText = notification.getDescription();
}
-
- if(descriptionText != null && !descriptionText.equals("")){
+
+ if (descriptionText != null && !descriptionText.equals("")) {
return descriptionText;
}
}
@@ -364,13 +353,9 @@ public class TaskListToolTipHandler {
if (connector != null) {
return TasksUiPlugin.getDefault().getBrandingIcon(connector.getRepositoryType());
}
- } else if (element instanceof AbstractRepositoryTask || element instanceof AbstractQueryHit) {
- AbstractRepositoryTask repositoryTask;
- if (element instanceof AbstractQueryHit) {
- repositoryTask = ((AbstractQueryHit) element).getCorrespondingTask();
- } else {
- repositoryTask = (AbstractRepositoryTask) element;
- }
+ } else if (element instanceof AbstractRepositoryTask) {
+ AbstractRepositoryTask repositoryTask = (AbstractRepositoryTask) element;
+
if (repositoryTask != null) {
AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
repositoryTask.getRepositoryKind());
@@ -476,11 +461,12 @@ public class TaskListToolTipHandler {
String baseText = getBasicToolTextTip(widget);
String scheduledText = getActivityText(getTaskListElement(widget));
String incommingText = getIncommingText(getTaskListElement(widget));
-
+
Image repositoryImage = getImage(widget);
- Image activityImage = TasksUiImages.getImage(TasksUiImages.CALENDAR); // TODO Fixme
+ Image activityImage = TasksUiImages.getImage(TasksUiImages.CALENDAR); // TODO
+ // Fixme
Image incommingImage = TasksUiImages.getImage(TasksUiImages.OVERLAY_INCOMMING);
-
+
if (baseText == null) { // HACK: don't check length
return;
}
@@ -488,26 +474,27 @@ public class TaskListToolTipHandler {
if (!tipShell.isDisposed() && tipShell.getShell() != null
&& PlatformUI.getWorkbench().getDisplay().getActiveShell() != null) {
tipShell.close();
- tipShell = createTipShell(PlatformUI.getWorkbench().getDisplay().getActiveShell(), widget, scheduledText != null, incommingText != null);
+ tipShell = createTipShell(PlatformUI.getWorkbench().getDisplay().getActiveShell(), widget,
+ scheduledText != null, incommingText != null);
}
String progressText = updateContainerProgressBar(taskProgressBar, getTaskListElement(widget));
-
tipLabelText.setText(baseText + progressText);
tipLabelImage.setImage(repositoryImage); // accepts null
- if (scheduledText != null){
+ if (scheduledText != null) {
scheduledTipLabelText.setText(scheduledText);
- scheduledTipLabelImage.setImage(activityImage); // accepts null
+ scheduledTipLabelImage.setImage(activityImage); // accepts
+ // null
}
- if (incommingText != null){
+ if (incommingText != null) {
incommingTipLabelText.setText(incommingText);
- incommingTipLabelImage.setImage(incommingImage); // accepts null
+ incommingTipLabelImage.setImage(incommingImage); // accepts
+ // null
}
-
tipShell.pack();
setHoverLocation(tipShell, tipPosition);
tipShell.setVisible(true);
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 abe394028..8d53fe838 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
@@ -85,7 +85,6 @@ import org.eclipse.mylar.internal.tasks.ui.actions.TaskActivateAction;
import org.eclipse.mylar.internal.tasks.ui.actions.TaskDeactivateAction;
import org.eclipse.mylar.internal.tasks.ui.actions.TaskListElementPropertiesAction;
import org.eclipse.mylar.internal.tasks.ui.views.TaskListTableSorter.SortByIndex;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
@@ -162,7 +161,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
private static final String PRESENTATION_SCHEDULED = "Scheduled";
- public static final String ID_VIEW = "org.eclipse.mylar.tasks.ui.views.TaskListView";
+ public static final String ID = "org.eclipse.mylar.tasks.ui.views.TaskListView";
public static final String LABEL_VIEW = "Task List";
@@ -264,7 +263,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
private TaskCompletionFilter filterComplete = new TaskCompletionFilter();
private TaskArchiveFilter filterArchive = new TaskArchiveFilter();
-
+
private TaskWorkingSetFilter filterWorkingSet = new TaskWorkingSetFilter();
private Set<AbstractTaskListFilter> filters = new HashSet<AbstractTaskListFilter>();
@@ -597,7 +596,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
public static TaskListView getFromActivePerspective() {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (activePage != null) {
- IViewPart view = activePage.findView(ID_VIEW);
+ IViewPart view = activePage.findView(ID);
if (view instanceof TaskListView) {
return (TaskListView) view;
}
@@ -607,7 +606,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
public static TaskListView openInActivePerspective() {
try {
- return (TaskListView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(ID_VIEW);
+ return (TaskListView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(ID);
} catch (Exception e) {
MylarStatusHandler.fail(e, "Could not show Task List view", false);
e.printStackTrace();
@@ -629,7 +628,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
TasksUiPlugin.getTaskListManager().removeActivityListener(TASK_ACTIVITY_LISTENER);
PlatformUI.getWorkbench().getWorkingSetManager().removePropertyChangeListener(this);
-
+
final IThemeManager themeManager = getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
if (themeManager != null) {
themeManager.removePropertyChangeListener(THEME_CHANGE_LISTENER);
@@ -646,7 +645,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
if (getSite() == null || getSite().getPage() == null)
return;
- IViewReference reference = getSite().getPage().findViewReference(ID_VIEW);
+ IViewReference reference = getSite().getPage().findViewReference(ID);
boolean shouldSetDescription = false;
if (reference != null && reference.isFastView()) {
shouldSetDescription = true;
@@ -811,7 +810,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
Object selectedNode = ((Tree) e.widget).getItem(new Point(e.x + 70, e.y));
if (selectedNode instanceof TreeItem) {
Object selectedObject = ((TreeItem) selectedNode).getData();
- if (selectedObject instanceof ITask || selectedObject instanceof AbstractQueryHit) {
+ if (selectedObject instanceof ITask) {
if (e.x > activationImageOffset && e.x < activationImageOffset + 13) {
taskListCellModifier.toggleTaskActivation((ITaskListElement) selectedObject);
}
@@ -953,14 +952,14 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
layout.setColumnData(columns[i], new ColumnPixelData(columnWidths[i]));
}
-// final int index = i;
+// final int index = i;
columns[i].addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
-// sortByIndex = index;
+// sortByIndex = index;
sortDirection *= DEFAULT_SORT_DIRECTION;
-// tableSorter.setColumn(columnNames[sortByIndex]);
+// tableSorter.setColumn(columnNames[sortByIndex]);
getViewer().refresh(false);
}
});
@@ -1111,12 +1110,8 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
}
}
ITask task = null;
- if ((element instanceof ITask) || (element instanceof AbstractQueryHit)) {
- if (element instanceof AbstractQueryHit) {
- task = ((AbstractQueryHit) element).getCorrespondingTask();
- } else {
- task = (ITask) element;
- }
+ if ((element instanceof ITask)) {
+ task = (ITask) element;
}
manager.add(new Separator(ID_SEPARATOR_NEW));
@@ -1134,8 +1129,6 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
} else {
manager.add(activateAction);
}
- } else if (element instanceof AbstractQueryHit) {
- manager.add(activateAction);
}
manager.add(new Separator());
@@ -1153,7 +1146,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
manager.add(new Separator());
addAction(copyDetailsAction, manager, element);
- if (task != null && !(element instanceof AbstractQueryHit)) {
+ if (task != null) {
addAction(removeFromCategoryAction, manager, element);
}
addAction(deleteAction, manager, element);
@@ -1170,7 +1163,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
manager.add(new Separator(ID_SEPARATOR_REPOSITORY));
manager.add(new Separator(ID_SEPARATOR_CONTEXT));
- if (element instanceof ITask || element instanceof AbstractQueryHit) {
+ if (element instanceof ITask) {
for (String menuPath : dynamicMenuMap.keySet()) {
if (ID_SEPARATOR_CONTEXT.equals(menuPath)) {
for (IDynamicSubMenuContributor contributor : dynamicMenuMap.get(menuPath)) {
@@ -1192,7 +1185,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
}
private void addMenuManager(IMenuManager menuToAdd, IMenuManager manager, ITaskListElement element) {
- if ((element instanceof ITask || element instanceof AbstractQueryHit)
+ if ((element instanceof ITask)
|| (element instanceof AbstractTaskContainer || element instanceof AbstractRepositoryQuery)) {
manager.add(menuToAdd);
}
@@ -1504,8 +1497,6 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
Object element = structuredSelection.getFirstElement();
if (element instanceof ITask) {
return (ITask) structuredSelection.getFirstElement();
- } else if (element instanceof AbstractQueryHit) {
- return ((AbstractQueryHit) element).getOrCreateCorrespondingTask();
}
}
return null;
@@ -1520,8 +1511,6 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
Object element = structuredSelection.getFirstElement();
if (element instanceof ITask) {
return (ITask) structuredSelection.getFirstElement();
- } else if (element instanceof AbstractQueryHit) {
- return ((AbstractQueryHit) element).getCorrespondingTask();
}
}
return null;
@@ -1558,19 +1547,21 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
IStructuredSelection selection = restoreSelection(task);
getViewer().setSelection(selection, true);
- // if no task exists, select the query hit if exists
- AbstractQueryHit hit = null;
- if (getViewer().getSelection().isEmpty()
- && (hit = TasksUiPlugin.getTaskListManager().getTaskList().getQueryHit(task.getHandleIdentifier())) != null) {
- try {
- AbstractRepositoryQuery query = TasksUiPlugin.getTaskListManager().getTaskList().getQueryForHandle(
- task.getHandleIdentifier());
- getViewer().expandToLevel(query, 1);
- getViewer().setSelection(new StructuredSelection(hit), true);
- } catch (SWTException e) {
- MylarStatusHandler.log(e, "Failed to expand Task List");
- }
- }
+// // if no task exists, select the query hit if exists
+// if (getViewer().getSelection().isEmpty()
+// && (hit =
+// TasksUiPlugin.getTaskListManager().getTaskList().getQueryHit(task.getHandleIdentifier()))
+// != null) {
+// try {
+// AbstractRepositoryQuery query =
+// TasksUiPlugin.getTaskListManager().getTaskList().getQueryForHandle(
+// task.getHandleIdentifier());
+// getViewer().expandToLevel(query, 1);
+// getViewer().setSelection(new StructuredSelection(hit), true);
+// } catch (SWTException e) {
+// MylarStatusHandler.log(e, "Failed to expand Task List");
+// }
+// }
}
private void saveSelection() {
@@ -1630,15 +1621,16 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
// refresh(task.getContainer());
}
- AbstractQueryHit hit = TasksUiPlugin.getTaskListManager().getTaskList().getQueryHit(
+// AbstractQueryHit hit =
+// TasksUiPlugin.getTaskListManager().getTaskList().getQueryHit(
+// task.getHandleIdentifier());
+// if (hit != null) {
+// refresh(hit);
+// }
+// } else if (element instanceof AbstractQueryHit) {
+// AbstractQueryHit hit = (AbstractQueryHit) element;
+ queries = TasksUiPlugin.getTaskListManager().getTaskList().getQueriesForHandle(
task.getHandleIdentifier());
- if (hit != null) {
- refresh(hit);
- }
- } else if (element instanceof AbstractQueryHit) {
- AbstractQueryHit hit = (AbstractQueryHit) element;
- Set<AbstractRepositoryQuery> queries = TasksUiPlugin.getTaskListManager().getTaskList()
- .getQueriesForHandle(hit.getHandleIdentifier());
for (AbstractRepositoryQuery query : queries) {
refresh(query);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java
index babd6b457..8dafbc188 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java
@@ -23,7 +23,6 @@ import org.eclipse.mylar.internal.tasks.core.WebTask;
import org.eclipse.mylar.internal.tasks.ui.TaskListPreferenceConstants;
import org.eclipse.mylar.internal.tasks.ui.TasksUiImages;
import org.eclipse.mylar.internal.tasks.ui.wizards.CommonAddExistingTaskWizard;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
@@ -111,7 +110,7 @@ public abstract class AbstractRepositoryConnectorUi {
public ImageDescriptor getTaskListElementIcon(ITaskListElement element) {
if (element instanceof AbstractRepositoryQuery) {
return TasksUiImages.QUERY;
- } else if (element instanceof AbstractQueryHit || element instanceof ITask) {
+ } else if (element instanceof ITask) {
return TasksUiImages.TASK;
} else {
return null;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/OpenRepositoryTaskJob.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/OpenRepositoryTaskJob.java
index 1733c251b..4698acb92 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/OpenRepositoryTaskJob.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/OpenRepositoryTaskJob.java
@@ -77,6 +77,7 @@ public class OpenRepositoryTaskJob extends Job {
AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
repositoryKind);
try {
+
ITaskDataHandler offlineHandler = connector.getTaskDataHandler();
if (offlineHandler != null) {
// the following code was copied from SynchronizeTaskJob
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/RepositorySynchronizationManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/RepositorySynchronizationManager.java
index 24a450628..4dee63fe6 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/RepositorySynchronizationManager.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/RepositorySynchronizationManager.java
@@ -113,7 +113,6 @@ public class RepositorySynchronizationManager {
long delay, boolean syncChangedTasks, boolean userForcedSync) {
TaskList taskList = TasksUiPlugin.getTaskListManager().getTaskList();
final SynchronizeQueryJob job = new SynchronizeQueryJob(this, connector, repositoryQueries, taskList);
- job.setForceSyncExecForTesting(forceSyncExecForTesting);
job.setSynchChangedTasks(syncChangedTasks);
job.setForced(userForcedSync);
for (AbstractRepositoryQuery repositoryQuery : repositoryQueries) {
@@ -147,7 +146,7 @@ public class RepositorySynchronizationManager {
*/
public final void synchronizeChanged(final AbstractRepositoryConnector connector, final TaskRepository repository) {
if (connector.getTaskDataHandler() != null) {
- final GetChangedTasksJob getChangedTasksJob = new GetChangedTasksJob(connector, repository);
+ final SynchronizeChangedTasksJob getChangedTasksJob = new SynchronizeChangedTasksJob(connector, repository);
getChangedTasksJob.setSystem(true);
getChangedTasksJob.setRule(new RepositoryMutexRule(repository));
if (!forceSyncExecForTesting) {
@@ -162,7 +161,7 @@ public class RepositorySynchronizationManager {
}
}
- private class GetChangedTasksJob extends Job {
+ private class SynchronizeChangedTasksJob extends Job {
private AbstractRepositoryConnector connector;
@@ -170,7 +169,7 @@ public class RepositorySynchronizationManager {
private Set<AbstractRepositoryTask> changedTasks;
- public GetChangedTasksJob(AbstractRepositoryConnector connector, TaskRepository repository) {
+ public SynchronizeChangedTasksJob(AbstractRepositoryConnector connector, TaskRepository repository) {
super("Get Changed Tasks");
this.connector = connector;
this.repository = repository;
@@ -296,6 +295,10 @@ public class RepositorySynchronizationManager {
return startState != repositoryTask.getSyncState();
}
+ public void saveOffline(AbstractRepositoryTask task, RepositoryTaskData taskData) {
+ TasksUiPlugin.getDefault().getTaskDataManager().setNewTaskData(task.getHandleIdentifier(), taskData);
+ }
+
/** public for testing purposes */
public boolean checkHasIncoming(AbstractRepositoryTask repositoryTask, RepositoryTaskData newData) {
String lastModified = repositoryTask.getLastSyncDateStamp();
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 8ab96010c..ce96d1490 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
@@ -11,33 +11,22 @@
package org.eclipse.mylar.tasks.ui;
-import java.util.ArrayList;
import java.util.Date;
-import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.mylar.core.MylarStatusHandler;
import org.eclipse.mylar.internal.core.util.DateUtil;
import org.eclipse.mylar.internal.tasks.ui.TasksUiImages;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
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.ITask;
-import org.eclipse.mylar.tasks.core.ITaskDataHandler;
import org.eclipse.mylar.tasks.core.QueryHitCollector;
import org.eclipse.mylar.tasks.core.RepositoryStatus;
-import org.eclipse.mylar.tasks.core.RepositoryTaskData;
import org.eclipse.mylar.tasks.core.TaskList;
import org.eclipse.mylar.tasks.core.TaskRepository;
import org.eclipse.ui.PlatformUI;
@@ -49,10 +38,6 @@ import org.eclipse.ui.progress.IProgressConstants;
*/
class SynchronizeQueryJob extends Job {
- // private static final int NUM_HITS_TO_PRIME = 20;
-
- private boolean forceSyncExecForTesting = false;
-
private final AbstractRepositoryConnector connector;
private static final String JOB_LABEL = "Synchronizing queries";
@@ -61,12 +46,12 @@ class SynchronizeQueryJob extends Job {
private Set<TaskRepository> repositories;
- private Map<TaskRepository, Set<AbstractQueryHit>> hitsToSynch;
-
private boolean synchChangedTasks;
private TaskList taskList;
+// private RepositorySynchronizationManager synchronizationManager;
+
private boolean forced = false;
public SynchronizeQueryJob(RepositorySynchronizationManager synchronizationManager,
@@ -76,8 +61,8 @@ class SynchronizeQueryJob extends Job {
this.queries = queries;
this.taskList = taskList;
this.repositories = new HashSet<TaskRepository>();
- this.hitsToSynch = new HashMap<TaskRepository, Set<AbstractQueryHit>>();
-
+ // TODO: remove once architecture established
+ // this.synchronizationManager = synchronizationManager;
}
public void setSynchChangedTasks(boolean syncChangedTasks) {
@@ -106,7 +91,7 @@ class SynchronizeQueryJob extends Job {
monitor.beginTask(JOB_LABEL, queries.size());
for (AbstractRepositoryQuery repositoryQuery : queries) {
- TasksUiPlugin.getTaskListManager().getTaskList().notifyContainerUpdated(repositoryQuery);
+ taskList.notifyContainerUpdated(repositoryQuery);
repositoryQuery.setStatus(null);
monitor.setTaskName("Synchronizing: " + repositoryQuery.getSummary());
@@ -118,43 +103,23 @@ class SynchronizeQueryJob extends Job {
TasksUiPlugin.PLUGIN_ID));
} else {
- QueryHitCollector collector = new QueryHitCollector(TasksUiPlugin.getTaskListManager().getTaskList());
- final IStatus resultingStatus = connector.performQuery(repositoryQuery, repository, new SubProgressMonitor(monitor, 1), collector);
+ QueryHitCollector collector = new QueryHitCollector(taskList, new TaskFactory(repository));
+ final IStatus resultingStatus = connector.performQuery(repositoryQuery, repository,
+ new SubProgressMonitor(monitor, 1), collector, forced);
if (resultingStatus.getSeverity() == IStatus.CANCEL) {
// do nothing
} else if (resultingStatus.isOK()) {
- if (collector.getHits().size() >= QueryHitCollector.MAX_HITS) {
+ if (collector.getTaskHits().size() >= QueryHitCollector.MAX_HITS) {
MylarStatusHandler.log(
QueryHitCollector.MAX_HITS_REACHED + "\n" + repositoryQuery.getSummary(), this);
}
- repositoryQuery.updateHits(collector.getHits(), taskList);
- List<AbstractQueryHit> returnedHits = collector.getHits();
- addHitsToPrime(repository, returnedHits, false);
+ repositoryQuery.updateHits(collector.getTaskHits());
if (synchChangedTasks) {
repositories.add(repository);
- // TODO: Should sync changed per repository not per
- // query
- // TasksUiPlugin.getSynchronizationManager().synchronizeChanged(connector,
- // repository);
- }
-
- if (forced) {
- // Force synch of all tasks held within query
- Set<AbstractRepositoryTask> repositoryTasksToSych = new HashSet<AbstractRepositoryTask>();
- for (ITask task : repositoryQuery.getChildren()) {
- if (!task.isCompleted()) {
- repositoryTasksToSych.add((AbstractRepositoryTask) task);
- }
- }
-
- TasksUiPlugin.getSynchronizationManager().synchronize(connector, repositoryTasksToSych, false,
- null);
- // Force update of all hits held by query
- addHitsToPrime(repository, new ArrayList<AbstractQueryHit>(repositoryQuery.getHits()), forced);
}
repositoryQuery.setLastRefreshTimeStamp(DateUtil.getFormattedDate(new Date(), "MMM d, H:mm:ss"));
@@ -172,19 +137,7 @@ class SynchronizeQueryJob extends Job {
repositoryQuery.setCurrentlySynchronizing(false);
- TasksUiPlugin.getTaskListManager().getTaskList().notifyContainerUpdated(repositoryQuery);
- }
-
- final PrimeTaskData job = new PrimeTaskData();
- job.setPriority(Job.LONG);
- if (!forceSyncExecForTesting) {
- job.schedule();
- } else {
- PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
- public void run() {
- job.run(new NullProgressMonitor());
- }
- });
+ taskList.notifyContainerUpdated(repositoryQuery);
}
for (TaskRepository repository : repositories) {
@@ -193,98 +146,11 @@ class SynchronizeQueryJob extends Job {
// HACK: force entire Task List to refresh in case containers need to
// appear or disappear
- TasksUiPlugin.getTaskListManager().getTaskList().notifyContainerUpdated(null);
+ taskList.notifyContainerUpdated(null);
- if (queries != null && queries.size() > 0) {
- taskList.removeOrphanedHits();
- }
-
monitor.done();
-
- return Status.OK_STATUS;
- }
- private void addHitsToPrime(TaskRepository repository, List<AbstractQueryHit> hits, boolean force) {
- Set<AbstractQueryHit> temp = hitsToSynch.get(repository);
- if (temp == null) {
- temp = new HashSet<AbstractQueryHit>();
- hitsToSynch.put(repository, temp);
- }
- if (connector.getTaskDataHandler() != null) {
- for (AbstractQueryHit hit : hits) {
- if (!temp.contains(hit)
- && hit.getCorrespondingTask() == null
- && ((!force && TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(
- hit.getHandleIdentifier()) == null) || force)) {
- temp.add(hit);
- }
- // if (temp.size() > NUM_HITS_TO_PRIME)
- // break;
- }
- }
-
- }
-
- class PrimeTaskData extends Job {
-
- private ITaskDataHandler handler;
-
- public PrimeTaskData() {
- super("Retrieving hit data");
- this.handler = connector.getTaskDataHandler();
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- if (!Platform.isRunning() || TasksUiPlugin.getDefault() == null) {
- monitor.setCanceled(true);
- return Status.OK_STATUS;
- }
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
- try {
- int size = 0;
- for (TaskRepository repository : hitsToSynch.keySet()) {
- size = size + hitsToSynch.get(repository).size();
- }
- monitor.beginTask("Retrieving hit data", size);
- for (TaskRepository repository : hitsToSynch.keySet()) {
- if (monitor.isCanceled())
- return Status.CANCEL_STATUS;
- if (repository == null)
- continue;
- monitor.setTaskName("Retrieving hit data from " + repository.getUrl());
- Set<AbstractQueryHit> hits = hitsToSynch.get(repository);
- for (AbstractQueryHit hit : hits) {
- if (monitor.isCanceled())
- return Status.CANCEL_STATUS;
- RepositoryTaskData taskData;
- try {
- taskData = handler.getTaskData(repository, hit.getTaskId(), monitor);
- } catch (Throwable e) {
- // ignore failures
- monitor.worked(1);
- continue;
- }
- if (taskData != null) {
- TasksUiPlugin.getDefault().getTaskDataManager().setNewTaskData(hit.getHandleIdentifier(),
- taskData);
- }
- monitor.worked(1);
- }
- }
-
- // TasksUiPlugin.getDefault().getTaskDataManager().save();
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- }
-
- public void setForceSyncExecForTesting(boolean forceSyncExecForTesting) {
- this.forceSyncExecForTesting = forceSyncExecForTesting;
+ return Status.OK_STATUS;
}
} \ No newline at end of file
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
new file mode 100644
index 000000000..267a142b8
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskFactory.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2004 - 2006 Mylar committers 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
+ *******************************************************************************/
+
+package org.eclipse.mylar.tasks.ui;
+
+import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
+import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
+import org.eclipse.mylar.tasks.core.ITaskFactory;
+import org.eclipse.mylar.tasks.core.RepositoryTaskData;
+import org.eclipse.mylar.tasks.core.TaskList;
+import org.eclipse.mylar.tasks.core.TaskRepository;
+
+/**
+ * Interim factory
+ *
+ * @author Rob Elves
+ */
+public class TaskFactory implements ITaskFactory {
+
+ private AbstractRepositoryConnector connector;
+
+ private RepositorySynchronizationManager synchManager;
+
+ private TaskRepository repository;
+
+ private TaskList taskList;
+
+ public TaskFactory(TaskRepository repository) {
+ this.repository = repository;
+ connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(repository.getKind());
+ synchManager = TasksUiPlugin.getSynchronizationManager();
+ taskList = TasksUiPlugin.getTaskListManager().getTaskList();
+ }
+
+ /**
+ * @param synchData -
+ * synchronize task with the provided taskData
+ * @param forced -
+ * user requested synchronization
+ */
+ public AbstractRepositoryTask createTask(RepositoryTaskData taskData, boolean synchData, boolean forced) {
+
+ AbstractRepositoryTask repositoryTask = taskList.getTask(taskData.getRepositoryUrl(), taskData.getId());
+ if (repositoryTask == null) {
+ repositoryTask = connector.createTask(repository.getUrl(), taskData.getId(), taskData.getId() + ": "
+ + taskData.getDescription());
+
+ if (synchData) {
+ taskList.addTask(repositoryTask);
+ synchManager.saveIncoming(repositoryTask, taskData, forced);
+ } else {
+ synchManager.saveOffline(repositoryTask, taskData);
+ }
+
+ connector.updateTaskFromTaskData(repository, repositoryTask, taskData, false);
+
+ } else {
+ if (synchData) {
+ synchManager.saveIncoming(repositoryTask, taskData, forced);
+ connector.updateTaskFromTaskData(repository, repositoryTask, taskData, false);
+ }
+ }
+ 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 c5d0018d2..fa787647a 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
@@ -45,7 +45,6 @@ import org.eclipse.mylar.internal.tasks.ui.util.TaskListSaveManager;
import org.eclipse.mylar.internal.tasks.ui.util.TaskListWriter;
import org.eclipse.mylar.internal.tasks.ui.views.TaskActivationHistory;
import org.eclipse.mylar.monitor.core.InteractionEvent;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
import org.eclipse.mylar.tasks.core.DateRangeActivityDelegate;
@@ -174,7 +173,7 @@ public class TaskListManager implements IPropertyChangeListener {
public void contextCleared(IInteractionContext context) {
// ignore
}
-
+
public void interestChanged(List<IInteractionElement> elements) {
List<InteractionEvent> events = ContextCorePlugin.getContextManager().getActivityMetaContext()
.getInteractionHistory();
@@ -1131,13 +1130,7 @@ public class TaskListManager implements IPropertyChangeListener {
*/
public ITask getTaskForElement(ITaskListElement element, boolean force) {
ITask task = null;
- if (element instanceof AbstractQueryHit) {
- if (force) {
- task = ((AbstractQueryHit) element).getOrCreateCorrespondingTask();
- } else {
- task = ((AbstractQueryHit) element).getCorrespondingTask();
- }
- } else if (element instanceof ITask) {
+ if (element instanceof ITask) {
task = (ITask) element;
}
return task;
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 0abc70316..8e04a3288 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
@@ -62,7 +62,6 @@ import org.eclipse.mylar.internal.tasks.ui.util.TasksUiExtensionReader;
import org.eclipse.mylar.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylar.internal.tasks.ui.views.TaskRepositoriesView;
import org.eclipse.mylar.internal.tasks.ui.wizards.EditRepositoryWizard;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
@@ -299,8 +298,8 @@ public class TasksUiPlugin extends AbstractUIPlugin implements IStartup {
for (AbstractRepositoryQuery query : TasksUiPlugin.getTaskListManager().getTaskList().getQueries()) {
AbstractRepositoryConnectorUi connectorUi = getRepositoryUi(query.getRepositoryKind());
if (!connectorUi.hasCustomNotificationHandling()) {
- for (AbstractQueryHit hit : query.getHits()) {
- if (hit.getCorrespondingTask() == null && hit.isNotified() == false) {
+ for (AbstractRepositoryTask hit : query.getHits()) {
+ if (hit.isNotified() == false) {
notifications.add(new TaskListNotificationQueryIncoming(hit));
hit.setNotified(true);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java
index 00934d8b6..43e708634 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java
@@ -42,7 +42,6 @@ import org.eclipse.mylar.internal.tasks.ui.TaskListPreferenceConstants;
import org.eclipse.mylar.internal.tasks.ui.editors.CategoryEditorInput;
import org.eclipse.mylar.internal.tasks.ui.views.TaskRepositoriesView;
import org.eclipse.mylar.internal.tasks.ui.wizards.EditRepositoryWizard;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
@@ -79,7 +78,7 @@ public class TasksUiUtil {
public static final String PREFS_PAGE_ID_COLORS_AND_FONTS = "org.eclipse.ui.preferencePages.ColorsAndFonts";
public static final int FLAG_NO_RICH_EDITOR = 1 << 17;
-
+
/**
* Resolves a rich editor for the task if available. Must be called from UI
* thread.
@@ -190,17 +189,9 @@ public class TasksUiUtil {
}
public static void refreshAndOpenTaskListElement(ITaskListElement element) {
- if (element instanceof ITask || element instanceof AbstractQueryHit
- || element instanceof DateRangeActivityDelegate) {
+ if (element instanceof ITask || element instanceof DateRangeActivityDelegate) {
final ITask task;
- if (element instanceof AbstractQueryHit) {
- if (((AbstractQueryHit) element).getCorrespondingTask() != null) {
- task = ((AbstractQueryHit) element).getCorrespondingTask();
- } else {
- task = ((AbstractQueryHit) element).getOrCreateCorrespondingTask();
- // NewLocalTaskAction.scheduleNewTask(task);
- }
- } else if (element instanceof DateRangeActivityDelegate) {
+ if (element instanceof DateRangeActivityDelegate) {
task = ((DateRangeActivityDelegate) element).getCorrespondingTask();
} else {
task = (ITask) element;
@@ -304,7 +295,7 @@ public class TasksUiUtil {
public void run() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
+ if (window != null) {
if (openWithBrowser) {
openUrl(task.getTaskUrl(), false);
} else {
@@ -329,20 +320,22 @@ public class TasksUiUtil {
if (!wasOpen) {
TasksUiPlugin.getSynchronizationManager().setTaskRead(repositoryTask, true);
}
- // Synchronization must happen after marked read.
+ // Synchronization must happen after marked
+ // read.
AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager()
.getRepositoryConnector(repositoryTask.getRepositoryKind());
if (connector != null) {
- TasksUiPlugin.getSynchronizationManager().synchronize(connector, repositoryTask, false,
- null);
+ TasksUiPlugin.getSynchronizationManager().synchronize(connector,
+ repositoryTask, false, null);
}
}
return Status.OK_STATUS;
- }};
-
- updateTaskData.setSystem(true);
- updateTaskData.schedule();
+ }
+ };
+
+ updateTaskData.setSystem(true);
+ updateTaskData.schedule();
}
}
@@ -478,14 +471,6 @@ public class TasksUiUtil {
AbstractRepositoryQuery query = (AbstractRepositoryQuery) element;
return TasksUiPlugin.getRepositoryManager().getRepository(query.getRepositoryKind(),
query.getRepositoryUrl());
- } else if (element instanceof AbstractQueryHit) {
- AbstractQueryHit queryHit = (AbstractQueryHit) element;
- if (queryHit.getParent() != null) {
- return TasksUiPlugin.getRepositoryManager().getRepository(queryHit.getParent().getRepositoryKind(),
- queryHit.getRepositoryUrl());
- } else {
- return TasksUiPlugin.getRepositoryManager().getRepository(queryHit.getRepositoryUrl());
- }
} else if (element instanceof AbstractRepositoryTask) {
AbstractRepositoryTask task = (AbstractRepositoryTask) element;
return TasksUiPlugin.getRepositoryManager()
@@ -529,7 +514,7 @@ public class TasksUiUtil {
}
});
}
-
+
public static void closeEditorInActivePage(ITask task) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java
index 75fd6dca5..12773e8b5 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java
@@ -218,7 +218,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
public static final int DESCRIPTION_HEIGHT = 10 * 14;
-// private static final String REASSIGN_BUG_TO = "Reassign to";
+// private static final String REASSIGN_BUG_TO = "Reassign to";
private static final String LABEL_BUTTON_SUBMIT = "Submit";
@@ -720,7 +720,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
protected void createSections() {
createReportHeaderLayout(editorComposite);
-
+
Section attributesSection = createSection(editorComposite, getSectionLabel(SECTION_NAME.ATTRIBTUES_SECTION));
attributesSection.setExpanded(expandedStateAttributes || hasAttributeChanges);
@@ -741,15 +741,15 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
attributesLayout.horizontalSpacing = 5;
attributesLayout.verticalSpacing = 4;
attribComp.setLayout(attributesLayout);
-
+
GridData attributesData = new GridData(GridData.FILL_BOTH);
attributesData.horizontalSpan = 1;
attributesData.grabExcessVerticalSpace = false;
attribComp.setLayoutData(attributesData);
-
- createAttributeLayout(attribComp);
+
+ createAttributeLayout(attribComp);
createCustomAttributeLayout(attribComp);
-
+
if (showAttachments) {
createAttachmentLayout(editorComposite);
}
@@ -926,12 +926,12 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
protected void createAttributeLayout(Composite attributesComposite) {
int numColumns = ((GridLayout) attributesComposite.getLayout()).numColumns;
int currentCol = 1;
-
+
for (RepositoryTaskAttribute attribute : taskData.getAttributes()) {
if (attribute.isHidden()) {
continue;
}
-
+
GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
data.horizontalSpan = 1;
data.horizontalIndent = HORZ_INDENT;
@@ -987,9 +987,9 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
if (hasContentAssist(attribute)) {
ContentAssistCommandAdapter adapter = applyContentAssist(text,
createContentProposalProvider(attribute));
-
+
ILabelProvider propsalLabelProvider = createProposalLabelProvider(attribute);
- if(propsalLabelProvider != null){
+ if (propsalLabelProvider != null) {
adapter.setLabelProvider(propsalLabelProvider);
}
adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
@@ -1003,7 +1003,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
currentCol -= numColumns;
}
}
-
+
// make sure that we are in the first column
if (currentCol > 1) {
while (currentCol <= numColumns) {
@@ -1011,7 +1011,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
currentCol++;
}
}
-
+
toolkit.paintBordersFor(attributesComposite);
}
@@ -1038,7 +1038,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
ContentAssistCommandAdapter adapter = new ContentAssistCommandAdapter(text, textContentAdapter,
proposalProvider, "org.eclipse.ui.edit.text.contentAssist.proposals", new char[0]);
-
+
IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
controlDecoration.setDescriptionText(NLS.bind("Content Assist Available ({0})", bindingService
.getBestActiveBindingFormattedFor(adapter.getCommandId())));
@@ -1067,16 +1067,16 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
* @return the IContentProposalProvider.
*/
protected IContentProposalProvider createContentProposalProvider(RepositoryOperation operation) {
-
+
return new PersonProposalProvider(repositoryTask, taskData);
}
-
+
protected ILabelProvider createProposalLabelProvider(RepositoryTaskAttribute attribute) {
return new PersonProposalLabelProvider();
}
-
+
protected ILabelProvider createProposalLabelProvider(RepositoryOperation operation) {
-
+
return new PersonProposalLabelProvider();
}
@@ -1624,7 +1624,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
ContentAssistCommandAdapter adapter = applyContentAssist(text,
createContentProposalProvider(addCCattribute));
ILabelProvider propsalLabelProvider = createProposalLabelProvider(addCCattribute);
- if(propsalLabelProvider != null){
+ if (propsalLabelProvider != null) {
adapter.setLabelProvider(propsalLabelProvider);
}
adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
@@ -2498,9 +2498,9 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
String assignmentValue = "";
// NOTE: removed this because we now have content assit
-// if (opName.equals(REASSIGN_BUG_TO)) {
-// assignmentValue = repository.getUserName();
-// }
+// if (opName.equals(REASSIGN_BUG_TO)) {
+// assignmentValue = repository.getUserName();
+// }
radioOptions[i] = toolkit.createText(buttonComposite, assignmentValue);
radioOptions[i].setFont(TEXT_FONT);
radioOptions[i].setLayoutData(radioData);
@@ -2512,7 +2512,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
ContentAssistCommandAdapter adapter = applyContentAssist((Text) radioOptions[i],
createContentProposalProvider(o));
ILabelProvider propsalLabelProvider = createProposalLabelProvider(o);
- if(propsalLabelProvider != null){
+ if (propsalLabelProvider != null) {
adapter.setLabelProvider(propsalLabelProvider);
}
adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
@@ -2712,7 +2712,8 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
protected IStatus run(IProgressMonitor monitor) {
try {
monitor.beginTask("Submitting task", 3);
- String taskId = connector.getTaskDataHandler().postTaskData(repository, taskData, new SubProgressMonitor(monitor, 1));
+ String taskId = connector.getTaskDataHandler().postTaskData(repository, taskData,
+ new SubProgressMonitor(monitor, 1));
final boolean isNew = taskData.isNew();
if (isNew) {
if (taskId != null) {
@@ -2903,23 +2904,26 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
protected IStatus handleSubmitError(final CoreException exception) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
- if (exception.getStatus().getCode() == IMylarStatusConstants.IO_ERROR) {
- parentEditor.setMessage(ERROR_NOCONNECTIVITY, IMessageProvider.ERROR);
- MylarStatusHandler.log(exception.getStatus());
- } else if (exception.getStatus().getCode() == IMylarStatusConstants.REPOSITORY_COMMENT_REQD) {
- MylarStatusHandler.displayStatus("Comment required", exception.getStatus());
- if (!isDisposed && newCommentTextViewer != null && !newCommentTextViewer.getControl().isDisposed()) {
- newCommentTextViewer.getControl().setFocus();
- }
- } else if (exception.getStatus().getCode() == IMylarStatusConstants.REPOSITORY_LOGIN_ERROR) {
- if (TasksUiUtil.openEditRepositoryWizard(repository) == MessageDialog.OK) {
- submitToRepository();
- return;
+ if (form != null && !form.isDisposed()) {
+ if (exception.getStatus().getCode() == IMylarStatusConstants.IO_ERROR) {
+ parentEditor.setMessage(ERROR_NOCONNECTIVITY, IMessageProvider.ERROR);
+ MylarStatusHandler.log(exception.getStatus());
+ } else if (exception.getStatus().getCode() == IMylarStatusConstants.REPOSITORY_COMMENT_REQD) {
+ MylarStatusHandler.displayStatus("Comment required", exception.getStatus());
+ if (!isDisposed && newCommentTextViewer != null
+ && !newCommentTextViewer.getControl().isDisposed()) {
+ newCommentTextViewer.getControl().setFocus();
+ }
+ } else if (exception.getStatus().getCode() == IMylarStatusConstants.REPOSITORY_LOGIN_ERROR) {
+ if (TasksUiUtil.openEditRepositoryWizard(repository) == MessageDialog.OK) {
+ submitToRepository();
+ return;
+ }
+ } else {
+ MylarStatusHandler.displayStatus("Submit failed", exception.getStatus());
}
- } else {
- MylarStatusHandler.displayStatus("Submit failed", exception.getStatus());
+ setGlobalBusy(false);
}
- setGlobalBusy(false);
}
});
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/search/AbstractRepositoryQueryPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/search/AbstractRepositoryQueryPage.java
index 5b7eca252..49f6bf076 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/search/AbstractRepositoryQueryPage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/search/AbstractRepositoryQueryPage.java
@@ -15,9 +15,11 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.mylar.internal.tasks.ui.ITasksUiConstants;
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.TaskRepository;
import org.eclipse.mylar.tasks.core.TaskRepositoryManager;
+import org.eclipse.mylar.tasks.ui.TaskFactory;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
import org.eclipse.search.ui.ISearchPage;
import org.eclipse.search.ui.ISearchPageContainer;
@@ -46,11 +48,11 @@ public abstract class AbstractRepositoryQueryPage extends WizardPage implements
private String titleString;
protected Text title;
-
+
protected ISearchPageContainer scontainer = null;
protected TaskRepository repository;
-
+
public AbstractRepositoryQueryPage(String wizardTitle) {
this(wizardTitle, null);
setTitle(TITLE);
@@ -61,7 +63,7 @@ public abstract class AbstractRepositoryQueryPage extends WizardPage implements
public AbstractRepositoryQueryPage(String wizardTitle, String queryTitle) {
super(wizardTitle);
- titleString = queryTitle==null ? "" : queryTitle;
+ titleString = queryTitle == null ? "" : queryTitle;
}
public void createControl(Composite parent) {
@@ -73,7 +75,7 @@ public abstract class AbstractRepositoryQueryPage extends WizardPage implements
private void createTitleGroup(Composite parent) {
Composite group = new Composite(parent, SWT.NONE);
-
+
GridLayout layout = new GridLayout(2, false);
group.setLayout(layout);
@@ -114,11 +116,11 @@ public abstract class AbstractRepositoryQueryPage extends WizardPage implements
public void saveWidgetValues() {
// empty
}
-
+
public void setContainer(ISearchPageContainer container) {
scontainer = container;
}
-
+
public boolean inSearchContainer() {
return scontainer != null;
}
@@ -130,10 +132,15 @@ public abstract class AbstractRepositoryQueryPage extends WizardPage implements
return false;
}
- NewSearchUI.activateSearchResultView();
- SearchHitCollector collector = new SearchHitCollector(TasksUiPlugin.getTaskListManager().getTaskList(),
- repository, getQuery());
- NewSearchUI.runQueryInBackground(collector);
+ NewSearchUI.activateSearchResultView();
+
+ AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
+ repository.getKind());
+ if (connector != null) {
+ SearchHitCollector collector = new SearchHitCollector(TasksUiPlugin.getTaskListManager().getTaskList(),
+ repository, getQuery(), new TaskFactory(repository));
+ NewSearchUI.runQueryInBackground(collector);
+ }
return true;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/search/SearchHitCollector.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/search/SearchHitCollector.java
index aa7b9c7ed..0e5da9aab 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/search/SearchHitCollector.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/search/SearchHitCollector.java
@@ -16,11 +16,14 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.mylar.core.MylarStatusHandler;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
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.ITask;
+import org.eclipse.mylar.tasks.core.ITaskFactory;
import org.eclipse.mylar.tasks.core.QueryHitCollector;
import org.eclipse.mylar.tasks.core.RepositoryStatus;
+import org.eclipse.mylar.tasks.core.RepositoryTaskData;
import org.eclipse.mylar.tasks.core.TaskList;
import org.eclipse.mylar.tasks.core.TaskRepository;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
@@ -46,11 +49,14 @@ public class SearchHitCollector extends QueryHitCollector implements ISearchQuer
private RepositorySearchResult searchResult;
- public SearchHitCollector(TaskList tasklist, TaskRepository repository, AbstractRepositoryQuery repositoryQuery) {
- super(tasklist);
+ private ITaskFactory taskFactory;
+
+ public SearchHitCollector(TaskList tasklist, TaskRepository repository, AbstractRepositoryQuery repositoryQuery, ITaskFactory taskFactory) {
+ super(tasklist, taskFactory);
this.repository = repository;
this.repositoryQuery = repositoryQuery;
this.searchResult = new RepositorySearchResult(this);
+ this.taskFactory = taskFactory;
}
@Override
@@ -70,9 +76,28 @@ public class SearchHitCollector extends QueryHitCollector implements ISearchQuer
}
@Override
- public void addMatch(AbstractQueryHit hit) {
- super.addMatch(hit);
- this.searchResult.addMatch(new Match(hit, 0, 0));
+ public void accept(AbstractRepositoryTask task) {
+ if (task == null)
+ return;
+
+ ITask hitTask = taskList.getTask(task.getHandleIdentifier());
+ if (hitTask == null) {
+ hitTask = task;
+ }
+
+ taskResults.add((AbstractRepositoryTask)hitTask);
+ this.searchResult.addMatch(new Match(hitTask, 0, 0));
+ }
+
+ @Override
+ public void accept(RepositoryTaskData taskData) {
+ if (taskData == null)
+ return;
+ AbstractRepositoryTask task = taskFactory.createTask(taskData, false, false);
+ if (task != null) {
+ taskResults.add(task);
+ this.searchResult.addMatch(new Match(task, 0, 0));
+ }
}
public String getLabel() {
@@ -108,7 +133,7 @@ public class SearchHitCollector extends QueryHitCollector implements ISearchQuer
AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
repositoryQuery.getRepositoryKind());
if (connector != null) {
- status = connector.performQuery(repositoryQuery, repository, monitor, this);
+ status = connector.performQuery(repositoryQuery, repository, monitor, this, false);
} else {
return new Status(IStatus.ERROR, TasksUiPlugin.PLUGIN_ID, IStatus.OK,
"repository connector could not be found", null);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java
index 25c1c2115..a55c93bf9 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java
@@ -140,7 +140,7 @@ public abstract class AbstractRepositorySettingsPage extends WizardPage {
private boolean needsValidation;
- private Composite container;
+ protected Composite compositeContainer;
private Composite advancedComp;
@@ -200,12 +200,12 @@ public abstract class AbstractRepositorySettingsPage extends WizardPage {
}
public void createControl(Composite parent) {
- container = new Composite(parent, SWT.NULL);
+ compositeContainer = new Composite(parent, SWT.NULL);
FillLayout layout = new FillLayout();
- container.setLayout(layout);
+ compositeContainer.setLayout(layout);
- new Label(container, SWT.NONE).setText(LABEL_SERVER);
- serverUrlCombo = new Combo(container, SWT.DROP_DOWN);
+ new Label(compositeContainer, SWT.NONE).setText(LABEL_SERVER);
+ serverUrlCombo = new Combo(compositeContainer, SWT.DROP_DOWN);
serverUrlCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
isValidUrl(serverUrlCombo.getText());
@@ -230,7 +230,7 @@ public abstract class AbstractRepositorySettingsPage extends WizardPage {
GridDataFactory.fillDefaults().hint(300, SWT.DEFAULT).grab(true, false).applyTo(serverUrlCombo);
repositoryLabelEditor = new StringFieldEditor("", LABEL_REPOSITORY_LABEL, StringFieldEditor.UNLIMITED,
- container) {
+ compositeContainer) {
@Override
protected boolean doCheckState() {
@@ -249,7 +249,7 @@ public abstract class AbstractRepositorySettingsPage extends WizardPage {
// repositoryLabelEditor.setErrorMessage("error");
if (needsAnonymousLogin()) {
- anonymousButton = new Button(container, SWT.CHECK);
+ anonymousButton = new Button(compositeContainer, SWT.CHECK);
GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(anonymousButton);
anonymousButton.setText("Anonymous Access");
@@ -265,9 +265,9 @@ public abstract class AbstractRepositorySettingsPage extends WizardPage {
}
}
- repositoryUserNameEditor = new StringFieldEditor("", LABEL_USER, StringFieldEditor.UNLIMITED, container);
+ repositoryUserNameEditor = new StringFieldEditor("", LABEL_USER, StringFieldEditor.UNLIMITED, compositeContainer);
repositoryPasswordEditor = new RepositoryStringFieldEditor("", LABEL_PASSWORD, StringFieldEditor.UNLIMITED,
- container);
+ compositeContainer);
// TODO: put this back if we can't get the info from all connectors
// if (needsTimeZone()) {
// Label timeZoneLabel = new Label(container, SWT.NONE);
@@ -291,14 +291,14 @@ public abstract class AbstractRepositorySettingsPage extends WizardPage {
// }
- advancedExpComposite = toolkit.createExpandableComposite(container, Section.COMPACT | Section.TWISTIE
+ advancedExpComposite = toolkit.createExpandableComposite(compositeContainer, Section.COMPACT | Section.TWISTIE
| Section.TITLE_BAR);
advancedExpComposite.clientVerticalSpacing = 0;
GridData gridData_2 = new GridData(SWT.FILL, SWT.FILL, true, false);
gridData_2.horizontalIndent = -5;
advancedExpComposite.setLayoutData(gridData_2);
- advancedExpComposite.setFont(container.getFont());
- advancedExpComposite.setBackground(container.getBackground());
+ advancedExpComposite.setFont(compositeContainer.getFont());
+ advancedExpComposite.setBackground(compositeContainer.getBackground());
advancedExpComposite.setText("Additional Settings");
advancedExpComposite.addExpansionListener(new ExpansionAdapter() {
@Override
@@ -314,7 +314,7 @@ public abstract class AbstractRepositorySettingsPage extends WizardPage {
gridLayout2.numColumns = 2;
gridLayout2.verticalSpacing = 5;
advancedComp.setLayout(gridLayout2);
- advancedComp.setBackground(container.getBackground());
+ advancedComp.setBackground(compositeContainer.getBackground());
advancedExpComposite.setClient(advancedComp);
createAdditionalControls(advancedComp);
@@ -383,14 +383,14 @@ public abstract class AbstractRepositorySettingsPage extends WizardPage {
}
if (needsHttpAuth()) {
- httpAuthExpComposite = toolkit.createExpandableComposite(container, Section.COMPACT | Section.TWISTIE
+ httpAuthExpComposite = toolkit.createExpandableComposite(compositeContainer, Section.COMPACT | Section.TWISTIE
| Section.TITLE_BAR);
httpAuthExpComposite.clientVerticalSpacing = 0;
gridData_2 = new GridData(SWT.FILL, SWT.FILL, true, false);
gridData_2.horizontalIndent = -5;
httpAuthExpComposite.setLayoutData(gridData_2);
- httpAuthExpComposite.setFont(container.getFont());
- httpAuthExpComposite.setBackground(container.getBackground());
+ httpAuthExpComposite.setFont(compositeContainer.getFont());
+ httpAuthExpComposite.setBackground(compositeContainer.getBackground());
httpAuthExpComposite.setText("Http Authentication");
httpAuthExpComposite.addExpansionListener(new ExpansionAdapter() {
@Override
@@ -406,7 +406,7 @@ public abstract class AbstractRepositorySettingsPage extends WizardPage {
gridLayout2.numColumns = 2;
gridLayout2.verticalSpacing = 0;
httpAuthComp.setLayout(gridLayout2);
- httpAuthComp.setBackground(container.getBackground());
+ httpAuthComp.setBackground(compositeContainer.getBackground());
httpAuthExpComposite.setClient(httpAuthComp);
httpAuthButton = new Button(httpAuthComp, SWT.CHECK);
@@ -456,7 +456,7 @@ public abstract class AbstractRepositorySettingsPage extends WizardPage {
addProxySection();
}
- Composite managementComposite = new Composite(container, SWT.NULL);
+ Composite managementComposite = new Composite(compositeContainer, SWT.NULL);
GridLayout managementLayout = new GridLayout(4, false);
managementLayout.marginHeight = 0;
managementLayout.marginWidth = 0;
@@ -573,19 +573,19 @@ public abstract class AbstractRepositorySettingsPage extends WizardPage {
updateHyperlinks();
- setControl(container);
+ setControl(compositeContainer);
}
private void addProxySection() {
- proxyExpComposite = toolkit.createExpandableComposite(container, Section.COMPACT | Section.TWISTIE
+ proxyExpComposite = toolkit.createExpandableComposite(compositeContainer, Section.COMPACT | Section.TWISTIE
| Section.TITLE_BAR);
proxyExpComposite.clientVerticalSpacing = 0;
GridData gridData_2 = new GridData(SWT.FILL, SWT.FILL, true, false);
gridData_2.horizontalIndent = -5;
proxyExpComposite.setLayoutData(gridData_2);
- proxyExpComposite.setFont(container.getFont());
- proxyExpComposite.setBackground(container.getBackground());
+ proxyExpComposite.setFont(compositeContainer.getFont());
+ proxyExpComposite.setBackground(compositeContainer.getBackground());
proxyExpComposite.setText("Proxy Server Configuration");
proxyExpComposite.addExpansionListener(new ExpansionAdapter() {
@Override
@@ -601,7 +601,7 @@ public abstract class AbstractRepositorySettingsPage extends WizardPage {
gridLayout2.numColumns = 2;
gridLayout2.verticalSpacing = 0;
proxyAuthComp.setLayout(gridLayout2);
- proxyAuthComp.setBackground(container.getBackground());
+ proxyAuthComp.setBackground(compositeContainer.getBackground());
proxyExpComposite.setClient(proxyAuthComp);
Composite settingsComposite = new Composite(proxyAuthComp, SWT.NULL);
@@ -615,7 +615,7 @@ public abstract class AbstractRepositorySettingsPage extends WizardPage {
systemProxyButton.setText("Use global Network Connections preferences");
Hyperlink changeProxySettingsLink = toolkit.createHyperlink(settingsComposite, "Change Settings", SWT.NULL);
- changeProxySettingsLink.setBackground(container.getBackground());
+ changeProxySettingsLink.setBackground(compositeContainer.getBackground());
changeProxySettingsLink.addHyperlinkListener(new IHyperlinkListener() {
public void linkActivated(HyperlinkEvent e) {
@@ -758,8 +758,8 @@ public abstract class AbstractRepositorySettingsPage extends WizardPage {
(repositoryPasswordEditor).setStringValue(oldPassword);
}
- repositoryUserNameEditor.setEnabled(!selected, container);
- (repositoryPasswordEditor).setEnabled(!selected, container);
+ repositoryUserNameEditor.setEnabled(!selected, compositeContainer);
+ (repositoryPasswordEditor).setEnabled(!selected, compositeContainer);
}
public void setHttpAuth(boolean selected) {
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracQueryHit.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracQueryHit.java
deleted file mode 100644
index 4ba9bc94a..000000000
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracQueryHit.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 - 2006 Mylar eclipse.org project 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:
- * Mylar project committers - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylar.internal.trac.core;
-
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
-import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
-import org.eclipse.mylar.tasks.core.TaskList;
-
-/**
- * @author Steffen Pingel
- */
-public class TracQueryHit extends AbstractQueryHit {
-
- public TracQueryHit(TaskList taskList, String repositoryUrl, String description, String id) {
- super(taskList, repositoryUrl, description, id);
- }
-
-// public TracQueryHit(TaskList taskList, String handle) {
-// super(taskList, RepositoryTaskHandleUtil.getRepositoryUrl(handle), "", RepositoryTaskHandleUtil.getTaskId(handle));
-// }
-
- @Override
- protected AbstractRepositoryTask createTask() {
- TracTask newTask = new TracTask(this.getRepositoryUrl(), this.getTaskId(), getSummary(), true);
- newTask.setPriority(priority);
- return newTask;
- }
-
- @Override
- public String getUrl() {
- return getRepositoryUrl() + ITracClient.TICKET_URL + getTaskId();
- }
-
-}
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 96f9791df..b7635023d 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
@@ -40,6 +40,7 @@ import org.eclipse.mylar.tasks.core.RepositoryOperation;
import org.eclipse.mylar.tasks.core.RepositoryStatus;
import org.eclipse.mylar.tasks.core.RepositoryTaskAttribute;
import org.eclipse.mylar.tasks.core.RepositoryTaskData;
+import org.eclipse.mylar.tasks.core.Task;
import org.eclipse.mylar.tasks.core.TaskRepository;
/**
@@ -128,7 +129,7 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
@Override
public IStatus performQuery(AbstractRepositoryQuery query, TaskRepository repository, IProgressMonitor monitor,
- QueryHitCollector resultCollector) {
+ QueryHitCollector resultCollector, boolean force) {
final List<TracTicket> tickets = new ArrayList<TracTicket>();
@@ -140,11 +141,13 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
}
for (TracTicket ticket : tickets) {
- TracQueryHit hit = new TracQueryHit(taskList, query.getRepositoryUrl(), getTicketDescription(ticket),
- ticket.getId() + "");
- hit.setPriority(TracTask.getMylarPriority(ticket.getValue(Key.PRIORITY)));
- hit.setCompleted(TracTask.isCompleted(ticket.getValue(Key.STATUS)));
- resultCollector.accept(hit);
+ TracAttributeFactory attrFactory = new TracAttributeFactory();
+ RepositoryTaskData data = new RepositoryTaskData(attrFactory, TracCorePlugin.REPOSITORY_KIND,
+ repository.getUrl(), ""+ticket.getId(), Task.DEFAULT_TASK_KIND);
+ TracTaskDataHandler.createDefaultAttributes(attrFactory, data, tracClient, true);
+ TracTaskDataHandler.updateTaskData(repository, attrFactory, data, ticket);
+
+ resultCollector.accept(data);
}
} catch (Throwable e) {
return TracCorePlugin.toStatus(e, repository);
@@ -214,7 +217,7 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
return task;
}
- protected AbstractRepositoryTask makeTask(String repositoryUrl, String id, String summary) {
+ public AbstractRepositoryTask createTask(String repositoryUrl, String id, String summary) {
return new TracTask(repositoryUrl, id, "<description not set>", true);
}
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/AllTracTests.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/AllTracTests.java
index 62db2301a..1a313d589 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/AllTracTests.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/AllTracTests.java
@@ -43,7 +43,6 @@ public class AllTracTests {
suite.addTestSuite(RepositorySearchQueryTest.class);
suite.addTestSuite(TracTaskDataHandlerTest.class);
suite.addTestSuite(TracTaskTest.class);
- suite.addTestSuite(TracQueryHitTest.class);
suite.addTestSuite(TracRepositorySettingsPageTest.class);
suite.addTestSuite(TracClientProxyTest.class);
suite.addTestSuite(TracHyperlinkUtilTest.class);
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 8838bb48e..77b927acd 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
@@ -22,9 +22,10 @@ import org.eclipse.mylar.internal.trac.core.TracCorePlugin;
import org.eclipse.mylar.internal.trac.core.TracRepositoryQuery;
import org.eclipse.mylar.internal.trac.core.ITracClient.Version;
import org.eclipse.mylar.internal.trac.core.model.TracSearch;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
+import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.TaskRepository;
import org.eclipse.mylar.tasks.core.TaskRepositoryManager;
+import org.eclipse.mylar.tasks.ui.TaskFactory;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
import org.eclipse.mylar.tasks.ui.search.SearchHitCollector;
import org.eclipse.mylar.trac.tests.support.TestFixture;
@@ -76,17 +77,14 @@ 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);
-
SearchHitCollector collector = new SearchHitCollector(TasksUiPlugin.getTaskListManager()
- .getTaskList(), repository, query) {
- @Override
- public void addMatch(AbstractQueryHit hit) {
- super.addMatch(hit);
- assertEquals(Constants.TEST_TRAC_096_URL, hit.getRepositoryUrl());
- }
- };
+ .getTaskList(), repository, query, new TaskFactory(repository));
+
collector.run(new NullProgressMonitor());
- assertEquals(data.tickets.size(), collector.getHits().size());
+ for (AbstractRepositoryTask task : collector.getTaskHits()) {
+ assertEquals(Constants.TEST_TRAC_096_URL, task.getRepositoryUrl());
+ }
+ assertEquals(data.tickets.size(), collector.getTaskHits().size());
}
}
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracQueryHitTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracQueryHitTest.java
deleted file mode 100644
index 2ee96735d..000000000
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracQueryHitTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 - 2006 Mylar eclipse.org project 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:
- * Mylar project committers - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylar.trac.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.mylar.internal.trac.core.TracQueryHit;
-import org.eclipse.mylar.internal.trac.core.TracTask;
-import org.eclipse.mylar.tasks.core.TaskList;
-import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
-
-/**
- * @author Steffen Pingel
- */
-public class TracQueryHitTest extends TestCase {
-
- public void testAttributes() {
- TaskList taskList = TasksUiPlugin.getTaskListManager().getTaskList();
- TracQueryHit hit = new TracQueryHit(taskList, "url", "description", "123");
- hit.setPriority("P1");
- hit.setCompleted(true);
-
- TracTask task = (TracTask) hit.getOrCreateCorrespondingTask();
- assertEquals("url-123", task.getHandleIdentifier());
- assertEquals("P1", task.getPriority());
- assertEquals(true, task.isCompleted());
- }
-
-}
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 16a5f514c..44cb2ba6c 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
@@ -41,14 +41,16 @@ import org.eclipse.mylar.internal.trac.core.model.TracTicket;
import org.eclipse.mylar.internal.trac.core.model.TracVersion;
import org.eclipse.mylar.internal.trac.core.model.TracTicket.Key;
import org.eclipse.mylar.internal.trac.ui.wizard.TracRepositorySettingsPage;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
+import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
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;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
import org.eclipse.mylar.trac.tests.support.TestFixture;
import org.eclipse.mylar.trac.tests.support.XmlRpcServer.TestData;
@@ -213,20 +215,22 @@ public class TracRepositoryConnectorTest extends TestCase {
TracRepositoryQuery query = new TracRepositoryQuery(url, queryUrl, "description", tasklist);
//MultiStatus queryStatus = new MultiStatus(TracUiPlugin.PLUGIN_ID, IStatus.OK, "Query result", null);
- final List<AbstractQueryHit> result = new ArrayList<AbstractQueryHit>();
- QueryHitCollector hitCollector = new QueryHitCollector(TasksUiPlugin.getTaskListManager().getTaskList()) {
-
+ final List<RepositoryTaskData> result = new ArrayList<RepositoryTaskData>();
+ QueryHitCollector hitCollector = new QueryHitCollector(TasksUiPlugin.getTaskListManager().getTaskList(), new TaskFactory(repository)) {
+ public void accept(RepositoryTaskData data) {
+ result.add(data);
+ }
@Override
- public void addMatch(AbstractQueryHit hit) {
- result.add(hit);
+ public void accept(AbstractRepositoryTask hit) {
+ // ignore;
}};
- IStatus queryStatus = connector.performQuery(query, repository, new NullProgressMonitor(), hitCollector);
+ IStatus queryStatus = connector.performQuery(query, repository, new NullProgressMonitor(), hitCollector, false);
assertTrue(queryStatus.isOK());
assertEquals(3, result.size());
- assertEquals(data.tickets.get(0).getId() + "", result.get(0).getTaskId());
- assertEquals(data.tickets.get(1).getId() + "", result.get(1).getTaskId());
- assertEquals(data.tickets.get(2).getId() + "", result.get(2).getTaskId());
+ assertEquals(data.tickets.get(0).getId() + "", result.get(0).getId());
+ assertEquals(data.tickets.get(1).getId() + "", result.get(1).getId());
+ assertEquals(data.tickets.get(2).getId() + "", result.get(2).getId());
}
public void testUpdateTaskDetails() throws InvalidTicketException {
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 980bc474c..19072707b 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
@@ -12,15 +12,13 @@
package org.eclipse.mylar.internal.trac.ui;
import org.eclipse.mylar.core.MylarStatusHandler;
-import org.eclipse.mylar.internal.trac.core.TracQueryHit;
import org.eclipse.mylar.internal.trac.core.TracRepositoryQuery;
import org.eclipse.mylar.internal.trac.core.TracTask;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
+import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
import org.eclipse.mylar.tasks.core.DelegatingTaskExternalizer;
import org.eclipse.mylar.tasks.core.ITask;
-import org.eclipse.mylar.tasks.core.ITaskListExternalizer;
import org.eclipse.mylar.tasks.core.TaskExternalizationException;
import org.eclipse.mylar.tasks.core.TaskList;
import org.w3c.dom.Document;
@@ -44,7 +42,7 @@ public class TracTaskExternalizer extends DelegatingTaskExternalizer {
private static final String KEY_TRAC_QUERY = KEY_TRAC + KEY_QUERY;
// category related methods
-
+
@Override
public boolean canReadCategory(Node node) {
return node.getNodeName().equals(KEY_TRAC_CATEGORY);
@@ -56,7 +54,7 @@ public class TracTaskExternalizer extends DelegatingTaskExternalizer {
}
// task related methods
-
+
@Override
public boolean canCreateElementFor(ITask task) {
return task instanceof TracTask;
@@ -68,18 +66,18 @@ public class TracTaskExternalizer extends DelegatingTaskExternalizer {
}
@Override
- public ITask createTask(String repositoryUrl, String taskId, String summary, Element element, TaskList taskList, AbstractTaskContainer category, ITask parent)
- throws TaskExternalizationException {
+ public ITask createTask(String repositoryUrl, String taskId, String summary, Element element, TaskList taskList,
+ AbstractTaskContainer category, ITask parent) throws TaskExternalizationException {
TracTask task = new TracTask(repositoryUrl, taskId, summary, false);
return task;
}
// query related methods
-
- @Override
- public boolean canCreateElementFor(AbstractQueryHit queryHit) {
- return queryHit instanceof TracQueryHit;
- }
+
+// @Override
+// public boolean canCreateElementFor(AbstractQueryHit queryHit) {
+// return queryHit instanceof TracQueryHit;
+// }
@Override
public boolean canCreateElementFor(AbstractRepositoryQuery category) {
@@ -105,14 +103,9 @@ public class TracTaskExternalizer extends DelegatingTaskExternalizer {
node.setAttribute(KEY_REPOSITORY_URL, query.getRepositoryUrl());
node.setAttribute(KEY_QUERY, query.getUrl());
- for (AbstractQueryHit hit : query.getHits()) {
+ for (AbstractRepositoryTask hit : query.getHits()) {
try {
Element element = null;
- for (ITaskListExternalizer externalizer : super.getDelegateExternalizers()) {
- if (externalizer.canCreateElementFor(hit)) {
- element = externalizer.createQueryHitElement(hit, doc, node);
- }
- }
if (element == null) {
createQueryHitElement(hit, doc, node);
}
@@ -124,10 +117,10 @@ public class TracTaskExternalizer extends DelegatingTaskExternalizer {
return node;
}
- @Override
- public String getQueryHitTagName() {
- return KEY_TRAC_QUERY_HIT;
- }
+// @Override
+// public String getQueryHitTagName() {
+// return KEY_TRAC_QUERY_HIT;
+// }
@Override
public String getQueryTagNameForElement(AbstractRepositoryQuery query) {
@@ -162,10 +155,12 @@ public class TracTaskExternalizer extends DelegatingTaskExternalizer {
return new TracRepositoryQuery(repositoryUrl, queryUrl, label, taskList);
}
- @Override
- public AbstractQueryHit createQueryHit(String repositoryUrl, String taskId, String summary, Element element, TaskList taskList, AbstractRepositoryQuery query)
- throws TaskExternalizationException {
- return new TracQueryHit(taskList, repositoryUrl, summary, taskId);
- }
+// @Override
+// public AbstractQueryHit createQueryHit(String repositoryUrl, String taskId,
+// String summary, Element element, TaskList taskList, AbstractRepositoryQuery
+// query)
+// throws TaskExternalizationException {
+// return new TracQueryHit(taskList, repositoryUrl, summary, taskId);
+// }
}
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 d4b55a425..415d355ab 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
@@ -13,6 +13,7 @@ import org.eclipse.mylar.internal.trac.core.TracRepositoryQuery;
import org.eclipse.mylar.internal.trac.core.model.TracSearch;
import org.eclipse.mylar.internal.trac.core.model.TracSearchFilter;
import org.eclipse.mylar.internal.trac.core.model.TracSearchFilter.CompareOperator;
+import org.eclipse.mylar.tasks.ui.TaskFactory;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
import org.eclipse.mylar.tasks.ui.editors.AbstractNewRepositoryTaskEditor;
import org.eclipse.mylar.tasks.ui.search.SearchHitCollector;
@@ -46,7 +47,7 @@ public class NewTracTaskEditor extends AbstractNewRepositoryTaskEditor {
TasksUiPlugin.getTaskListManager().getTaskList());
SearchHitCollector collector = new SearchHitCollector(TasksUiPlugin.getTaskListManager().getTaskList(),
- repository, query);
+ repository, query, new TaskFactory(repository));
return collector;
}

Back to the top