Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/RepositorySynchronizationManager.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java112
3 files changed, 74 insertions, 52 deletions
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 6117823ff..053db4a8b 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
@@ -299,9 +299,9 @@ public class RepositorySynchronizationManager {
break;
}
- if (status == RepositoryTaskSyncState.SYNCHRONIZED || repositoryTask.getLastSyncDateStamp() == null) {
- repositoryTask.setLastSyncDateStamp(newTaskData.getLastModified());
- }
+// if (/*status == RepositoryTaskSyncState.SYNCHRONIZED || */repositoryTask.getLastSyncDateStamp() == null) {
+// repositoryTask.setLastSyncDateStamp(newTaskData.getLastModified());
+// }
repositoryTask.setTaskData(newTaskData);
repositoryTask.setSyncState(status);
@@ -376,7 +376,7 @@ public class RepositorySynchronizationManager {
if (read && repositoryTask.getSyncState().equals(RepositoryTaskSyncState.INCOMING)) {
if (repositoryTask.getTaskData() != null && repositoryTask.getTaskData().getLastModified() != null) {
repositoryTask.setLastSyncDateStamp(repositoryTask.getTaskData().getLastModified());
- // TasksUiPlugin.getDefault().getTaskDataManager().clearIncoming(repositoryTask.getHandleIdentifier());
+ TasksUiPlugin.getDefault().getTaskDataManager().clearIncoming(repositoryTask.getHandleIdentifier());
}
repositoryTask.setSyncState(RepositoryTaskSyncState.SYNCHRONIZED);
TasksUiPlugin.getTaskListManager().getTaskList().notifyLocalInfoChanged(repositoryTask);
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 ffc5b2119..a3dde93fd 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
@@ -201,7 +201,7 @@ public class TasksUiUtil {
repositoryTask.setTaskData(TasksUiPlugin.getDefault().getTaskDataManager()
.getRepositoryTaskData(repositoryTask.getHandleIdentifier()));
}
- TasksUiUtil.openEditor(task, true, false);
+ TasksUiUtil.openEditor(task, false, false);
TasksUiPlugin.getSynchronizationManager().setTaskRead(repositoryTask, true);
TasksUiPlugin.getSynchronizationManager().synchronize(connector, repositoryTask, false, null);
} else {
@@ -212,9 +212,9 @@ public class TasksUiUtil {
// Mark read here too so that hits get
// marked as read upon opening
// TODO: if synch job failed, don't mark
- // read
- TasksUiPlugin.getSynchronizationManager().setTaskRead(repositoryTask, true);
+ // read
TasksUiUtil.openEditor(task, false);
+ TasksUiPlugin.getSynchronizationManager().setTaskRead(repositoryTask, true);
}
});
if (refreshJob == 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 0856dacfc..4835b6fea 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
@@ -370,11 +370,11 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
"Changed - " + repositoryTask.getSummary(),
"Editor will refresh with new incoming changes.");
- TasksUiPlugin.getSynchronizationManager().setTaskRead(repositoryTask, true);
-
updateContents();
- TasksUiPlugin.getDefault().getTaskDataManager().clearIncoming(
- repositoryTask.getHandleIdentifier());
+ // TasksUiPlugin.getSynchronizationManager().setTaskRead(repositoryTask,
+ // true);
+ // TasksUiPlugin.getDefault().getTaskDataManager().clearIncoming(
+ // repositoryTask.getHandleIdentifier());
} else if (repositoryTask.getSyncState() == RepositoryTaskSyncState.OUTGOING
&& !taskData.hasLocalChanges()) {
submitting = false;
@@ -755,7 +755,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
toolkit.createLabel(headerInfoComposite, " ID: ").setFont(TITLE_FONT);
toolkit.createText(headerInfoComposite, id, SWT.FLAT | SWT.READ_ONLY);
}
-
+
String openedDateString = "";
String modifiedDateString = "";
final ITaskDataHandler taskDataManager = connector.getTaskDataHandler();
@@ -1212,14 +1212,14 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
*/
attachmentsTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent e) {
-
- if(e.getSelection().isEmpty()) {
+
+ if (e.getSelection().isEmpty()) {
return;
}
-
+
RepositoryAttachment att = (RepositoryAttachment) (((StructuredSelection) e.getSelection())
.getFirstElement());
-
+
popupMenu.removeAll();
popupMenu.add(openMenu);
openMenu.removeAll();
@@ -1661,17 +1661,6 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
addCommentsLayout.numColumns = 1;
addCommentsComposite.setLayout(addCommentsLayout);
GridDataFactory.fillDefaults().grab(true, false).applyTo(addCommentsComposite);
- AbstractRepositoryTask repositoryTask = null;
- ITaskDataHandler offlineHandler = null;
- IEditorInput input = this.getEditorInput();
- if (input instanceof RepositoryTaskEditorInput) {
- RepositoryTaskEditorInput existingInput = (RepositoryTaskEditorInput) input;
- repositoryTask = existingInput.getRepositoryTask();
-
- AbstractRepositoryConnector connector = (AbstractRepositoryConnector) TasksUiPlugin.getRepositoryManager()
- .getRepositoryConnector(taskData.getRepositoryKind());
- offlineHandler = connector.getTaskDataHandler();
- }
boolean foundNew = false;
@@ -1682,32 +1671,15 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
final ExpandableComposite expandableComposite = toolkit.createExpandableComposite(addCommentsComposite,
ExpandableComposite.TREE_NODE | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT);
- // Expand new comments
- if (repositoryTask != null && offlineHandler != null) {
- Date lastModDate = offlineHandler.getDateForAttributeType(RepositoryTaskAttribute.DATE_MODIFIED,
- repositoryTask.getLastSyncDateStamp());
-
- if (lastModDate != null) {
- // reduce granularity to minutes
- Calendar calLastMod = Calendar.getInstance();
- calLastMod.setTimeInMillis(lastModDate.getTime());
- calLastMod.set(Calendar.SECOND, 0);
-
- Date commentDate = offlineHandler.getDateForAttributeType(RepositoryTaskAttribute.COMMENT_DATE,
- taskComment.getCreated());
- if (commentDate != null) {
- if (commentDate.after(calLastMod.getTime())) {
- expandableComposite.setBackground(backgroundIncoming);
- foundNew = true;
- }
- if (commentDate.equals(calLastMod.getTime()) || commentDate.after(calLastMod.getTime())) {
- expandableComposite.setExpanded(true);
- }
- }
- }
- } else if (repositoryTask != null && repositoryTask.getLastSyncDateStamp() == null && !it.hasNext()) {
- // no task data (query hit?) so expand last comment
+
+ if (repositoryTask != null && repositoryTask.getLastSyncDateStamp() == null) {
+ // hit? Expose all comments
expandableComposite.setExpanded(true);
+ foundNew = true;
+ } else if (isNewComment(taskComment)) {
+ expandableComposite.setBackground(backgroundIncoming);
+ expandableComposite.setExpanded(true);
+ foundNew = true;
}
expandableComposite.setText(taskComment.getNumber() + ": " + taskComment.getAuthorName() + ", "
@@ -1768,6 +1740,53 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
}
}
+ private boolean isNewComment(TaskComment comment) {
+ RepositoryTaskData oldTaskData = editorInput.getOldTaskData();
+ if (oldTaskData == null) {
+ // TODO: ever get here? Dead code?
+ if (repositoryTask != null) {
+ if (repositoryTask.getLastSyncDateStamp() == null) {
+ // new hit
+ return true;
+ }
+ AbstractRepositoryConnector connector = (AbstractRepositoryConnector) TasksUiPlugin
+ .getRepositoryManager().getRepositoryConnector(taskData.getRepositoryKind());
+ ITaskDataHandler offlineHandler = connector.getTaskDataHandler();
+ if (offlineHandler != null) {
+
+ Date lastSyncDate = offlineHandler.getDateForAttributeType(RepositoryTaskAttribute.DATE_MODIFIED,
+ repositoryTask.getLastSyncDateStamp());
+
+ if (lastSyncDate != null) {
+
+ // reduce granularity to minutes
+ Calendar calLastMod = Calendar.getInstance();
+ calLastMod.setTimeInMillis(lastSyncDate.getTime());
+ calLastMod.set(Calendar.SECOND, 0);
+ // System.err.println(">>> "+calLastMod.toString());
+ // 2007-02-15 15:23:09
+ Date commentDate = offlineHandler.getDateForAttributeType(RepositoryTaskAttribute.COMMENT_DATE,
+ comment.getCreated());
+ if (commentDate != null) {
+ if (commentDate.after(calLastMod.getTime())) {
+ return true;
+ // expandableComposite.setBackground(backgroundIncoming);
+ // foundNew = true;
+ }
+ // if (commentDate.equals(calLastMod.getTime()) ||
+ // commentDate.after(calLastMod.getTime())) {
+ // expandableComposite.setExpanded(true);
+ // }
+ }
+ }
+ }
+ }
+ return false;
+ } else {
+ return (comment.getNumber() > oldTaskData.getComments().size());
+ }
+ }
+
protected void createNewCommentLayout(Composite composite) {
newCommentSection = createSection(composite, getSectionLabel(SECTION_NAME.NEWCOMMENT_SECTION));
@@ -2661,6 +2680,9 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
outlinePage.getOutlineTreeViewer().setInput(taskOutlineModel);
outlinePage.getOutlineTreeViewer().refresh(true);
}
+ if (repositoryTask != null) {
+ TasksUiPlugin.getSynchronizationManager().setTaskRead(repositoryTask, true);
+ }
}
});

Back to the top