Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2007-06-25 04:31:46 +0000
committermkersten2007-06-25 04:31:46 +0000
commitb64809fc17bc58672536d8cb3c5bb1ea7fe41ad0 (patch)
tree03c51fa6584584d8c8837ab6d993121954fcd8c6
parent4662da865e06246ae6d9b0ead674599f4ea04040 (diff)
downloadorg.eclipse.mylyn.tasks-b64809fc17bc58672536d8cb3c5bb1ea7fe41ad0.tar.gz
org.eclipse.mylyn.tasks-b64809fc17bc58672536d8cb3c5bb1ea7fe41ad0.tar.xz
org.eclipse.mylyn.tasks-b64809fc17bc58672536d8cb3c5bb1ea7fe41ad0.zip
RESOLVED - bug 185351: [performance] Need to optimize calculation of Task hash code
https://bugs.eclipse.org/bugs/show_bug.cgi?id=185351
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java7
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewAttachmentWizard.java2
3 files changed, 8 insertions, 3 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java
index 05582d03b..6ed338bce 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java
@@ -172,6 +172,7 @@ public abstract class AbstractTask extends AbstractTaskContainer {
/**
* Final to preserve the handle identifier format required by the framework.
*/
+ @Override
public final String getHandleIdentifier() {
return super.getHandleIdentifier();
}
@@ -240,6 +241,7 @@ public abstract class AbstractTask extends AbstractTaskContainer {
return repositoryUrl;
}
+ @Override
public final void setHandleIdentifier(String handleIdentifier) {
throw new RuntimeException("Cannot set the handle identifier of a task, set repository URL instead.");
}
@@ -283,7 +285,7 @@ public abstract class AbstractTask extends AbstractTaskContainer {
@Override
public boolean equals(Object obj) {
- if (obj instanceof AbstractTask && obj != null) {
+ if (obj instanceof AbstractTask) {
return this.getHandleIdentifier().compareTo(((AbstractTask) obj).getHandleIdentifier()) == 0;
} else {
return false;
@@ -308,6 +310,7 @@ public abstract class AbstractTask extends AbstractTaskContainer {
}
}
+ @Override
public String getPriority() {
return priority;
}
@@ -352,6 +355,7 @@ public abstract class AbstractTask extends AbstractTaskContainer {
return containers;
}
+ @Override
public String getSummary() {
return summary;
}
@@ -428,6 +432,7 @@ public abstract class AbstractTask extends AbstractTaskContainer {
this.taskKind = kind;
}
+ @Override
public int compareTo(AbstractTaskContainer taskListElement) {
return summary.compareTo(((AbstractTask) taskListElement).summary);
}
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 b6b9edc99..3b2f64ae7 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
@@ -140,6 +140,6 @@ public abstract class AbstractTaskContainer extends PlatformObject implements Co
* The handle for most containers is their summary. Override to specify a different natural ordering.
*/
public int compareTo(AbstractTaskContainer taskListElement) {
- return getHandleIdentifier().compareTo(((AbstractTaskContainer) taskListElement).getHandleIdentifier());
+ return getHandleIdentifier().compareTo(taskListElement.getHandleIdentifier());
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewAttachmentWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewAttachmentWizard.java
index 8620d17bd..24e6ba6a9 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewAttachmentWizard.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewAttachmentWizard.java
@@ -214,7 +214,7 @@ public class NewAttachmentWizard extends Wizard {
* If task is open, force inplace refresh Must be called from UI thread.
*/
public static boolean forceRefreshInplace(AbstractTask task) {
- if (task instanceof AbstractTask) {
+ if (task != null) {
String handleTarget = task.getHandleIdentifier();
for (TaskEditor editor : TasksUiUtil.getActiveRepositoryTaskEditors()) {
if (editor.getEditorInput() instanceof AbstractRepositoryTaskEditorInput) {

Back to the top