diff options
author | mkersten | 2009-02-26 23:12:56 +0000 |
---|---|---|
committer | mkersten | 2009-02-26 23:12:56 +0000 |
commit | df7cbab358bd656969aebfc4c1cbfa0c6949ed1c (patch) | |
tree | d0410b297a41f6b3442dadffda72e23406b476e4 /org.eclipse.mylyn.tasks.ui/src/org | |
parent | d375c842c643bfb38cfe90d5dfcbd748836ce450 (diff) | |
download | org.eclipse.mylyn.tasks-df7cbab358bd656969aebfc4c1cbfa0c6949ed1c.tar.gz org.eclipse.mylyn.tasks-df7cbab358bd656969aebfc4c1cbfa0c6949ed1c.tar.xz org.eclipse.mylyn.tasks-df7cbab358bd656969aebfc4c1cbfa0c6949ed1c.zip |
RESOLVED - bug 220006: Keep a newly opened (incoming) bug in the task list or make it easier to return to
https://bugs.eclipse.org/bugs/show_bug.cgi?id=220006
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui/src/org')
2 files changed, 78 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskEditorScheduleAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskEditorScheduleAction.java new file mode 100644 index 000000000..fc718b1b9 --- /dev/null +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskEditorScheduleAction.java @@ -0,0 +1,74 @@ +/******************************************************************************* + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tasktop Technologies - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylyn.internal.tasks.ui.actions; + +import java.util.Collections; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IMenuCreator; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages; +import org.eclipse.mylyn.internal.tasks.core.AbstractTask; +import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil; +import org.eclipse.mylyn.internal.tasks.ui.ScheduleTaskMenuContributor; +import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin; +import org.eclipse.mylyn.tasks.core.IRepositoryElement; +import org.eclipse.mylyn.tasks.core.ITask; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Menu; + +/** + * @author Mik Kersten + */ +public class TaskEditorScheduleAction extends Action implements IMenuCreator { + + private final ITask task; + + private MenuManager menuManager = null; + + private final ScheduleTaskMenuContributor scheduleMenuContributor = new ScheduleTaskMenuContributor(); + + public TaskEditorScheduleAction(ITask task) { + this.task = task; + this.setImageDescriptor(CommonImages.SCHEDULE_DAY); + + setMenuCreator(this); + } + + @Override + public void run() { + TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task, + TaskActivityUtil.getCurrentWeek().getToday()); + } + + public Menu getMenu(Control parent) { + if (menuManager != null) { + menuManager.dispose(); + } + menuManager = scheduleMenuContributor.getSubMenuManager(Collections.singletonList((IRepositoryElement) task)); + menuManager.createContextMenu(parent); + return menuManager.getMenu(); + } + + public Menu getMenu(Menu parent) { + if (menuManager != null) { + menuManager.dispose(); + } + menuManager = scheduleMenuContributor.getSubMenuManager(Collections.singletonList((IRepositoryElement) task)); + return menuManager.getMenu(); + } + + public void dispose() { + menuManager.dispose(); + } + +}
\ No newline at end of file diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java index fdfe630cf..01af3efe7 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java @@ -44,6 +44,7 @@ import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector; import org.eclipse.mylyn.internal.tasks.core.LocalTask; import org.eclipse.mylyn.internal.tasks.core.TaskList; import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin; +import org.eclipse.mylyn.internal.tasks.ui.actions.TaskEditorScheduleAction; import org.eclipse.mylyn.internal.tasks.ui.actions.ToggleTaskActivationAction; import org.eclipse.mylyn.internal.tasks.ui.editors.EditorBusyIndicator; import org.eclipse.mylyn.internal.tasks.ui.editors.EditorUtil; @@ -593,6 +594,9 @@ public class TaskEditor extends SharedHeaderFormEditor { } }; } + toolBarManager.add(new Separator("planning")); + toolBarManager.add(new TaskEditorScheduleAction(task)); + toolBarManager.add(new Separator("activation")); //$NON-NLS-1$ toolBarManager.add(activateAction); |