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 112836 Details for
Bug 247745
make CommentGroupStrategy testable
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]
a patch that make CommentGroupStrategy testable
clipboard.txt (text/plain), 6.33 KB, created by
Jingwen 'Owen' Ou
on 2008-09-17 17:58:54 EDT
(
hide
)
Description:
a patch that make CommentGroupStrategy testable
Filename:
MIME Type:
Creator:
Jingwen 'Owen' Ou
Created:
2008-09-17 17:58:54 EDT
Size:
6.33 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.sandbox.ui >Index: src/org/eclipse/mylyn/internal/sandbox/ui/editors/ExtensibleTaskEditorCommentPart.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.sandbox.ui/src/org/eclipse/mylyn/internal/sandbox/ui/editors/ExtensibleTaskEditorCommentPart.java,v >retrieving revision 1.2 >diff -u -r1.2 ExtensibleTaskEditorCommentPart.java >--- src/org/eclipse/mylyn/internal/sandbox/ui/editors/ExtensibleTaskEditorCommentPart.java 12 Sep 2008 04:20:03 -0000 1.2 >+++ src/org/eclipse/mylyn/internal/sandbox/ui/editors/ExtensibleTaskEditorCommentPart.java 17 Sep 2008 21:58:10 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >-* Copyright (c) 2004, 2008 Tasktop Technologies and others. >+ * Copyright (c) 2004, 2008 Tasktop Technologies and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -63,7 +63,8 @@ > > private void createCommentSubsections(final FormToolkit toolkit, final Composite composite, > List<TaskAttribute> comments) { >- List<CommentGroup> commentGroups = getCommentGroupStrategy().groupCommentsFromModel(getModel()); >+ List<CommentGroup> commentGroups = getCommentGroupStrategy().groupComments(comments, >+ getModel().getTaskRepository(), getModel().getTask(), getModel()); > > // if there is only one subsection, then don't show it > if (commentGroups.size() == 1) { >@@ -162,11 +163,13 @@ > EditorUtil.toggleExpandableComposite(true, section); > } > >- for (Section subSection : subSections) { >- if (subSection.isDisposed()) { >- continue; >+ if (subSections != null) { >+ for (Section subSection : subSections) { >+ if (subSection.isDisposed()) { >+ continue; >+ } >+ EditorUtil.toggleExpandableComposite(true, subSection); > } >- EditorUtil.toggleExpandableComposite(true, subSection); > } > } finally { > getTaskEditorPage().setReflow(true); >Index: src/org/eclipse/mylyn/internal/sandbox/ui/editors/CommentGroupStrategy.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.sandbox.ui/src/org/eclipse/mylyn/internal/sandbox/ui/editors/CommentGroupStrategy.java,v >retrieving revision 1.4 >diff -u -r1.4 CommentGroupStrategy.java >--- src/org/eclipse/mylyn/internal/sandbox/ui/editors/CommentGroupStrategy.java 13 Sep 2008 03:38:54 -0000 1.4 >+++ src/org/eclipse/mylyn/internal/sandbox/ui/editors/CommentGroupStrategy.java 17 Sep 2008 21:58:10 -0000 >@@ -16,6 +16,8 @@ > > import org.eclipse.mylyn.internal.tasks.core.TaskComment; > import org.eclipse.mylyn.tasks.core.IRepositoryPerson; >+import org.eclipse.mylyn.tasks.core.ITask; >+import org.eclipse.mylyn.tasks.core.TaskRepository; > import org.eclipse.mylyn.tasks.core.data.TaskAttribute; > import org.eclipse.mylyn.tasks.core.data.TaskDataModel; > >@@ -24,17 +26,17 @@ > */ > public class CommentGroupStrategy { > public class CommentGroup { >- private final List<TaskAttribute> commentAttributes; >+ private final List<TaskAttribute> comments; > > private final String groupName; > >- CommentGroup(String groupName, List<TaskAttribute> commentAttributes) { >+ CommentGroup(String groupName, List<TaskAttribute> comments) { > this.groupName = groupName; >- this.commentAttributes = commentAttributes; >+ this.comments = comments; > } > > public List<TaskAttribute> getCommentAttributes() { >- return commentAttributes; >+ return comments; > } > > public String getGroupName() { >@@ -42,10 +44,9 @@ > } > } > >- private TaskComment convertToTaskComment(TaskDataModel taskDataModel, TaskAttribute commentAttribute) { >- TaskComment taskComment = new TaskComment(taskDataModel.getTaskRepository(), taskDataModel.getTask(), >- commentAttribute); >- taskDataModel.getTaskData().getAttributeMapper().updateTaskComment(taskComment, commentAttribute); >+ private TaskComment convertToTaskComment(TaskRepository taskRepository, ITask task, TaskAttribute commentAttribute) { >+ TaskComment taskComment = new TaskComment(taskRepository, task, commentAttribute); >+ commentAttribute.getTaskData().getAttributeMapper().updateTaskComment(taskComment, commentAttribute); > > return taskComment; > } >@@ -57,26 +58,23 @@ > * extracts groups of comment for the model > * @return list of comment groups. Groups will be ignored if there are no comments under them. > */ >- public List<CommentGroup> groupCommentsFromModel(TaskDataModel taskDataModel) { >- List<TaskAttribute> taskAttributes = taskDataModel.getTaskData().getAttributeMapper().getAttributesByType( >- taskDataModel.getTaskData(), TaskAttribute.TYPE_COMMENT); >+ public List<CommentGroup> groupComments(List<TaskAttribute> comments, TaskRepository taskRepository, ITask task, >+ TaskDataModel taskDataModel) { > List<CommentGroup> commentGroups = new ArrayList<CommentGroup>(); >- List<TaskAttribute> comments = new ArrayList<TaskAttribute>(); > > int currentFromIndex = -1; >- String currentPersonId = taskDataModel.getTaskRepository().getUserName(); >+ String currentPersonId = taskRepository.getUserName(); > > // current > List<TaskAttribute> current = new ArrayList<TaskAttribute>(); > > // update task comment and get current group index >- for (int i = 0; i < taskAttributes.size(); i++) { >- TaskAttribute commentAttribute = taskAttributes.get(i); >- final TaskComment taskComment = convertToTaskComment(taskDataModel, commentAttribute); >- comments.add(commentAttribute); >+ for (int i = 0; i < comments.size(); i++) { >+ TaskAttribute commentAttribute = comments.get(i); >+ final TaskComment taskComment = convertToTaskComment(taskRepository, task, commentAttribute); > > // add all incoming changes >- if (taskDataModel.hasIncomingChanges(taskComment.getTaskAttribute())) { >+ if (hasIncomingChanges(taskDataModel, commentAttribute)) { > current.add(commentAttribute); > } > >@@ -122,4 +120,8 @@ > > return commentGroups; > } >+ >+ protected boolean hasIncomingChanges(TaskDataModel taskDataModel, TaskAttribute commentAttribute) { >+ return taskDataModel.hasIncomingChanges(commentAttribute); >+ } > }
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 247745
: 112836 |
112837
|
113070
|
113071