Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2007-06-14 20:05:46 -0400
committermkersten2007-06-14 20:05:46 -0400
commit1a35f454db6f5809e027b2775bd8d09fde862da3 (patch)
tree7b22edc94ed4064ce0e3fe638d4de26b3b83d325
parent7a7cd7469cd99fdffee773d13b0d2a5468b934a3 (diff)
downloadorg.eclipse.mylyn.tasks-1a35f454db6f5809e027b2775bd8d09fde862da3.tar.gz
org.eclipse.mylyn.tasks-1a35f454db6f5809e027b2775bd8d09fde862da3.tar.xz
org.eclipse.mylyn.tasks-1a35f454db6f5809e027b2775bd8d09fde862da3.zip
Version update
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalTask.java4
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/QueryHitCollector.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/MarkTaskReadAction.java3
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/RepositorySynchronizationManager.java9
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskFactory.java4
5 files changed, 17 insertions, 5 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalTask.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalTask.java
index fd72dc245..b70740a3f 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalTask.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalTask.java
@@ -18,6 +18,8 @@ import org.eclipse.mylyn.tasks.core.AbstractTask;
*/
public class LocalTask extends AbstractTask {
+ public static final String SYNC_DATE_NOW = "now";
+
public LocalTask(String taskId, String summary) {
super(LocalRepositoryConnector.REPOSITORY_URL, taskId, summary);
}
@@ -37,7 +39,7 @@ public class LocalTask extends AbstractTask {
}
public String getLastSyncDateStamp() {
- return "now";
+ return SYNC_DATE_NOW;
}
public String getOwner() {
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 310e337c3..cd1b9480b 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
@@ -15,6 +15,7 @@ import java.util.Set;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.mylyn.tasks.core.AbstractTask.RepositoryTaskSyncState;
/**
* Collects QueryHits resulting from repository search
@@ -48,6 +49,7 @@ public class QueryHitCollector implements ITaskCollector {
AbstractTask existingTask = taskList.getTask(task.getHandleIdentifier());
if (existingTask == null) {
task.setStale(true);
+ task.setSyncState(RepositoryTaskSyncState.INCOMING);
} else {
// preserve meta attributes of existing task
task.setLastSyncDateStamp(existingTask.getLastSyncDateStamp());
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/MarkTaskReadAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/MarkTaskReadAction.java
index 0ba1f42eb..4c410eb30 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/MarkTaskReadAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/MarkTaskReadAction.java
@@ -13,6 +13,7 @@ package org.eclipse.mylyn.internal.tasks.ui.actions;
import java.util.List;
+import org.eclipse.mylyn.internal.tasks.core.LocalTask;
import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
@@ -37,7 +38,7 @@ public class MarkTaskReadAction extends AbstractTaskAction {
setEnabled(selectedElements.size() > 0);
if (selectedElements.size() == 1 && (selectedElements.get(0) instanceof AbstractTask)) {
AbstractTask task = (AbstractTask) selectedElements.get(0);
- setEnabled(!task.isLocal());
+ setEnabled(!(task instanceof LocalTask));
} else {
setEnabled(true);
}
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 ede0650e2..2def339c1 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
@@ -9,6 +9,7 @@
package org.eclipse.mylyn.tasks.ui;
import java.util.Collections;
+import java.util.Date;
import java.util.HashSet;
import java.util.Set;
@@ -17,6 +18,7 @@ import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.mylyn.core.MylarStatusHandler;
+import org.eclipse.mylyn.internal.tasks.core.LocalTask;
import org.eclipse.mylyn.internal.tasks.core.TaskDataManager;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery;
@@ -272,7 +274,7 @@ public class RepositorySynchronizationManager {
TaskDataManager dataManager = TasksUiPlugin.getDefault().getTaskDataManager();
RepositoryTaskData taskData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(
repositoryTask.getHandleIdentifier());
-
+
if (read && repositoryTask.getSyncState().equals(RepositoryTaskSyncState.INCOMING)) {
if (taskData != null && taskData.getLastModified() != null) {
repositoryTask.setLastSyncDateStamp(taskData.getLastModified());
@@ -299,7 +301,12 @@ public class RepositorySynchronizationManager {
// == null) {
dataManager.setOldTaskData(repositoryTask.getHandleIdentifier(), taskData);
// }
+ } else if (repositoryTask.getLastSyncDateStamp() == null && repositoryTask.isLocal()) {
+ // fall back for cases where the stamp is missing, set bogus date
+ repositoryTask.setLastSyncDateStamp(LocalTask.SYNC_DATE_NOW);
}
+
+
} else if (!read && repositoryTask.getSyncState().equals(RepositoryTaskSyncState.SYNCHRONIZED)) {
repositoryTask.setSyncState(RepositoryTaskSyncState.INCOMING);
TasksUiPlugin.getTaskListManager().getTaskList().notifyTaskChanged(repositoryTask, false);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskFactory.java
index 6f0560ff1..e6b14a1dc 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskFactory.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskFactory.java
@@ -18,6 +18,7 @@ import org.eclipse.mylyn.tasks.core.ITaskFactory;
import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
import org.eclipse.mylyn.tasks.core.TaskList;
import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.core.AbstractTask.RepositoryTaskSyncState;
/**
* Interim factory
@@ -67,9 +68,8 @@ public class TaskFactory implements ITaskFactory {
public AbstractTask createTask(RepositoryTaskData taskData, IProgressMonitor monitor) throws CoreException {
AbstractTask repositoryTask = taskList.getTask(taskData.getRepositoryUrl(), taskData.getId());
if (repositoryTask == null) {
-
repositoryTask = connector.createTaskFromTaskData(repository, taskData, true, monitor);
-
+ repositoryTask.setSyncState(RepositoryTaskSyncState.INCOMING);
if (updateTasklist) {
taskList.addTask(repositoryTask);
synchManager.saveIncoming(repositoryTask, taskData, forced);

Back to the top