Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2011-05-30 21:59:03 +0000
committerspingel2011-05-30 21:59:03 +0000
commit5e0847972d60c54c151573cf998cfc86f20ea9ca (patch)
tree094d2c07ea17a78f42adf7516693f6b23f94d184 /org.eclipse.mylyn.tasks.ui
parent0bfb05edd3b1a2425eb397fe6be605462046fa42 (diff)
downloadorg.eclipse.mylyn.tasks-5e0847972d60c54c151573cf998cfc86f20ea9ca.tar.gz
org.eclipse.mylyn.tasks-5e0847972d60c54c151573cf998cfc86f20ea9ca.tar.xz
org.eclipse.mylyn.tasks-5e0847972d60c54c151573cf998cfc86f20ea9ca.zip
NEW - bug 237546: expand new comment when submitting changes to the repository
https://bugs.eclipse.org/bugs/show_bug.cgi?id=237546
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java26
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java33
2 files changed, 45 insertions, 14 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java
index ba7908785..ffbdecbd9 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java
@@ -312,7 +312,7 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
getTaskData().getAttributeMapper().updateTaskComment(taskComment, commentAttribute);
int style = ExpandableComposite.TREE_NODE | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT
| ExpandableComposite.COMPACT;
- if (hasIncomingChanges || expandAllInProgress) {
+ if (hasIncomingChanges || (expandAllInProgress && !suppressExpandViewers)) {
style |= ExpandableComposite.EXPANDED;
}
commentComposite = toolkit.createExpandableComposite(composite, style);
@@ -571,6 +571,8 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
private Font privateFont;
+ private boolean suppressExpandViewers;
+
public TaskEditorCommentPart() {
this.commentGroupStrategy = new CommentGroupStrategy() {
@Override
@@ -698,9 +700,10 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
}
}
- private void expandAllComments() {
+ private void expandAllComments(boolean expandViewers) {
try {
expandAllInProgress = true;
+ suppressExpandViewers = !expandViewers;
getTaskEditorPage().setReflow(false);
if (section != null) {
@@ -710,19 +713,18 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
CommonFormUtil.setExpanded(section, true);
- //if (expandGroups) {
- List<CommentGroupViewer> viewers = getCommentGroupViewers();
- for (int i = viewers.size() - 1; i >= 0; i--) {
- if (!viewers.get(i).isFullyExpanded()) {
- viewers.get(i).setExpanded(true);
- // bug 280152: expand all groups
- //break;
+ if (expandViewers) {
+ List<CommentGroupViewer> viewers = getCommentGroupViewers();
+ for (int i = viewers.size() - 1; i >= 0; i--) {
+ if (!viewers.get(i).isFullyExpanded()) {
+ viewers.get(i).setExpanded(true);
+ }
}
}
- //}
}
} finally {
expandAllInProgress = false;
+ suppressExpandViewers = false;
getTaskEditorPage().setReflow(true);
}
getTaskEditorPage().reflow();
@@ -760,7 +762,7 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
Action expandAllAction = new Action("") { //$NON-NLS-1$
@Override
public void run() {
- expandAllComments();
+ expandAllComments(true);
}
};
expandAllAction.setImageDescriptor(CommonImages.EXPAND_ALL_SMALL);
@@ -838,7 +840,7 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
if (commentAttribute == null) {
return null;
}
- expandAllComments();
+ expandAllComments(false);
List<CommentGroupViewer> groupViewers = getCommentGroupViewers();
for (CommentGroupViewer groupViewer : groupViewers) {
for (CommentViewer viewer : groupViewer.getCommentViewers()) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java
index 9cb51aa25..d9b5d248a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java
@@ -188,8 +188,11 @@ public abstract class AbstractTaskEditorPage extends TaskFormPage implements ISe
private final boolean attachContext;
- public SubmitTaskJobListener(boolean attachContext) {
+ private final boolean expandLastComment;
+
+ public SubmitTaskJobListener(boolean attachContext, boolean expandLastComment) {
this.attachContext = attachContext;
+ this.expandLastComment = expandLastComment;
}
@Override
@@ -224,6 +227,9 @@ public abstract class AbstractTaskEditorPage extends TaskFormPage implements ISe
newTask, taskData));
migrator.execute(newTask);
}
+ if (expandLastComment) {
+ expandLastComment();
+ }
}
handleTaskSubmitted(new SubmitJobEvent(job));
} finally {
@@ -979,10 +985,16 @@ public abstract class AbstractTaskEditorPage extends TaskFormPage implements ISe
doSave(new NullProgressMonitor());
+ TaskAttribute newCommentAttribute = getModel().getTaskData()
+ .getRoot()
+ .getMappedAttribute(TaskAttribute.COMMENT_NEW);
+ boolean expandLastComment = newCommentAttribute != null
+ && getModel().getChangedAttributes().contains(newCommentAttribute);
+
SubmitJob submitJob = TasksUiInternal.getJobFactory().createSubmitTaskJob(connector,
getModel().getTaskRepository(), task, getModel().getTaskData(),
getModel().getChangedOldAttributes());
- submitJob.addSubmitJobListener(new SubmitTaskJobListener(getAttachContext()));
+ submitJob.addSubmitJobListener(new SubmitTaskJobListener(getAttachContext(), expandLastComment));
submitJob.schedule();
} catch (RuntimeException e) {
showEditorBusy(false);
@@ -1770,4 +1782,21 @@ public abstract class AbstractTaskEditorPage extends TaskFormPage implements ISe
return super.selectReveal(object);
}
+ void expandLastComment() {
+ if (getManagedForm() == null || getManagedForm().getForm().isDisposed()) {
+ // editor possibly closed or page has not been initialized
+ return;
+ }
+
+ if (taskData == null) {
+ return;
+ }
+
+ List<TaskAttribute> commentAttributes = taskData.getAttributeMapper().getAttributesByType(taskData,
+ TaskAttribute.TYPE_COMMENT);
+ if (commentAttributes.size() > 0) {
+ selectReveal(commentAttributes.get(commentAttributes.size() - 1).getId());
+ }
+ }
+
}

Back to the top