Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Becker2013-10-17 15:45:25 -0400
committerGerrit Code Review @ Eclipse.org2013-11-19 16:08:12 -0500
commitd8315e4403aa2717b1119346882cfa471c7af422 (patch)
treec61d678c67e2afbf113925394c8c7bfbadce572e
parent9e71c029057b76f1cb3bfe1f687eeaf6cf729d78 (diff)
downloadorg.eclipse.mylyn.tasks-d8315e4403aa2717b1119346882cfa471c7af422.tar.gz
org.eclipse.mylyn.tasks-d8315e4403aa2717b1119346882cfa471c7af422.tar.xz
org.eclipse.mylyn.tasks-d8315e4403aa2717b1119346882cfa471c7af422.zip
330695: add "Show only my tasks" Action to task list
Make tasks assigned to me more prominent in the task list Change-Id: I6ce561151392b269798819ddfa87b48190110cb1 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=330695
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/MyTasksFilter.java40
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/FilterMyTasksAction.java48
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction.java3
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/Messages.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/messages.properties1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java27
7 files changed, 120 insertions, 3 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java
index 6252240ef..ff8d183a1 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java
@@ -52,6 +52,8 @@ public interface ITasksUiPreferenceConstants {
public static final String FILTER_PRIORITY = "org.eclipse.mylyn.tasks.ui.filters.priority"; //$NON-NLS-1$
+ public static final String FILTER_MY_TASKS_MODE = "org.eclipse.mylyn.tasks.ui.filters.my.tasks"; //$NON-NLS-1$
+
public static final String GROUP_SUBTASKS = "org.eclipse.mylyn.tasks.ui.group.subtasks"; //$NON-NLS-1$
public static final String OVERLAYS_INCOMING_TIGHT = "org.eclipse.mylyn.tasks.ui.overlays.incoming.tight"; //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/MyTasksFilter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/MyTasksFilter.java
new file mode 100644
index 000000000..b8273a5c7
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/MyTasksFilter.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Frank Becker 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Frank Becker - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.tasks.ui;
+
+import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.ui.TasksUi;
+
+public class MyTasksFilter extends AbstractTaskListFilter {
+
+ public MyTasksFilter() {
+ // ignore
+ }
+
+ @Override
+ public boolean select(Object parent, Object element) {
+ if (element instanceof AbstractTask) {
+ AbstractTask task = (AbstractTask) element;
+ String owner = task.getOwner();
+ TaskRepository repository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(),
+ task.getRepositoryUrl());
+ if (repository != null && repository.getUserName() != null
+ && repository.getUserName().equalsIgnoreCase(owner)) {
+ return true;
+ }
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/FilterMyTasksAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/FilterMyTasksAction.java
new file mode 100644
index 000000000..6993d3fb8
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/FilterMyTasksAction.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.tasks.ui.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.mylyn.commons.ui.CommonImages;
+import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
+import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
+
+public class FilterMyTasksAction extends Action {
+ public static final String ID = "org.eclipse.mylyn.tasklist.actions.filter.myTasks"; //$NON-NLS-1$
+
+ private final TaskListView view;
+
+ public FilterMyTasksAction(TaskListView view) {
+ this.view = view;
+ setText(Messages.FilterMyTasksAction_My_Tasks);
+ setToolTipText(Messages.FilterMyTasksAction_My_Tasks);
+ setId(ID);
+ setImageDescriptor(CommonImages.FILTER_MY_TASKS);
+ setChecked(TasksUiPlugin.getDefault()
+ .getPreferenceStore()
+ .contains(ITasksUiPreferenceConstants.FILTER_MY_TASKS_MODE));
+ }
+
+ @Override
+ public void run() {
+ TasksUiPlugin.getDefault()
+ .getPreferenceStore()
+ .setValue(ITasksUiPreferenceConstants.FILTER_MY_TASKS_MODE, isChecked());
+ if (isChecked()) {
+ view.addFilter(view.getMyTasksFilter());
+ } else {
+ view.removeFilter(view.getMyTasksFilter());
+ }
+ this.view.refresh();
+ }
+}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction.java
index b796cc9b7..3c0209c6a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction.java
@@ -107,8 +107,7 @@ public class FocusTaskListAction implements IFilteredTreeListener, IViewActionDe
taskListView.getFilteredTree().setRedraw(false);
taskListView.setFocusedMode(true);
previousSorter = taskListView.getViewer().getSorter();
- previousFilters = new HashSet<AbstractTaskListFilter>(taskListView.getFilters());
- taskListView.clearFilters();
+ previousFilters = taskListView.clearFilters();
if (!taskListView.getFilters().contains(taskListInterestFilter)) {
taskListView.addFilter(taskListInterestFilter);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/Messages.java
index e7866aa38..93486065b 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/Messages.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/Messages.java
@@ -147,6 +147,8 @@ public class Messages extends NLS {
public static String FilterCompletedTasksAction_Filter_Completed_Tasks;
+ public static String FilterMyTasksAction_My_Tasks;
+
public static String GoIntoAction_Go_Into;
public static String GoUpAction_Go_Up_To_Root;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/messages.properties
index c4dca34b3..4fff61e4a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/messages.properties
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/messages.properties
@@ -85,6 +85,7 @@ ExportAction_Problems_encountered=Problems encountered during export. See error
ExportAction_X_exists_Do_you_wish_to_overwrite={0} exists. Do you wish to overwrite?
FilterCompletedTasksAction_Filter_Completed_Tasks=Hide Completed Tasks
+FilterMyTasksAction_My_Tasks=Show only my tasks
GoIntoAction_Go_Into=Go Into
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
index a7cc34d77..1164d7ab3 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
@@ -65,6 +65,7 @@ import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
import org.eclipse.mylyn.internal.tasks.ui.AbstractTaskListFilter;
import org.eclipse.mylyn.internal.tasks.ui.CategorizedPresentation;
import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
+import org.eclipse.mylyn.internal.tasks.ui.MyTasksFilter;
import org.eclipse.mylyn.internal.tasks.ui.ScheduledPresentation;
import org.eclipse.mylyn.internal.tasks.ui.TaskArchiveFilter;
import org.eclipse.mylyn.internal.tasks.ui.TaskCompletionFilter;
@@ -75,6 +76,7 @@ import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.actions.CollapseAllAction;
import org.eclipse.mylyn.internal.tasks.ui.actions.ExpandAllAction;
import org.eclipse.mylyn.internal.tasks.ui.actions.FilterCompletedTasksAction;
+import org.eclipse.mylyn.internal.tasks.ui.actions.FilterMyTasksAction;
import org.eclipse.mylyn.internal.tasks.ui.actions.GoUpAction;
import org.eclipse.mylyn.internal.tasks.ui.actions.GroupSubTasksAction;
import org.eclipse.mylyn.internal.tasks.ui.actions.LinkWithEditorAction;
@@ -252,6 +254,8 @@ public class TaskListView extends AbstractTaskListView implements IPropertyChang
private FilterCompletedTasksAction filterCompleteTask;
+ private FilterMyTasksAction filterMyTasksAction;
+
private GroupSubTasksAction groupSubTasksAction;
private SynchronizeAutomaticallyAction synchronizeAutomatically;
@@ -279,6 +283,8 @@ public class TaskListView extends AbstractTaskListView implements IPropertyChang
private final PresentationFilter filterPresentation = PresentationFilter.getInstance();
+ private final MyTasksFilter filterMyTasks = new MyTasksFilter();
+
private TaskWorkingSetFilter filterWorkingSet;
private final Set<AbstractTaskListFilter> filters = new HashSet<AbstractTaskListFilter>();
@@ -545,6 +551,9 @@ public class TaskListView extends AbstractTaskListView implements IPropertyChang
if (TasksUiPlugin.getDefault().getPreferenceStore().contains(ITasksUiPreferenceConstants.FILTER_COMPLETE_MODE)) {
addFilter(filterComplete);
}
+ if (TasksUiPlugin.getDefault().getPreferenceStore().contains(ITasksUiPreferenceConstants.FILTER_MY_TASKS_MODE)) {
+ addFilter(filterMyTasks);
+ }
addFilter(filterPresentation);
addFilter(filterArchive);
@@ -1049,6 +1058,7 @@ public class TaskListView extends AbstractTaskListView implements IPropertyChang
manager.add(sortDialogAction);
manager.add(filterOnPriorityAction);
manager.add(filterCompleteTask);
+ manager.add(filterMyTasksAction);
IMenuManager advancedMenu = new MenuManager(Messages.TaskListView_Advanced_Filters_Label);
advancedMenu.add(new ShowAllQueriesAction());
showNonMatchingSubtasksAction = new ShowNonMatchingSubtasksAction();
@@ -1082,6 +1092,7 @@ public class TaskListView extends AbstractTaskListView implements IPropertyChang
manager.add(new GroupMarker(ID_SEPARATOR_CONTEXT));
manager.add(new Separator());
manager.add(filterCompleteTask);
+ manager.add(filterMyTasksAction);
manager.add(collapseAll);
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
@@ -1123,6 +1134,7 @@ public class TaskListView extends AbstractTaskListView implements IPropertyChang
synchronizeAutomatically = new SynchronizeAutomaticallyAction();
openPreferencesAction = new OpenTasksUiPreferencesAction();
//filterArchiveCategory = new FilterArchiveContainerAction(this);
+ filterMyTasksAction = new FilterMyTasksAction(this);
sortDialogAction = new TaskListSortAction(getSite(), this);
filterOnPriorityAction = new PriorityDropDownAction(this);
linkWithEditorAction = new LinkWithEditorAction(this);
@@ -1201,11 +1213,20 @@ public class TaskListView extends AbstractTaskListView implements IPropertyChang
}
}
- public void clearFilters() {
+ public Set<AbstractTaskListFilter> clearFilters() {
+ HashSet<AbstractTaskListFilter> previousFilters = new HashSet<AbstractTaskListFilter>(getFilters());
+ previousFilters.remove(filterMyTasks);// this filter is always available for users to toggle
filters.clear();
filters.add(filterArchive);
filters.add(filterWorkingSet);
filters.add(filterPresentation);
+ boolean enableMyTasksFilter = TasksUiPlugin.getDefault()
+ .getPreferenceStore()
+ .getBoolean(ITasksUiPreferenceConstants.FILTER_MY_TASKS_MODE);
+ if (enableMyTasksFilter) {
+ filters.add(getMyTasksFilter());
+ }
+ return previousFilters;
}
public void removeFilter(AbstractTaskListFilter filter) {
@@ -1617,4 +1638,8 @@ public class TaskListView extends AbstractTaskListView implements IPropertyChang
public TaskListServiceMessageControl getServiceMessageControl() {
return serviceMessageControl;
}
+
+ public MyTasksFilter getMyTasksFilter() {
+ return filterMyTasks;
+ }
}

Back to the top