Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLily Guo2013-08-21 13:14:19 -0400
committerSam Davis2013-11-20 15:00:11 -0500
commitba01ab47c34962256b71317b103b03c12b1fca5f (patch)
tree552327c826fea44cbf2eec46f8964bab34f92124
parentdd225d1b77e88408f7365ca633b4ee678a7b60c4 (diff)
downloadorg.eclipse.mylyn.tasks-ba01ab47c34962256b71317b103b03c12b1fca5f.tar.gz
org.eclipse.mylyn.tasks-ba01ab47c34962256b71317b103b03c12b1fca5f.tar.xz
org.eclipse.mylyn.tasks-ba01ab47c34962256b71317b103b03c12b1fca5f.zip
134165: improve TaskEditorCommentPart to support find functionality
provide find functionality for task editor Change-Id: Ide9076eb1965a0414cbe5ba94a5e6a3173174c9d Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=134165 Signed-off-by: Lily Guo <lily2guo@gmail.com>
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java72
1 files changed, 60 insertions, 12 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 f25ec5228..176e2f13b 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
@@ -29,7 +29,9 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.commons.ui.FillWidthLayout;
import org.eclipse.mylyn.commons.ui.SelectionProviderAdapter;
+import org.eclipse.mylyn.commons.ui.compatibility.CommonColors;
import org.eclipse.mylyn.commons.workbench.forms.CommonFormUtil;
+import org.eclipse.mylyn.commons.workbench.forms.ScalingHyperlink;
import org.eclipse.mylyn.internal.tasks.core.TaskComment;
import org.eclipse.mylyn.internal.tasks.ui.actions.CommentActionGroup;
import org.eclipse.mylyn.internal.tasks.ui.editors.CommentGroupStrategy.CommentGroup;
@@ -73,7 +75,7 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
private static final String ID_POPUP_MENU = "org.eclipse.mylyn.tasks.ui.editor.menu.comments"; //$NON-NLS-1$
- private class CommentGroupViewer {
+ public class CommentGroupViewer {
private final CommentGroup commentGroup;
@@ -129,7 +131,8 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
}
private Section createSection(final Composite parent, final FormToolkit toolkit) {
- int style = ExpandableComposite.TWISTIE | ExpandableComposite.SHORT_TITLE_BAR;
+ int style = ExpandableComposite.TWISTIE | ExpandableComposite.SHORT_TITLE_BAR
+ | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT;
// if (/*commentGroup.hasIncoming() || */expandAllInProgress) {
// style |= ExpandableComposite.EXPANDED;
// }
@@ -168,7 +171,7 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
} finally {
getTaskEditorPage().setReflow(true);
}
- getTaskEditorPage().reflow();
+ reflow();
}
}
});
@@ -252,6 +255,24 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
this.renderedInSubSection = renderedInSubSection;
}
+ public void createSectionHyperlink(String message, HyperlinkAdapter listener) {
+ if (groupSection != null) {
+ ScalingHyperlink resultLink = new ScalingHyperlink(groupSection, SWT.READ_ONLY);
+ resultLink.setForeground(CommonColors.HYPERLINK_WIDGET);
+ resultLink.setUnderlined(true);
+ resultLink.setText(message);
+ groupSection.setTextClient(resultLink);
+ resultLink.getParent().layout(true, true);
+ resultLink.addHyperlinkListener(listener);
+ }
+ }
+
+ public void clearSectionHyperlink() {
+ if (groupSection != null) {
+ groupSection.setTextClient(null);
+ }
+ }
+
// private void createToolBar(final FormToolkit toolkit) {
// if (section == null) {
// return;
@@ -294,7 +315,7 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
}
- protected class CommentViewer {
+ public class CommentViewer {
private Composite buttonComposite;
@@ -306,6 +327,8 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
private AbstractAttributeEditor editor;
+ private boolean suppressSelectionChanged;
+
public CommentViewer(TaskAttribute commentAttribute) {
this.commentAttribute = commentAttribute;
this.taskComment = new TaskComment(getModel().getTaskRepository(), getModel().getTask(), commentAttribute);
@@ -447,7 +470,7 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
composite.setData(KEY_EDITOR, editor);
getTaskEditorPage().getAttributeEditorToolkit().adapt(editor);
- getTaskEditorPage().reflow();
+ reflow();
}
} else if (!expanded && composite.getData(KEY_EDITOR) != null) {
// dispose viewer
@@ -455,9 +478,11 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
editor.getControl().setMenu(null);
editor.getControl().dispose();
composite.setData(KEY_EDITOR, null);
- getTaskEditorPage().reflow();
+ reflow();
+ }
+ if (!suppressSelectionChanged) {
+ getTaskEditorPage().selectionChanged(taskComment);
}
- getTaskEditorPage().selectionChanged(taskComment);
}
public boolean isExpanded() {
@@ -491,6 +516,10 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
return commentComposite;
}
+ public void suppressSelectionChanged(boolean value) {
+ this.suppressSelectionChanged = value;
+ }
+
}
private class ReplyToCommentAction extends AbstractReplyToCommentAction implements IMenuCreator {
@@ -542,6 +571,12 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
private boolean hasIncoming;
+ /**
+ * We can't use the reflow flag in AbstractTaskEditorPage because it gets set at various points where we
+ * might not want to reflow.
+ */
+ private boolean reflow = true;
+
protected Section section;
private SelectionProviderAdapter selectionProvider;
@@ -599,7 +634,7 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
} finally {
getTaskEditorPage().setReflow(true);
}
- getTaskEditorPage().reflow();
+ reflow();
}
private TaskComment convertToTaskComment(TaskDataModel taskDataModel, TaskAttribute commentAttribute) {
@@ -673,7 +708,7 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
expandAllInProgress = false;
getTaskEditorPage().setReflow(true);
}
- getTaskEditorPage().reflow();
+ reflow();
}
}
});
@@ -690,7 +725,7 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
}
}
- private void expandAllComments(boolean expandViewers) {
+ public void expandAllComments(boolean expandViewers) {
try {
expandAllInProgress = true;
suppressExpandViewers = !expandViewers;
@@ -717,7 +752,7 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
suppressExpandViewers = false;
getTaskEditorPage().setReflow(true);
}
- getTaskEditorPage().reflow();
+ reflow();
}
private void expandSection(final FormToolkit toolkit, final Section section) {
@@ -773,7 +808,7 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
this.commentGroupStrategy = commentGroupStrategy;
}
- private List<CommentGroupViewer> getCommentGroupViewers() {
+ public List<CommentGroupViewer> getCommentGroupViewers() {
if (commentGroupViewers != null) {
return commentGroupViewers;
}
@@ -847,4 +882,17 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
return null;
}
+ public boolean isCommentSectionExpanded() {
+ return section != null && section.isExpanded();
+ }
+
+ public void reflow() {
+ if (reflow) {
+ getTaskEditorPage().reflow();
+ }
+ }
+
+ public void setReflow(boolean reflow) {
+ this.reflow = reflow;
+ }
}

Back to the top