Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2010-05-29 14:27:17 -0400
committerspingel2010-05-29 14:27:17 -0400
commitd3d7c3775469ebf6ad38e3e1ea5f9425269ebc98 (patch)
tree0af87e91f025ddcfc9e55cce7a3bbdc8c53c83fa /org.eclipse.mylyn.tasks.ui
parent045cd20b2148f20c0961c11d63340211dcd875b7 (diff)
downloadorg.eclipse.mylyn.tasks-d3d7c3775469ebf6ad38e3e1ea5f9425269ebc98.tar.gz
org.eclipse.mylyn.tasks-d3d7c3775469ebf6ad38e3e1ea5f9425269ebc98.tar.xz
org.eclipse.mylyn.tasks-d3d7c3775469ebf6ad38e3e1ea5f9425269ebc98.zip
NEW - bug 314166: fix the scheduled presentation bins and sort order
https://bugs.eclipse.org/bugs/show_bug.cgi?id=314166
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/PresentationDropDownSelectionAction.java24
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java28
2 files changed, 41 insertions, 11 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/PresentationDropDownSelectionAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/PresentationDropDownSelectionAction.java
index 11b7759af..cf7f9413c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/PresentationDropDownSelectionAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/PresentationDropDownSelectionAction.java
@@ -49,11 +49,8 @@ public class PresentationDropDownSelectionAction extends Action implements IMenu
private void addActionsToMenu() {
for (AbstractTaskListPresentation presentation : TaskListView.getPresentations()) {
if (presentation.isPrimary()) {
- PresentationSelectionAction action = new PresentationSelectionAction(presentation);
+ PresentationSelectionAction action = new PresentationSelectionAction(view, presentation);
ActionContributionItem item = new ActionContributionItem(action);
- action.setText(presentation.getName());
- action.setImageDescriptor(presentation.getImageDescriptor());
- action.setChecked(view.getCurrentPresentation().getId().equals(presentation.getId()));
item.fill(dropDownMenu, -1);
}
}
@@ -68,11 +65,8 @@ public class PresentationDropDownSelectionAction extends Action implements IMenu
separatorAdded = true;
}
- PresentationSelectionAction action = new PresentationSelectionAction(presentation);
+ PresentationSelectionAction action = new PresentationSelectionAction(view, presentation);
ActionContributionItem item = new ActionContributionItem(action);
- action.setText(presentation.getName());
- action.setImageDescriptor(presentation.getImageDescriptor());
- action.setChecked(view.getCurrentPresentation().getId().equals(presentation.getId()));
item.fill(dropDownMenu, -1);
}
}
@@ -133,19 +127,29 @@ public class PresentationDropDownSelectionAction extends Action implements IMenu
return dropDownMenu;
}
- private class PresentationSelectionAction extends Action {
+ public static class PresentationSelectionAction extends Action {
private final AbstractTaskListPresentation presentation;
- public PresentationSelectionAction(AbstractTaskListPresentation presentation) {
+ private final TaskListView view;
+
+ public PresentationSelectionAction(TaskListView view, AbstractTaskListPresentation presentation) {
+ this.view = view;
this.presentation = presentation;
setText(presentation.getName());
+ setImageDescriptor(presentation.getImageDescriptor());
+ update();
+ }
+
+ public void update() {
+ setChecked(view.getCurrentPresentation().getId().equals(presentation.getId()));
}
@Override
public void run() {
view.applyPresentation(presentation);
}
+
}
}
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 9d526f6c7..4a27c28e8 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
@@ -24,7 +24,10 @@ import java.util.Set;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.GroupMarker;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
@@ -995,6 +998,14 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener, I
if (presentationDropDownSelectionAction != null && currentPresentation != null) {
presentationDropDownSelectionAction.setImageDescriptor(currentPresentation.getImageDescriptor());
}
+ for (IContributionItem item : getViewSite().getActionBars().getToolBarManager().getItems()) {
+ if (item instanceof ActionContributionItem) {
+ IAction action = ((ActionContributionItem) item).getAction();
+ if (action instanceof PresentationDropDownSelectionAction.PresentationSelectionAction) {
+ ((PresentationDropDownSelectionAction.PresentationSelectionAction) action).update();
+ }
+ }
+ }
}
public AbstractTaskListPresentation getCurrentPresentation() {
@@ -1152,7 +1163,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener, I
private void fillLocalToolBar(IToolBarManager manager) {
manager.add(newTaskAction);
- manager.add(presentationDropDownSelectionAction);
+ addPresentations(manager);
manager.add(new Separator());
manager.add(filterCompleteTask);
manager.add(collapseAll);
@@ -1160,6 +1171,21 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener, I
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
+ private void addPresentations(IToolBarManager manager) {
+ for (AbstractTaskListPresentation presentation : TaskListView.getPresentations()) {
+ if (!presentation.isPrimary()) {
+ // at least one non primary presentation present
+ manager.add(presentationDropDownSelectionAction);
+ return;
+ }
+ }
+
+ // add toggle buttons for primary presentations
+ for (AbstractTaskListPresentation presentation : TaskListView.getPresentations()) {
+ manager.add(new PresentationDropDownSelectionAction.PresentationSelectionAction(this, presentation));
+ }
+ }
+
public List<IRepositoryElement> getSelectedTaskContainers() {
List<IRepositoryElement> selectedElements = new ArrayList<IRepositoryElement>();
for (Iterator<?> i = ((IStructuredSelection) getViewer().getSelection()).iterator(); i.hasNext();) {

Back to the top