Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 117503 Details for
Bug 248057
consider removing Current subsection
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch v3 to change + behavior
patch.txt (text/plain), 7.90 KB, created by
David Shepherd
on 2008-11-10 19:52:33 EST
(
hide
)
Description:
Patch v3 to change + behavior
Filename:
MIME Type:
Creator:
David Shepherd
Created:
2008-11-10 19:52:33 EST
Size:
7.90 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.tasks.ui >Index: src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java,v >retrieving revision 1.43 >diff -u -r1.43 TaskEditorCommentPart.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java 7 Nov 2008 06:23:26 -0000 1.43 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java 11 Nov 2008 00:50:22 -0000 >@@ -13,7 +13,9 @@ > package org.eclipse.mylyn.internal.tasks.ui.editors; > > import java.util.ArrayList; >+import java.util.HashMap; > import java.util.List; >+import java.util.Map; > > import org.eclipse.jface.action.Action; > import org.eclipse.jface.action.ToolBarManager; >@@ -73,6 +75,8 @@ > > private boolean expandAllInProgress; > >+ private final Map<Section, CommentGroup> subToCommentGroup = new HashMap<Section, CommentGroup>(); >+ > public TaskEditorCommentPart() { > setPartName("Comments"); > } >@@ -153,6 +157,7 @@ > }); > } > } >+ > setSection(toolkit, section); > } > >@@ -179,6 +184,7 @@ > // last group is not rendered as subsection > CommentGroup lastGroup = commentGroups.get(commentGroups.size() - 1); > addComments(toolkit, composite, lastGroup.getCommentAttributes()); >+ > } > } > >@@ -376,32 +382,43 @@ > expandAllInProgress = true; > getTaskEditorPage().setReflow(false); > >+ boolean sectionExpanded = false; >+ if (section != null && section.isExpanded()) { >+ sectionExpanded = true; >+ } >+ >+ // first expand the whole comments section > if (section != null) { > EditorUtil.toggleExpandableComposite(true, section); > } > > if (subSections != null) { >- // first toggle on all subSections >- if (section != null) { >- EditorUtil.toggleExpandableComposite(true, section); >- } >+ int numberOfSectionsExpanded = getHighestExpandedSection(sectionExpanded); > >+ //add to the number of expanded sections by 1, from the bottom up >+ int count = subSections.size(); > for (Section subSection : subSections) { > if (subSection.isDisposed()) { >+ count--; > continue; > } >- EditorUtil.toggleExpandableComposite(true, subSection); >+ if (count - numberOfSectionsExpanded < 1) { >+ changeExpansionStateOfSection(subSections.size() - count, true); >+ } else { >+ //this is a special case: >+ //when the task is first opened in the task editor >+ //if the whole section was not expanded then all subsections are in the expanded state >+ if (sectionExpanded == false) { >+ changeExpansionStateOfSection(subSections.size() - count, false); >+ } >+ } >+ count--; > } > } > >- for (ExpandableComposite composite : commentComposites) { >- if (composite.isDisposed()) { >- continue; >- } >- if (!composite.isExpanded()) { >- EditorUtil.toggleExpandableComposite(true, composite); >- } >- } >+ //expand all current comments, which is not usually a comment group >+ changeExpansionStateOfSection(subSections.size(), true); >+ > } finally { > expandAllInProgress = false; > getTaskEditorPage().setReflow(true); >@@ -409,16 +426,141 @@ > getTaskEditorPage().reflow(); > } > >-// private static void toggleChildren(Composite composite, boolean expended) { >-// for (Control child : composite.getChildren()) { >-// if (child instanceof ExpandableComposite && !child.isDisposed()) { >-// EditorUtil.toggleExpandableComposite(expended, (ExpandableComposite) child); >-// } >-// if (child instanceof Composite) { >-// toggleChildren((Composite) child, expended); >-// } >-// } >-// } >+ /** >+ * >+ * @param sectionNumber >+ * - the number of the section to expand, counting from top to bottom, starting at 0 >+ * @param expansionState >+ * - the expansion state >+ */ >+ private void changeExpansionStateOfSection(int sectionNumber, boolean expansionState) { >+ if (subSections == null) { >+ return; >+ } >+ int sectionCount = 0; >+ for (Section subSection : subSections) { >+ if (sectionCount == sectionNumber) { >+ EditorUtil.toggleExpandableComposite(expansionState, subSection); >+ } >+ sectionCount++; >+ } >+ Range range = getRange(sectionNumber); >+ int count = 0; >+ for (ExpandableComposite composite : commentComposites) { >+ if (composite.isDisposed()) { >+ continue; >+ } >+ if (count >= range.getOffset() && count < range.getEnd()) { >+ EditorUtil.toggleExpandableComposite(expansionState, composite); >+ } >+ count++; >+ } >+ >+ } >+ >+ private int getHighestExpandedSection(boolean parentSectionExpanded) { >+ if (!parentSectionExpanded) { >+ return 0; >+ } >+ int highestExpandedSection = 0; >+ if (subSections != null) { >+ int sectionNumber = 0; >+ for (Section subSection : subSections) { >+ if (subSection.isExpanded() && allCommentsExpanded(sectionNumber)) { >+ highestExpandedSection = Math.max(subSections.size() - sectionNumber, highestExpandedSection); >+ } >+ sectionNumber++; >+ } >+ >+ if (highestExpandedSection > 0) { >+ return highestExpandedSection + 1; >+ } else { >+ return allCommentsExpanded(subSections.size()) ? 1 : 0; >+ } >+ } >+ return highestExpandedSection; >+ } >+ >+ class Range { >+ int offset = 0; >+ >+ int end = 0; >+ >+ public Range() { >+ } >+ >+ public Range(int i, int j) { >+ offset = i; >+ end = j; >+ } >+ >+ public int getOffset() { >+ return offset; >+ } >+ >+ public void setStart(int offset) { >+ this.offset = offset; >+ } >+ >+ public int getEnd() { >+ return end; >+ } >+ >+ public void setEnd(int end) { >+ this.end = end; >+ } >+ >+ } >+ >+ /** >+ * >+ * @param sectionNumber >+ * - the section number, counting from top to bottom, starting at 0 >+ * @return >+ */ >+ private boolean allCommentsExpanded(int sectionNumber) { >+ >+ if (subSections != null) { >+ Range commentsInGroup = getRange(sectionNumber); >+ ExpandableComposite[] commentArray = commentComposites.toArray(new ExpandableComposite[commentComposites.size()]); >+ for (int i = commentsInGroup.getOffset(); i >= commentsInGroup.getOffset() && i < commentArray.length; i++) { >+ ExpandableComposite expandableComposite = commentArray[i]; >+ if (i >= commentsInGroup.getOffset() && i < commentsInGroup.getEnd()) { >+ if (!expandableComposite.isExpanded()) { >+ return false; >+ } >+ } >+ } >+ } >+ return true; >+ } >+ >+ private Range getRange(int sectionNumber) { >+ if (subSections == null) { >+ return new Range(0, 0); >+ } >+ int count = 0; >+ Range commentsInGroup = new Range(); >+ for (Section subSection : subSections) { >+ commentsInGroup.setStart(commentsInGroup.getEnd()); >+ CommentGroup commentGroup = subToCommentGroup.get(subSection); >+ if (commentGroup == null) { >+ break; >+ } else { >+ commentsInGroup.setEnd(commentsInGroup.getEnd() + commentGroup.getCommentAttributes().size()); >+ } >+ if (count >= sectionNumber) { >+ break; >+ } >+ count++; >+ } >+ //special case for the last section, as it is not broken into a subsection >+ if (sectionNumber == subSections.size()) { >+ commentsInGroup.setStart(commentsInGroup.getEnd()); >+ commentsInGroup.setEnd(commentComposites.size()); >+ } >+ return commentsInGroup; >+ } > > private TaskComment convertToTaskComment(TaskDataModel taskDataModel, TaskAttribute commentAttribute) { > TaskComment taskComment = new TaskComment(taskDataModel.getTaskRepository(), taskDataModel.getTask(), >@@ -517,6 +659,8 @@ > } > > subSections.add(groupSection); >+ //necessary for finding expansion state >+ subToCommentGroup.put(groupSection, commentGroup); > } > > private void expandSubSection(final FormToolkit toolkit, CommentGroup commentGroup, Section subSection) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 248057
:
115766
|
117227
|
117228
|
117345
|
117346
|
117359
|
117360
| 117503 |
117504
|
117956
|
118208