Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsminto2010-05-25 18:07:39 -0400
committersminto2010-05-25 18:07:39 -0400
commit09e54670ab62dff9004277c72de09dc6eace994a (patch)
tree4e56e96d0d817de400ec61dad19bc54bef3cac5c /org.eclipse.mylyn.tasks.ui
parente2100aad0f0a594d36dbbf3cb515079c7d4a3ffa (diff)
downloadorg.eclipse.mylyn.tasks-09e54670ab62dff9004277c72de09dc6eace994a.tar.gz
org.eclipse.mylyn.tasks-09e54670ab62dff9004277c72de09dc6eace994a.tar.xz
org.eclipse.mylyn.tasks-09e54670ab62dff9004277c72de09dc6eace994a.zip
RESOLVED - bug 306063: add new task and activate action to the Windows task bar
https://bugs.eclipse.org/bugs/show_bug.cgi?id=306063
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-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.java68
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskAction.java12
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/messages.properties2
4 files changed, 66 insertions, 20 deletions
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 f0eccd482..feb69f91a 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
@@ -121,12 +121,16 @@ public class Messages extends NLS {
public static String TasksReminderDialog_Reminders;
+ public static String TasksUiPlugin_Activate_Task;
+
public static String TasksUiPlugin_Initializing_Task_List;
public static String TasksUiPlugin_Task_Repositories;
public static String TasksUiPlugin_Load_Data_Directory;
+ public static String TasksUiPlugin_New_Task;
+
public static String TaskTrimWidget__no_active_task_;
public static String TaskTrimWidget__no_task_active_;
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 46fc71d61..74c12be45 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
@@ -44,6 +44,8 @@ import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Platform;
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.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -52,6 +54,7 @@ import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.commons.net.WebUtil;
import org.eclipse.mylyn.context.core.ContextCore;
+import org.eclipse.mylyn.internal.commons.ui.TaskBarManager;
import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
import org.eclipse.mylyn.internal.monitor.ui.MonitorUiPlugin;
import org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotification;
@@ -69,8 +72,8 @@ import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta;
-import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta.Type;
+import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataStore;
import org.eclipse.mylyn.internal.tasks.core.externalization.ExternalizationManager;
@@ -78,6 +81,8 @@ import org.eclipse.mylyn.internal.tasks.core.externalization.IExternalizationPar
import org.eclipse.mylyn.internal.tasks.core.externalization.TaskListExternalizationParticipant;
import org.eclipse.mylyn.internal.tasks.core.externalization.TaskListExternalizer;
import org.eclipse.mylyn.internal.tasks.core.notifications.ServiceMessageManager;
+import org.eclipse.mylyn.internal.tasks.ui.actions.ActivateTaskDialogAction;
+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;
@@ -86,20 +91,22 @@ import org.eclipse.mylyn.tasks.core.AbstractDuplicateDetector;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
+import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
import org.eclipse.mylyn.tasks.core.ITaskActivationListener;
import org.eclipse.mylyn.tasks.core.ITaskContainer;
import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
import org.eclipse.mylyn.tasks.core.TaskActivationAdapter;
import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.AbstractTaskRepositoryLinkProvider;
import org.eclipse.mylyn.tasks.ui.TasksUi;
+import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPageFactory;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IStartup;
+import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.FormColors;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -441,6 +448,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
initializeNotificationsAndSynchronization();
+ addSystemTaskBarActions();
+
try {
getPreferenceStore().addPropertyChangeListener(PROPERTY_LISTENER);
@@ -472,16 +481,43 @@ public class TasksUiPlugin extends AbstractUIPlugin {
INSTANCE = this;
}
+ private void addSystemTaskBarActions() {
+ MenuManager taskBarMenuManager = TaskBarManager.getTaskBarMenuManager();
+ if (taskBarMenuManager != null) {
+ NewTaskAction newTaskAction = new NewTaskAction(Messages.TasksUiPlugin_New_Task, true);
+ taskBarMenuManager.add(newTaskAction);
+
+ Action activateTaskAction = new Action() {
+ @Override
+ public void run() {
+ ActivateTaskDialogAction activateTaskDialogAction = new ActivateTaskDialogAction();
+ IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow();
+ if (window == null && getWorkbench().getWorkbenchWindows().length > 0) {
+ window = getWorkbench().getWorkbenchWindows()[0];
+ }
+ activateTaskDialogAction.init(window);
+ activateTaskDialogAction.run(null);
+ }
+ };
+ activateTaskAction.setImageDescriptor(TasksUiImages.CONTEXT_ACTIVE_CENTERED);
+ activateTaskAction.setText(Messages.TasksUiPlugin_Activate_Task);
+ taskBarMenuManager.add(activateTaskAction);
+ taskBarMenuManager.update(true);
+ }
+ }
+
private void updateSynchronizationScheduler(boolean initial) {
if (synchronizationScheduler == null) {
return;
}
- boolean enabled = TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED);
+ boolean enabled = TasksUiPlugin.getDefault()
+ .getPreferenceStore()
+ .getBoolean(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED);
if (enabled) {
- long interval = TasksUiPlugin.getDefault().getPreferenceStore().getLong(
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS);
+ long interval = TasksUiPlugin.getDefault()
+ .getPreferenceStore()
+ .getLong(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS);
if (initial) {
synchronizationScheduler.setInterval(DELAY_QUERY_REFRESH_ON_STARTUP, interval);
} else {
@@ -852,15 +888,18 @@ public class TasksUiPlugin extends AbstractUIPlugin {
}
}
- if (!MonitorUiPlugin.getDefault().getPreferenceStore().getBoolean(
- MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED + ".checked")) { //$NON-NLS-1$
+ if (!MonitorUiPlugin.getDefault()
+ .getPreferenceStore()
+ .getBoolean(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED + ".checked")) { //$NON-NLS-1$
if (!taskActivityMonitor.getActivationHistory().isEmpty()) {
// tasks have been active before so fore preference enabled
- MonitorUiPlugin.getDefault().getPreferenceStore().setValue(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED,
- true);
+ MonitorUiPlugin.getDefault()
+ .getPreferenceStore()
+ .setValue(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED, true);
}
- MonitorUiPlugin.getDefault().getPreferenceStore().setValue(
- MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED + ".checked", true); //$NON-NLS-1$
+ MonitorUiPlugin.getDefault()
+ .getPreferenceStore()
+ .setValue(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED + ".checked", true); //$NON-NLS-1$
MonitorUiPlugin.getDefault().savePluginPreferences();
}
@@ -940,8 +979,9 @@ public class TasksUiPlugin extends AbstractUIPlugin {
}
public boolean groupSubtasks(ITaskContainer element) {
- boolean groupSubtasks = TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.GROUP_SUBTASKS);
+ boolean groupSubtasks = TasksUiPlugin.getDefault()
+ .getPreferenceStore()
+ .getBoolean(ITasksUiPreferenceConstants.GROUP_SUBTASKS);
if (element instanceof ITask) {
AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(((ITask) element).getConnectorKind());
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskAction.java
index 4f051bac5..709c5fd0b 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskAction.java
@@ -66,20 +66,20 @@ public class NewTaskAction extends BaseSelectionListenerAction implements IMenuC
private Menu dropDownMenu;
- private NewTaskAction(boolean alwaysShowWizard) {
- super(LABEL_NEW_TASK);
+ public NewTaskAction(String label, boolean alwaysShowWizard) {
+ super(label);
if (!alwaysShowWizard) {
setMenuCreator(this);
}
- setText(LABEL_NEW_TASK);
- setToolTipText(LABEL_NEW_TASK);
+ setText(label);
+ setToolTipText(label);
setId(ID);
setEnabled(true);
setImageDescriptor(TasksUiImages.TASK_NEW);
}
public NewTaskAction() {
- this(false);
+ this(LABEL_NEW_TASK, false);
}
@Override
@@ -144,7 +144,7 @@ public class NewTaskAction extends BaseSelectionListenerAction implements IMenuC
}
private void addActionsToMenu() {
- NewTaskAction newTaskAction = new NewTaskAction(true);
+ NewTaskAction newTaskAction = new NewTaskAction(LABEL_NEW_TASK, true);
newTaskAction.setText(Messages.NewTaskAction_Show_Wizard_Label);
new ActionContributionItem(newTaskAction).fill(dropDownMenu, -1);
new Separator().fill(dropDownMenu, -1);
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 6df0e3615..5d6b40885 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
@@ -73,9 +73,11 @@ TasksReminderDialog_Remind_tommorrow=Remind tomorrow
TasksReminderDialog_Reminder_Day=Reminder Day
TasksReminderDialog_Reminders=Reminders
+TasksUiPlugin_Activate_Task=Activate Task...
TasksUiPlugin_Initializing_Task_List=Initializing Task List
TasksUiPlugin_Task_Repositories=Task Repositories
TasksUiPlugin_Load_Data_Directory=Load Data Directory
+TasksUiPlugin_New_Task=New Task...
TaskTrimWidget__no_active_task_=<no active task>
TaskTrimWidget__no_task_active_=<no task active>

Back to the top