Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2006-12-22 18:51:28 -0500
committermkersten2006-12-22 18:51:28 -0500
commitf5118110a7fb5759ffcc83e07461795f690ad9e3 (patch)
tree7aacdaaf63761a52acf3c7557d3e162ddf4bc2e7
parente2d57bbef2ffbc2297050d1ad567804aafd42d47 (diff)
downloadorg.eclipse.mylyn.tasks-f5118110a7fb5759ffcc83e07461795f690ad9e3.tar.gz
org.eclipse.mylyn.tasks-f5118110a7fb5759ffcc83e07461795f690ad9e3.tar.xz
org.eclipse.mylyn.tasks-f5118110a7fb5759ffcc83e07461795f690ad9e3.zip
RESOLVED - bug 168776: Changing server in task repository does not update servers in tasks and hits
https://bugs.eclipse.org/bugs/show_bug.cgi?id=168776
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractQueryHit.java7
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskList.java2
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java11
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java2
5 files changed, 16 insertions, 8 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 949711f58..1c0f8d734 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
@@ -34,14 +34,11 @@ public abstract class AbstractQueryHit implements ITaskListElement {
private AbstractRepositoryQuery parent;
- private String handleIDentifier;
-
protected AbstractQueryHit(TaskList taskList, String repositoryUrl, String description, String id) {
this.taskList = taskList;
this.repositoryUrl = repositoryUrl;
this.description = description;
this.id = id;
- this.handleIDentifier = AbstractRepositoryTask.getHandle(repositoryUrl, id);
}
public AbstractRepositoryQuery getParent() {
@@ -112,10 +109,8 @@ public abstract class AbstractQueryHit implements ITaskListElement {
public String getHandleIdentifier() {
if (task != null) {
return task.getHandleIdentifier();
- } else {
- return handleIDentifier;
}
-// return AbstractRepositoryTask.getHandle(repositoryUrl, id);
+ return AbstractRepositoryTask.getHandle(repositoryUrl, id);
}
/**
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 2818e7673..8a68bf7d0 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
@@ -108,7 +108,9 @@ public class TaskList {
if (query.getRepositoryUrl().equals(oldUrl)) {
query.setRepositoryUrl(newUrl);
for (AbstractQueryHit hit : query.getHits()) {
+ queryHits.remove(hit.getHandleIdentifier());
hit.setRepositoryUrl(newUrl);
+ queryHits.put(hit.getHandleIdentifier(), hit);
}
for (ITaskListChangeListener listener : changeListeners) {
listener.containerInfoChanged(query);
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 8626651e7..bb23c0cf6 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
@@ -155,6 +155,17 @@ 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 testMigrateTaskHandles() {
AbstractRepositoryTask task = new MockRepositoryTask("http://a-123");
manager.getTaskList().addTask(task);
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 332065ba2..736aa978b 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
@@ -264,7 +264,7 @@ public class TasksUiUtil {
IEditorPart part = openEditor(editorInput, TaskListPreferenceConstants.TASK_EDITOR_ID, page);
if (newTask && part instanceof TaskEditor) {
TaskEditor taskEditor = (TaskEditor)part;
- taskEditor.focusDescription();
+ taskEditor.setFocusOfActivePage();
}
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
index baba5ad87..56b133f7c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
@@ -298,7 +298,7 @@ public class TaskEditor extends FormEditor {
// }
// }
- public void focusDescription() {
+ public void setFocusOfActivePage() {
if (this.getActivePage() > -1 && this.getActivePage() != browserPageIndex) {
IFormPage page = this.getPages()[this.getActivePage()];
if (page != null) {

Back to the top