Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2007-01-24 18:08:04 -0500
committermkersten2007-01-24 18:08:04 -0500
commit2fc930af7ade8170ccfcbdc6026587524b2f7423 (patch)
tree71119a3b1a338e6590a333b2c56f4695d184b8f0 /org.eclipse.mylyn.tasks.core
parentb30ea5713f0b8891cfa4ecc10109802de11a76d4 (diff)
downloadorg.eclipse.mylyn.tasks-2fc930af7ade8170ccfcbdc6026587524b2f7423.tar.gz
org.eclipse.mylyn.tasks-2fc930af7ade8170ccfcbdc6026587524b2f7423.tar.xz
org.eclipse.mylyn.tasks-2fc930af7ade8170ccfcbdc6026587524b2f7423.zip
NEW - bug 171590: [api] make ITaskListElement's implement Comparable
https://bugs.eclipse.org/bugs/show_bug.cgi?id=171590
Diffstat (limited to 'org.eclipse.mylyn.tasks.core')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractQueryHit.java3
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryQuery.java2
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java9
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeActivityDelegate.java4
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeContainer.java9
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListElement.java2
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/Task.java7
7 files changed, 29 insertions, 7 deletions
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 1c0f8d734..294a84b12 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
@@ -178,4 +178,7 @@ public abstract class AbstractQueryHit implements ITaskListElement {
// ignore
}
+ public int compareTo(ITaskListElement taskListElement) {
+ return this.id.compareTo(((AbstractQueryHit)taskListElement).id);
+ }
}
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 1c07bb811..1465c6bbe 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
@@ -26,7 +26,6 @@ public abstract class AbstractRepositoryQuery extends AbstractTaskContainer {
protected int maxHits;
- //private Set<AbstractQueryHit> hits = new HashSet<AbstractQueryHit>();
private Set<String> hitHandles = new HashSet<String>();
protected String lastRefreshTimeStamp = "<never>";
@@ -181,4 +180,5 @@ public abstract class AbstractRepositoryQuery extends AbstractTaskContainer {
public void setStatus(IStatus status) {
this.status = status;
}
+
} \ No newline at end of file
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 c9b693851..f6c4b3805 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
@@ -108,9 +108,16 @@ public abstract class AbstractTaskContainer implements ITaskListElement {
return "container: " + handle;
}
-
public boolean canRename() {
return true;
}
+
+ /**
+ * The handle for most containers is their description. Override to specify a
+ * different natural ordering.
+ */
+ public int compareTo(ITaskListElement taskListElement) {
+ return getHandleIdentifier().compareTo(((AbstractTaskContainer)taskListElement).getHandleIdentifier());
+ }
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeActivityDelegate.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeActivityDelegate.java
index 746fa42e4..57658336c 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeActivityDelegate.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeActivityDelegate.java
@@ -244,4 +244,8 @@ public class DateRangeActivityDelegate implements ITask {
public void setUrl(String url) {
task.setUrl(url);
}
+
+ public int compareTo(ITaskListElement taskListElement) {
+ return task.toString().compareTo(((Task)taskListElement).toString());
+ }
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeContainer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeContainer.java
index 49e5d2fa9..30dc1ae64 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeContainer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeContainer.java
@@ -196,4 +196,13 @@ public class DateRangeContainer extends AbstractTaskContainer {
public boolean isLocal() {
return true;
}
+
+ /**
+ * The handle for most containers is their description. Override to specify a
+ * different natural ordering.
+ */
+ @Override
+ public int compareTo(ITaskListElement taskListElement) {
+ return startDate.compareTo(((DateRangeContainer)taskListElement).startDate);
+ }
} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListElement.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListElement.java
index ac3b8503e..4b19ec2e5 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListElement.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListElement.java
@@ -14,7 +14,7 @@ package org.eclipse.mylar.tasks.core;
/**
* @author Mik Kersten
*/
-public interface ITaskListElement {
+public interface ITaskListElement extends Comparable<ITaskListElement> {
public abstract String getPriority();
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/Task.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/Task.java
index 1e41e4d85..921c7d209 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/Task.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/Task.java
@@ -177,10 +177,6 @@ public class Task implements ITask {
return active;
}
- public String getToolTipText() {
- return getSummary();
- }
-
@Override
public boolean equals(Object obj) {
if (obj instanceof Task && obj != null) {
@@ -368,4 +364,7 @@ public class Task implements ITask {
this.kind = kind;
}
+ public int compareTo(ITaskListElement taskListElement) {
+ return description.compareTo(((Task)taskListElement).description);
+ }
}

Back to the top