Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Davis2013-03-12 18:05:16 -0400
committerSam Davis2013-05-07 18:37:58 -0400
commit14645818d4cba66532dad22c29dfec6857da9706 (patch)
tree88da848fbb6d040f22662113c42afa5101f8c3a5 /org.eclipse.mylyn.tasks.ui/src/org
parent79a78a92923d2692c688bc85a6b241a8e21e37cb (diff)
downloadorg.eclipse.mylyn.tasks-14645818d4cba66532dad22c29dfec6857da9706.tar.gz
org.eclipse.mylyn.tasks-14645818d4cba66532dad22c29dfec6857da9706.tar.xz
org.eclipse.mylyn.tasks-14645818d4cba66532dad22c29dfec6857da9706.zip
360055: prompt users to disable "Show subtasks not Matching Query"
Change-Id: I706339a69028adba4a0d0567f8994471a03a6b0f Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=360055
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui/src/org')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java3
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/Messages.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java41
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ShowNonMatchingSubtasksAction.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/messages.properties4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListServiceMessageControl.java12
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java12
7 files changed, 80 insertions, 2 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 4ec877e92..6252240ef 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
@@ -48,6 +48,8 @@ public interface ITasksUiPreferenceConstants {
public static final String FILTER_NON_MATCHING = "org.eclipse.mylyn.tasks.ui.filters.nonmatching"; //$NON-NLS-1$
+ public static final String ENCOURAGED_FILTER_NON_MATCHING = "org.eclipse.mylyn.tasks.ui.filters.nonmatching.encouraged"; //$NON-NLS-1$
+
public static final String FILTER_PRIORITY = "org.eclipse.mylyn.tasks.ui.filters.priority"; //$NON-NLS-1$
public static final String GROUP_SUBTASKS = "org.eclipse.mylyn.tasks.ui.group.subtasks"; //$NON-NLS-1$
@@ -107,4 +109,5 @@ public interface ITasksUiPreferenceConstants {
public static final String LAST_SERVICE_MESSAGE_LAST_MODIFIED = "org.eclipse.mylyn.tasks.ui.servicemessage.lastmodified"; //$NON-NLS-1$
public static final String LAST_SERVICE_MESSAGE_CHECKTIME = "org.eclipse.mylyn.tasks.ui.servicemessage.checktime"; //$NON-NLS-1$
+
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/Messages.java
index c91b04316..7b2377f6f 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/Messages.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/Messages.java
@@ -123,6 +123,10 @@ public class Messages extends NLS {
public static String TasksUiPlugin_Activate_Task;
+ public static String TasksUiPlugin_Hide_Irrelevant_Subtasks;
+
+ public static String TasksUiPlugin_Hide_Irrelevant_Subtasks_Message;
+
public static String TasksUiPlugin_Initializing_Task_List;
public static String TasksUiPlugin_Task_Repositories;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
index 5d40fa008..197954e1b 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
@@ -46,6 +46,7 @@ import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -59,6 +60,7 @@ import org.eclipse.mylyn.commons.notifications.ui.AbstractUiNotification;
import org.eclipse.mylyn.commons.ui.compatibility.CommonColors;
import org.eclipse.mylyn.commons.ui.compatibility.CommonFonts;
import org.eclipse.mylyn.commons.workbench.TaskBarManager;
+import org.eclipse.mylyn.internal.commons.notifications.feed.ServiceMessage;
import org.eclipse.mylyn.internal.discovery.ui.DiscoveryUi;
import org.eclipse.mylyn.internal.monitor.ui.MonitorUiPlugin;
import org.eclipse.mylyn.internal.tasks.core.AbstractSearchHandler;
@@ -87,6 +89,7 @@ import org.eclipse.mylyn.internal.tasks.ui.actions.NewTaskAction;
import org.eclipse.mylyn.internal.tasks.ui.notifications.TaskListNotificationReminder;
import org.eclipse.mylyn.internal.tasks.ui.notifications.TaskListNotifier;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiExtensionReader;
+import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoriesView;
import org.eclipse.mylyn.tasks.core.AbstractDuplicateDetector;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
@@ -454,8 +457,46 @@ public class TasksUiPlugin extends AbstractUIPlugin {
} finally {
monitor.done();
}
+ hideNonMatchingSubtasks();
return new Status(IStatus.OK, TasksUiPlugin.ID_PLUGIN, IStatus.OK, "", null); //$NON-NLS-1$
}
+
+ /**
+ * hide non-matching subtasks, or display a message about it if this is not a fresh installation
+ */
+ protected void hideNonMatchingSubtasks() {
+ final String HIDE_SUBTASKS = "hide-subtasks"; //$NON-NLS-1$
+ if (!getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.FILTER_NON_MATCHING)
+ && !getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.ENCOURAGED_FILTER_NON_MATCHING)) {
+ if (taskList.getQueries().isEmpty()) {
+ getPreferenceStore().setValue(ITasksUiPreferenceConstants.FILTER_NON_MATCHING, true);
+ } else {
+ TaskListView view = TaskListView.getFromActivePerspective();
+ if (view != null && view.getServiceMessageControl() != null) {
+ ServiceMessage message = new ServiceMessage("") { //$NON-NLS-1$
+ @Override
+ public boolean openLink(String link) {
+ if (HIDE_SUBTASKS.equals(link)) {
+ getPreferenceStore().setValue(ITasksUiPreferenceConstants.FILTER_NON_MATCHING, true);
+ savePluginPreferences();
+ return true;
+ }
+ return false;
+ }
+ };
+ message.setId("hide.nonmatching.subtasks"); //$NON-NLS-1$
+ message.setImage(Dialog.DLG_IMG_MESSAGE_INFO);
+ message.setTitle(Messages.TasksUiPlugin_Hide_Irrelevant_Subtasks);
+ message.setDescription(NLS.bind(Messages.TasksUiPlugin_Hide_Irrelevant_Subtasks_Message,
+ HIDE_SUBTASKS));
+ view.getServiceMessageControl().setMessage(message);
+ }
+ }
+ // never do this again
+ getPreferenceStore().setValue(ITasksUiPreferenceConstants.ENCOURAGED_FILTER_NON_MATCHING, true);
+ savePluginPreferences();
+ }
+ }
}
public TasksUiPlugin() {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ShowNonMatchingSubtasksAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ShowNonMatchingSubtasksAction.java
index 31a6d28a9..624f5482b 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ShowNonMatchingSubtasksAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ShowNonMatchingSubtasksAction.java
@@ -35,4 +35,10 @@ public class ShowNonMatchingSubtasksAction extends Action {
.setValue(ITasksUiPreferenceConstants.FILTER_NON_MATCHING, !isChecked());
}
+ public void update() {
+ setChecked(!TasksUiPlugin.getDefault()
+ .getPreferenceStore()
+ .getBoolean(ITasksUiPreferenceConstants.FILTER_NON_MATCHING));
+ }
+
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/messages.properties
index 787d353a8..cb13d7820 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/messages.properties
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/messages.properties
@@ -74,6 +74,10 @@ TasksReminderDialog_Reminder_Day=Reminder Day
TasksReminderDialog_Reminders=Reminders
TasksUiPlugin_Activate_Task=Activate Task...
+TasksUiPlugin_Hide_Irrelevant_Subtasks=Hide Irrelevant Subtasks
+TasksUiPlugin_Hide_Irrelevant_Subtasks_Message=<a href="{0}">Click here</a> to disable incoming notifications for subtasks that do not match \
+any of your queries. These tasks will be hidden but you can find them by typing in the find box. You can change this setting under \
+Advanced Filters in the Task List view menu.
TasksUiPlugin_Initializing_Task_List=Initializing Task List
TasksUiPlugin_Task_Repositories=Task Repositories
TasksUiPlugin_Load_Data_Directory=Load Data Directory
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListServiceMessageControl.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListServiceMessageControl.java
index 71992b9ef..60ed41766 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListServiceMessageControl.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListServiceMessageControl.java
@@ -20,9 +20,11 @@ import java.util.Date;
import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.mylyn.commons.notifications.feed.IServiceMessageListener;
import org.eclipse.mylyn.commons.notifications.feed.ServiceMessageEvent;
import org.eclipse.mylyn.commons.notifications.ui.NotificationControl;
@@ -130,7 +132,7 @@ public class TaskListServiceMessageControl extends NotificationControl implement
return;
}
- String action = getAction(e.text);
+ final String action = getAction(e.text);
if ("create-local-task".equals(action)) { //$NON-NLS-1$
closeMessage();
LocalTask task = TasksUiInternal.createNewLocalTask(null);
@@ -156,6 +158,14 @@ public class TaskListServiceMessageControl extends NotificationControl implement
}
} else if (TasksUiInternal.isValidUrl(e.text)) {
TasksUiUtil.openUrl(e.text);
+ } else if (currentMessage != null) {
+ SafeRunner.run(new SafeRunnable() {
+ public void run() throws Exception {
+ if (currentMessage.openLink(action)) {
+ closeMessage();
+ }
+ }
+ });
}
}
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 f8428b6fc..1cfccc43e 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
@@ -381,6 +381,8 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener, I
private final PresentationDropDownSelectionAction presentationDropDownSelectionAction = new PresentationDropDownSelectionAction(
this);
+ private ShowNonMatchingSubtasksAction showNonMatchingSubtasksAction;
+
private final TaskPriorityFilter filterPriority = new TaskPriorityFilter();
private final TaskCompletionFilter filterComplete = new TaskCompletionFilter();
@@ -561,6 +563,9 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener, I
|| event.getProperty().equals(ITasksUiPreferenceConstants.GROUP_SUBTASKS)) {
filterPresentation.updateSettings();
refresh(true);
+ if (showNonMatchingSubtasksAction != null) {
+ showNonMatchingSubtasksAction.update();
+ }
}
}
};
@@ -1203,7 +1208,8 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener, I
manager.add(filterCompleteTask);
IMenuManager advancedMenu = new MenuManager(Messages.TaskListView_Advanced_Filters_Label);
advancedMenu.add(new ShowAllQueriesAction());
- advancedMenu.add(new ShowNonMatchingSubtasksAction());
+ showNonMatchingSubtasksAction = new ShowNonMatchingSubtasksAction();
+ advancedMenu.add(showNonMatchingSubtasksAction);
advancedMenu.add(new Separator());
advancedMenu.add(groupSubTasksAction);
manager.add(advancedMenu);
@@ -1756,4 +1762,8 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener, I
}
return super.getAdapter(adapter);
}
+
+ public TaskListServiceMessageControl getServiceMessageControl() {
+ return serviceMessageControl;
+ }
}

Back to the top