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 134916 Details for
Bug 212967
sorting of query nodes and archive categories in the task list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
next iteration
clipboard.txt (text/plain), 14.43 KB, created by
Steffen Pingel
on 2009-05-08 00:43:23 EDT
(
hide
)
Description:
next iteration
Filename:
MIME Type:
Creator:
Steffen Pingel
Created:
2009-05-08 00:43:23 EDT
Size:
14.43 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.tasks.ui >Index: src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskListSortDialog.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskListSortDialog.java,v >retrieving revision 1.7 >diff -u -r1.7 TaskListSortDialog.java >--- src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskListSortDialog.java 26 Feb 2009 08:42:14 -0000 1.7 >+++ src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskListSortDialog.java 8 May 2009 04:44:16 -0000 >@@ -13,9 +13,14 @@ > > import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.jface.window.IShellProvider; >+import org.eclipse.mylyn.internal.tasks.ui.views.TaskListSorter; > import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView; >+import org.eclipse.mylyn.internal.tasks.ui.views.TaskListSorter.GroupBy; > import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.SelectionAdapter; >+import org.eclipse.swt.events.SelectionEvent; > import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.widgets.Combo; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Label; > >@@ -24,19 +29,54 @@ > */ > public class TaskListSortDialog extends TaskCompareDialog { > >+ private Combo modeCombo; >+ >+ private final TaskListView taskListView; >+ > public TaskListSortDialog(IShellProvider parentShell, TaskListView taskListView) { > super(parentShell, taskListView.getSorter().getComparator()); >+ this.taskListView = taskListView; > setTitle(Messages.TaskListSortDialog_Title); > } > > @Override > protected void createDialogStartArea(Composite parent) { >+ Label numberLabel = new Label(parent, SWT.NULL); >+ numberLabel.setText(Messages.TaskListSortDialog_Grouped_by); >+ modeCombo = new Combo(parent, SWT.READ_ONLY); >+ modeCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ GridData data = new GridData(); >+ data.horizontalSpan = 2; >+ modeCombo.setLayoutData(data); >+ GroupBy[] values = TaskListSorter.GroupBy.values(); >+ for (GroupBy groupBy : values) { >+ modeCombo.add(groupBy.getLabel()); >+ } >+ modeCombo.addSelectionListener(new SelectionAdapter() { >+ @Override >+ public void widgetSelected(SelectionEvent e) { >+ markDirty(); >+ } >+ }); >+ modeCombo.select(taskListView.getSorter().getGroupBy().ordinal()); >+ > Label sortByLabel = new Label(parent, SWT.NULL); > sortByLabel.setText(Messages.TaskListSortDialog_Sort_order); >- GridData data = new GridData(); >+ data = new GridData(); > data.horizontalSpan = 3; > sortByLabel.setLayoutData(data); > Dialog.applyDialogFont(parent); > } > >+ @Override >+ protected void okPressed() { >+ if (isDirty()) { >+ int selectionIndex = modeCombo.getSelectionIndex(); >+ if (selectionIndex != -1) { >+ taskListView.getSorter().setGroupBy(TaskListSorter.GroupBy.values()[selectionIndex]); >+ } >+ } >+ super.okPressed(); >+ } >+ > } >Index: src/org/eclipse/mylyn/internal/tasks/ui/dialogs/Messages.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/Messages.java,v >retrieving revision 1.3 >diff -u -r1.3 Messages.java >--- src/org/eclipse/mylyn/internal/tasks/ui/dialogs/Messages.java 26 Feb 2009 08:42:14 -0000 1.3 >+++ src/org/eclipse/mylyn/internal/tasks/ui/dialogs/Messages.java 8 May 2009 04:44:16 -0000 >@@ -41,6 +41,8 @@ > > public static String TaskCompareDialog_TaskID; > >+ public static String TaskListSortDialog_Grouped_by; >+ > public static String TaskListSortDialog_Sort_order; > > public static String TaskListSortDialog_Title; >Index: src/org/eclipse/mylyn/internal/tasks/ui/dialogs/messages.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/messages.properties,v >retrieving revision 1.3 >diff -u -r1.3 messages.properties >--- src/org/eclipse/mylyn/internal/tasks/ui/dialogs/messages.properties 26 Feb 2009 08:42:14 -0000 1.3 >+++ src/org/eclipse/mylyn/internal/tasks/ui/dialogs/messages.properties 8 May 2009 04:44:16 -0000 >@@ -6,6 +6,7 @@ > TaskCompareDialog_SortOrder=Sort order: > TaskCompareDialog_Summary=Summary > TaskCompareDialog_TaskID=Task ID >+TaskListSortDialog_Grouped_by=Grouped by: > TaskListSortDialog_Sort_order=Sort order for tasks\: > TaskListSortDialog_Title=Task List Sorting > >Index: src/org/eclipse/mylyn/internal/tasks/ui/views/Messages.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/Messages.java,v >retrieving revision 1.4 >diff -u -r1.4 Messages.java >--- src/org/eclipse/mylyn/internal/tasks/ui/views/Messages.java 28 Jan 2009 02:48:57 -0000 1.4 >+++ src/org/eclipse/mylyn/internal/tasks/ui/views/Messages.java 8 May 2009 04:44:16 -0000 >@@ -59,6 +59,12 @@ > > public static String TaskListFilteredTree_Workweek_Progress; > >+ public static String TaskListSorter_Catagory_and_Query; >+ >+ public static String TaskListSorter_Catagory_and_Repository; >+ >+ public static String TaskListSorter_No_Grouping; >+ > public static String TaskListToolTip_Automatic_container_for_all_local_tasks; > > public static String TaskListToolTip_Automatic_container_for_repository_tasks; >Index: src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListSorter.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListSorter.java,v >retrieving revision 1.1 >diff -u -r1.1 TaskListSorter.java >--- src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListSorter.java 18 Jan 2009 08:53:02 -0000 1.1 >+++ src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListSorter.java 8 May 2009 04:44:16 -0000 >@@ -11,10 +11,14 @@ > > package org.eclipse.mylyn.internal.tasks.ui.views; > >+import java.text.Collator; >+ >+import org.eclipse.core.runtime.Assert; > import org.eclipse.jface.viewers.Viewer; > import org.eclipse.jface.viewers.ViewerSorter; > import org.eclipse.mylyn.internal.tasks.core.AbstractTask; > import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer; >+import org.eclipse.mylyn.internal.tasks.core.ITaskRepositoryElement; > import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery; > import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer; > import org.eclipse.mylyn.internal.tasks.core.TaskCategory; >@@ -24,21 +28,67 @@ > import org.eclipse.mylyn.internal.tasks.core.UnsubmittedTaskContainer; > import org.eclipse.mylyn.internal.tasks.ui.util.TaskComparator; > import org.eclipse.mylyn.tasks.core.ITask; >+import org.eclipse.mylyn.tasks.core.TaskRepository; >+import org.eclipse.mylyn.tasks.ui.TasksUi; > > /** > * @author Mik Kersten > */ > public class TaskListSorter extends ViewerSorter { > >+ public enum GroupBy { >+ NONE, CATEGORY_QUERY, CATEGORY_REPOSITORY; >+ >+ public String getLabel() { >+ switch (this) { >+ case NONE: >+ return Messages.TaskListSorter_No_Grouping; >+ case CATEGORY_QUERY: >+ return Messages.TaskListSorter_Catagory_and_Query; >+ case CATEGORY_REPOSITORY: >+ return Messages.TaskListSorter_Catagory_and_Repository; >+ default: >+ return null; >+ } >+ } >+ >+ public static GroupBy valueOfLabel(String label) { >+ for (GroupBy value : values()) { >+ if (value.getLabel().equals(label)) { >+ return value; >+ } >+ } >+ return null; >+ } >+ >+ } >+ >+ private class SortKey { >+ >+ private int weight; >+ >+ private final String[] values = new String[3]; >+ >+ } >+ > public static final int DEFAULT_SORT_DIRECTION = 1; > > private int sortDirectionRootElement; > > private final TaskComparator taskComparator; > >+ private GroupBy groupBy; >+ >+ private final SortKey key1; >+ >+ private final SortKey key2; >+ > public TaskListSorter() { > this.sortDirectionRootElement = DEFAULT_SORT_DIRECTION; > this.taskComparator = new TaskComparator(); >+ this.groupBy = GroupBy.NONE; >+ this.key1 = new SortKey(); >+ this.key2 = new SortKey(); > } > > /** >@@ -57,54 +107,93 @@ > ScheduledTaskContainer dateRangeTaskContainer2 = (ScheduledTaskContainer) o2; > return dateRangeTaskContainer1.getDateRange().compareTo(dateRangeTaskContainer2.getDateRange()); > } else { >- int o1Type; >- if (o1 instanceof AbstractTask) { >- o1Type = 0; >- } else if (o1 instanceof UncategorizedTaskContainer) { >- o1Type = 1; >- } else if (o1 instanceof UnsubmittedTaskContainer) { >- o1Type = 2; >- } else if (o1 instanceof TaskCategory) { >- o1Type = 3; >- } else if (o1 instanceof RepositoryQuery) { >- o1Type = 4; >- } else if (o1 instanceof TaskGroup) { // support for the experimental grouping of tasks >- o1Type = 5; >- } else if (o1 instanceof UnmatchedTaskContainer) { >- o1Type = 6; >- } else { >- o1Type = 99; >- } >- int o2Type; >- if (o2 instanceof AbstractTask) { >- o2Type = 0; >- } else if (o2 instanceof UncategorizedTaskContainer) { >- o2Type = 1; >- } else if (o2 instanceof UnsubmittedTaskContainer) { >- o2Type = 2; >- } else if (o2 instanceof TaskCategory) { >- o2Type = 3; >- } else if (o2 instanceof RepositoryQuery) { >- o2Type = 4; >- } else if (o2 instanceof TaskGroup) { // support for the experimental grouping of tasks >- o2Type = 5; >- } else if (o2 instanceof UnmatchedTaskContainer) { >- o2Type = 6; >- } else { >- o2Type = 99; >+ updateKey(key1, o1); >+ updateKey(key2, o2); >+ >+ if (key1.weight != key2.weight) { >+ return key1.weight - key2.weight < 0 ? -1 : 1; > } >- if (o1Type != o2Type) { >- return o1Type - o2Type < 0 ? -1 : 1; >+ int result = compare(key1.values[0], key2.values[0]); >+ if (result != 0) { >+ return result; > } >- if (o1Type < 7) { >- AbstractTaskContainer taskContainer1 = (AbstractTaskContainer) o1; >- AbstractTaskContainer taskContainer2 = (AbstractTaskContainer) o2; >+ result = compare(key1.values[1], key2.values[1]); >+ return (result != 0) ? result : compare(key1.values[2], key2.values[2]); >+ } >+ } >+ >+ private int compare(String key1, String key2) { >+ if (key1 == null) { >+ return (key2 != null) ? sortDirectionRootElement : 0; >+ } else if (key2 == null) { >+ return -sortDirectionRootElement; >+ } >+ return sortDirectionRootElement * Collator.getInstance().compare(key1, key2); >+ } >+ >+ private void updateKey(SortKey key, Object object) { >+ int weight; >+ if (object instanceof AbstractTask) { >+ weight = 0; >+ } else if (object instanceof UncategorizedTaskContainer) { >+ weight = 1; >+ } else if (object instanceof UnsubmittedTaskContainer) { >+ weight = 2; >+ } else if (object instanceof TaskCategory) { >+ weight = 3; >+ } else if (object instanceof RepositoryQuery) { >+ weight = 4; >+ } else if (object instanceof TaskGroup) { // support for the experimental grouping of tasks >+ weight = 5; >+ } else if (object instanceof UnmatchedTaskContainer) { >+ weight = 6; >+ } else { >+ weight = 99; >+ } > >- return this.sortDirectionRootElement >- * taskContainer1.getSummary().compareToIgnoreCase(taskContainer2.getSummary()); >+ key.values[0] = ((AbstractTaskContainer) object).getSummary(); >+ key.values[1] = null; >+ key.values[2] = null; >+ >+ switch (groupBy) { >+ case NONE: >+ weight = 1; >+ break; >+ case CATEGORY_QUERY: >+ break; >+ case CATEGORY_REPOSITORY: >+ if (weight == 1) { >+ // keep >+ } else if (weight == 3) { >+ weight = 2; >+ } else { >+ key.values[0] = getRepositoryUrl(object); >+ key.values[1] = weight + ""; //$NON-NLS-1$ >+ key.values[2] = ((AbstractTaskContainer) object).getSummary(); >+ weight = 3; > } >+ break; >+ } >+ >+ key.weight = weight; >+ } >+ >+ private String getRepositoryUrl(Object object) { >+ if (object instanceof ITaskRepositoryElement) { >+ ITaskRepositoryElement repositoryElement = (ITaskRepositoryElement) object; >+ String repositoryUrl = repositoryElement.getRepositoryUrl(); >+ TaskRepository taskRepository = TasksUi.getRepositoryManager().getRepository( >+ repositoryElement.getConnectorKind(), repositoryUrl); >+ return taskRepository != null ? taskRepository.getRepositoryLabel() : null; > } >- return 0; >+// if (object instanceof UnsubmittedTaskContainer) { >+// return ((UnsubmittedTaskContainer) object).getRepositoryUrl(); >+// } else if (object instanceof RepositoryQuery) { >+// return ((RepositoryQuery) object).getRepositoryUrl(); >+// } else if (object instanceof UnmatchedTaskContainer) { >+// return ((UnmatchedTaskContainer) object).getRepositoryUrl(); >+// } >+ return null; > } > > private int compareElements(ITask element1, ITask element2) { >@@ -124,4 +213,13 @@ > this.sortDirectionRootElement = sortDirection; > } > >+ public GroupBy getGroupBy() { >+ return groupBy; >+ } >+ >+ public void setGroupBy(GroupBy sortByIndex) { >+ Assert.isNotNull(sortByIndex); >+ this.groupBy = sortByIndex; >+ } >+ > } >Index: src/org/eclipse/mylyn/internal/tasks/ui/views/messages.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/messages.properties,v >retrieving revision 1.4 >diff -u -r1.4 messages.properties >--- src/org/eclipse/mylyn/internal/tasks/ui/views/messages.properties 28 Jan 2009 02:48:57 -0000 1.4 >+++ src/org/eclipse/mylyn/internal/tasks/ui/views/messages.properties 8 May 2009 04:44:16 -0000 >@@ -19,6 +19,9 @@ > TaskListFilteredTree_Select_Active_Task=Select Active Task > TaskListFilteredTree_Select_Working_Set=Select Working Set > TaskListFilteredTree_Workweek_Progress=Workweek Progress >+TaskListSorter_Catagory_and_Query=Category and Query >+TaskListSorter_Catagory_and_Repository=Category and Repository >+TaskListSorter_No_Grouping=no Grouping > > TaskListToolTip_Automatic_container_for_all_local_tasks=Automatic container for all local tasks\nwith no category set > TaskListToolTip_Automatic_container_for_repository_tasks=Automatic container for repository tasks\nnot matched by any query >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/plugin.properties,v >retrieving revision 1.6 >diff -u -r1.6 plugin.properties >--- plugin.properties 11 Mar 2009 15:40:53 -0000 1.6 >+++ plugin.properties 8 May 2009 04:44:16 -0000 >@@ -11,6 +11,8 @@ > LocalRepositoryConnectorUi.name = Local Repository Ui > > CategorizedPresentation.name = Categorized >+CategorizedQueryPresentation.name = Categorized by Query >+CategorizedRepositoryPresentation.name = Categorized by Repository > ScheduledPresentation.name = Scheduled > > views.category.name = Tasks
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 212967
:
127099
|
127100
|
129524
|
129525
|
134695
|
134696
|
134832
|
134833
| 134916 |
135034
|
135035
|
136130
|
136131
|
136261
|
136585
|
136586
|
136747