|
Link Here
|
| 250 |
} |
250 |
} |
| 251 |
} |
251 |
} |
| 252 |
|
252 |
|
|
|
253 |
/** |
| 254 |
* Expands this group and all starred comments in it. |
| 255 |
*/ |
| 256 |
public void setStarredExpanded(boolean expanded) { |
| 257 |
if (groupSection != null && groupSection.isExpanded() != expanded) { |
| 258 |
CommonFormUtil.setExpanded(groupSection, expanded); |
| 259 |
} |
| 260 |
|
| 261 |
if (commentViewers != null) { |
| 262 |
for (CommentViewer commentViewer : commentViewers) { |
| 263 |
if (commentViewer.isStarred()) { |
| 264 |
commentViewer.setExpanded(expanded); |
| 265 |
} |
| 266 |
} |
| 267 |
} |
| 268 |
} |
| 269 |
|
| 253 |
public void setRenderedInSubSection(boolean renderedInSubSection) { |
270 |
public void setRenderedInSubSection(boolean renderedInSubSection) { |
| 254 |
this.renderedInSubSection = renderedInSubSection; |
271 |
this.renderedInSubSection = renderedInSubSection; |
| 255 |
} |
272 |
} |
|
Link Here
|
| 298 |
|
315 |
|
| 299 |
protected class CommentViewer { |
316 |
protected class CommentViewer { |
| 300 |
|
317 |
|
|
|
318 |
protected static final String COMMENT_STARRED = "org.eclipse.mylyn.internal.tasks.ui.editors.comment.starred"; //$NON-NLS-1$ |
| 319 |
|
| 301 |
private Composite buttonComposite; |
320 |
private Composite buttonComposite; |
| 302 |
|
321 |
|
| 303 |
private final TaskAttribute commentAttribute; |
322 |
private final TaskAttribute commentAttribute; |
|
Link Here
|
| 364 |
titleComposite.setLayout(rowLayout); |
383 |
titleComposite.setLayout(rowLayout); |
| 365 |
titleComposite.setBackground(null); |
384 |
titleComposite.setBackground(null); |
| 366 |
|
385 |
|
|
|
386 |
final ImageHyperlink starButton = toolkit.createImageHyperlink(titleComposite, SWT.NONE); |
| 387 |
starButton.setToolTipText(Messages.TaskEditorCommentPart_Star_this_comment); |
| 388 |
starButton.setImage(isStarred() |
| 389 |
? CommonImages.getImage(CommonImages.CHECKBOX_SELECTED) |
| 390 |
: CommonImages.getImage(CommonImages.CHECKBOX_CLEARED)); |
| 391 |
starButton.addHyperlinkListener(new HyperlinkAdapter() { |
| 392 |
@Override |
| 393 |
public void linkActivated(HyperlinkEvent e) { |
| 394 |
boolean starred = !isStarred(); |
| 395 |
setStarred(starred); |
| 396 |
starButton.setImage(starred |
| 397 |
? CommonImages.getImage(CommonImages.CHECKBOX_SELECTED) |
| 398 |
: CommonImages.getImage(CommonImages.CHECKBOX_CLEARED)); |
| 399 |
} |
| 400 |
}); |
| 401 |
|
| 367 |
ImageHyperlink expandCommentHyperlink = createTitleHyperLink(toolkit, titleComposite, taskComment); |
402 |
ImageHyperlink expandCommentHyperlink = createTitleHyperLink(toolkit, titleComposite, taskComment); |
| 368 |
expandCommentHyperlink.addHyperlinkListener(new HyperlinkAdapter() { |
403 |
expandCommentHyperlink.addHyperlinkListener(new HyperlinkAdapter() { |
| 369 |
@Override |
404 |
@Override |
|
Link Here
|
| 513 |
return commentComposite; |
548 |
return commentComposite; |
| 514 |
} |
549 |
} |
| 515 |
|
550 |
|
|
|
551 |
public boolean isStarred() { |
| 552 |
String key = COMMENT_STARRED + taskComment.getNumber(); |
| 553 |
return Boolean.parseBoolean(getTaskEditorPage().getTask().getAttribute(key)); |
| 554 |
} |
| 555 |
|
| 556 |
public void setStarred(boolean starred) { |
| 557 |
getTaskEditorPage().getTask().setAttribute(COMMENT_STARRED + taskComment.getNumber(), |
| 558 |
Boolean.toString(starred)); |
| 559 |
} |
| 560 |
|
| 516 |
} |
561 |
} |
| 517 |
|
562 |
|
| 518 |
private class ReplyToCommentAction extends AbstractReplyToCommentAction implements IMenuCreator { |
563 |
private class ReplyToCommentAction extends AbstractReplyToCommentAction implements IMenuCreator { |
|
Link Here
|
| 546 |
selectionProvider.setSelection(new StructuredSelection(taskComment)); |
591 |
selectionProvider.setSelection(new StructuredSelection(taskComment)); |
| 547 |
return commentMenu; |
592 |
return commentMenu; |
| 548 |
} |
593 |
} |
| 549 |
|
|
|
| 550 |
} |
594 |
} |
| 551 |
|
595 |
|
| 552 |
/** Expandable composites are indented by 6 pixels by default. */ |
596 |
/** Expandable composites are indented by 6 pixels by default. */ |
|
Link Here
|
| 736 |
getTaskEditorPage().reflow(); |
780 |
getTaskEditorPage().reflow(); |
| 737 |
} |
781 |
} |
| 738 |
|
782 |
|
|
|
783 |
private void expandStarredComments(boolean expandViewers) { |
| 784 |
try { |
| 785 |
expandAllInProgress = true; |
| 786 |
suppressExpandViewers = !expandViewers; |
| 787 |
getTaskEditorPage().setReflow(false); |
| 788 |
|
| 789 |
if (section != null) { |
| 790 |
// the expandAllInProgress flag will ensure that comments in top-level groups have been |
| 791 |
// expanded, no need to expand groups explicitly |
| 792 |
//boolean expandGroups = section.getClient() != null; |
| 793 |
|
| 794 |
CommonFormUtil.setExpanded(section, true); |
| 795 |
|
| 796 |
if (expandViewers) { |
| 797 |
List<CommentGroupViewer> groupViewers = getCommentGroupViewers(); |
| 798 |
for (int i = groupViewers.size() - 1; i >= 0; i--) { |
| 799 |
if (!groupViewers.get(i).isFullyExpanded()) { |
| 800 |
groupViewers.get(i).setStarredExpanded(true); |
| 801 |
} |
| 802 |
} |
| 803 |
} |
| 804 |
} |
| 805 |
} finally { |
| 806 |
expandAllInProgress = false; |
| 807 |
suppressExpandViewers = false; |
| 808 |
getTaskEditorPage().setReflow(true); |
| 809 |
} |
| 810 |
getTaskEditorPage().reflow(); |
| 811 |
} |
| 812 |
|
| 739 |
private void expandSection(final FormToolkit toolkit, final Section section) { |
813 |
private void expandSection(final FormToolkit toolkit, final Section section) { |
| 740 |
Composite composite = toolkit.createComposite(section); |
814 |
Composite composite = toolkit.createComposite(section); |
| 741 |
section.setClient(composite); |
815 |
section.setClient(composite); |
|
Link Here
|
| 775 |
expandAllAction.setToolTipText(Messages.TaskEditorCommentPart_Expand_Comments); |
849 |
expandAllAction.setToolTipText(Messages.TaskEditorCommentPart_Expand_Comments); |
| 776 |
barManager.add(expandAllAction); |
850 |
barManager.add(expandAllAction); |
| 777 |
|
851 |
|
|
|
852 |
Action expandStarredAction = new Action("") { //$NON-NLS-1$ |
| 853 |
@Override |
| 854 |
public void run() { |
| 855 |
expandStarredComments(true); |
| 856 |
} |
| 857 |
}; |
| 858 |
expandStarredAction.setImageDescriptor(CommonImages.CHECKBOX_SELECTED); |
| 859 |
expandStarredAction.setToolTipText(Messages.TaskEditorCommentPart_Expand_Starred); |
| 860 |
barManager.add(expandStarredAction); |
| 861 |
|
| 778 |
if (commentAttributes.isEmpty()) { |
862 |
if (commentAttributes.isEmpty()) { |
| 779 |
collapseAllAction.setEnabled(false); |
863 |
collapseAllAction.setEnabled(false); |
| 780 |
expandAllAction.setEnabled(false); |
864 |
expandStarredAction.setEnabled(false); |
| 781 |
} |
865 |
} |
| 782 |
} |
866 |
} |
| 783 |
|
867 |
|