diff options
author | relves | 2007-02-16 18:09:28 +0000 |
---|---|---|
committer | relves | 2007-02-16 18:09:28 +0000 |
commit | 4c604559a56f629af4bdc37a4810833aa87be0fa (patch) | |
tree | 12ac29197f693fd1cea0a2770a5d776a82b62651 | |
parent | 1984c89dbefa2f40ae8b1de2694a780804b43e39 (diff) | |
download | org.eclipse.mylyn.tasks-4c604559a56f629af4bdc37a4810833aa87be0fa.tar.gz org.eclipse.mylyn.tasks-4c604559a56f629af4bdc37a4810833aa87be0fa.tar.xz org.eclipse.mylyn.tasks-4c604559a56f629af4bdc37a4810833aa87be0fa.zip |
NEW - bug 174059: Bug editor does not highlight changed attributes
https://bugs.eclipse.org/bugs/show_bug.cgi?id=174059
3 files changed, 41 insertions, 56 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugzillaTaskEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugzillaTaskEditor.java index 3dac34bb7..efd3a72ee 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugzillaTaskEditor.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugzillaTaskEditor.java @@ -84,7 +84,7 @@ public class NewBugzillaTaskEditor extends AbstractNewRepositoryTaskEditor { textFieldComposite.setLayout(textLayout); Text textField = createTextField(textFieldComposite, taskData .getAttribute(RepositoryTaskAttribute.USER_ASSIGNED), SWT.FLAT); - + toolkit.paintBordersFor(textFieldComposite); GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).applyTo(textField); peopleSection.setClient(peopleComposite); toolkit.paintBordersFor(peopleComposite); 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 803e0aa63..dce19f243 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,22 +201,15 @@ public class TasksUiUtil { repositoryTask.setTaskData(TasksUiPlugin.getDefault().getTaskDataManager() .getRepositoryTaskData(repositoryTask.getHandleIdentifier())); } - // Open editor synchronously so that editor first opens - // THEN marked read followed by sync. - TasksUiUtil.openEditor(task, false, false); - TasksUiPlugin.getSynchronizationManager().setTaskRead(repositoryTask, true); + + TasksUiUtil.openEditor(task, true, false); TasksUiPlugin.getSynchronizationManager().synchronize(connector, repositoryTask, false, null); } else { Job refreshJob = TasksUiPlugin.getSynchronizationManager().synchronize(connector, repositoryTask, true, new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { - // Mark read here too so that hits get - // marked as read upon opening - // TODO: if synch job failed, don't mark - // read TasksUiUtil.openEditor(task, false); - TasksUiPlugin.getSynchronizationManager().setTaskRead(repositoryTask, true); } }); if (refreshJob == null) { @@ -271,6 +264,9 @@ public class TasksUiUtil { TaskEditor taskEditor = (TaskEditor) part; taskEditor.setFocusOfActivePage(); } + if (task instanceof AbstractRepositoryTask) { + TasksUiPlugin.getSynchronizationManager().setTaskRead((AbstractRepositoryTask) task, true); + } } } }); @@ -278,12 +274,11 @@ public class TasksUiUtil { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { final IWorkbenchPage page = window.getActivePage(); - if (page != null) { - PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { - public void run() { - openEditor(editorInput, TaskListPreferenceConstants.TASK_EDITOR_ID, page); - } - }); + if (page != null) { + openEditor(editorInput, TaskListPreferenceConstants.TASK_EDITOR_ID, page); + if (task instanceof AbstractRepositoryTask) { + TasksUiPlugin.getSynchronizationManager().setTaskRead((AbstractRepositoryTask) task, true); + } } } else { MylarStatusHandler.log("Unable to open editor for " + task.getSummary(), TasksUiUtil.class); 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 4835b6fea..9a7c401ae 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 @@ -1671,7 +1671,6 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage { final ExpandableComposite expandableComposite = toolkit.createExpandableComposite(addCommentsComposite, ExpandableComposite.TREE_NODE | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT); - if (repositoryTask != null && repositoryTask.getLastSyncDateStamp() == null) { // hit? Expose all comments expandableComposite.setExpanded(true); @@ -1741,50 +1740,41 @@ 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); - // } + + 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); + + Date commentDate = offlineHandler.getDateForAttributeType(RepositoryTaskAttribute.COMMENT_DATE, + comment.getCreated()); + if (commentDate != null) { + if (commentDate.after(calLastMod.getTime())) { + return true; } } } } - return false; - } else { - return (comment.getNumber() > oldTaskData.getComments().size()); } + return false; + + // Simple test (will not reveal new comments if offline data was lost + // return (comment.getNumber() > oldTaskData.getComments().size()); } protected void createNewCommentLayout(Composite composite) { |