Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsminto2005-08-19 18:48:34 -0400
committersminto2005-08-19 18:48:34 -0400
commit63801c96e1b17be8e6366694cdd482c12cf6b101 (patch)
tree65bd2088c35aa6aa33143e40264ff83662175932
parente5c47620928fffc4322ea35022cc5409cee23faa (diff)
downloadorg.eclipse.mylyn.tasks-63801c96e1b17be8e6366694cdd482c12cf6b101.tar.gz
org.eclipse.mylyn.tasks-63801c96e1b17be8e6366694cdd482c12cf6b101.tar.xz
org.eclipse.mylyn.tasks-63801c96e1b17be8e6366694cdd482c12cf6b101.zip
fixed Bug #106906: Additional actions for tasklist popup menu
Bug #106861 create custom drill-down adapter
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/search/BugzillaSearchPage.java4
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskHandler.java12
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/TaskListImages.java1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/CopyDescriptionAction.java39
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/GoIntoAction.java27
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/GoUpAction.java26
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/OpenTaskEditorAction.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskListView.java70
8 files changed, 176 insertions, 5 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/search/BugzillaSearchPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/search/BugzillaSearchPage.java
index 9f96de811..f603434e9 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/search/BugzillaSearchPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/search/BugzillaSearchPage.java
@@ -439,7 +439,7 @@ public class BugzillaSearchPage extends DialogPage implements ISearchPage {
maxHitss = maxHitss.substring(0, i);
}
}
- maxHitsText.setText(maxHitss);
+
BugzillaSearchPage.this.maxHits = maxHitss;
}
});
@@ -447,7 +447,7 @@ public class BugzillaSearchPage extends DialogPage implements ISearchPage {
gd.widthHint = 20;
maxHitsText.setLayoutData(gd);
label = new Label(group, SWT.LEFT);
- label.setText(" Hits.");
+ label.setText(" Hits. (-1 means all hits are returned)");
maxHits = "100";
maxHitsText.setText(maxHits);
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskHandler.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskHandler.java
index 728a972c1..dd37e7dd5 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskHandler.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskHandler.java
@@ -30,7 +30,10 @@ import org.eclipse.mylar.tasklist.ITaskHandler;
import org.eclipse.mylar.tasklist.ITaskListElement;
import org.eclipse.mylar.tasklist.MylarTasklistPlugin;
import org.eclipse.mylar.tasklist.internal.TaskCategory;
+import org.eclipse.mylar.tasklist.ui.actions.CopyDescriptionAction;
import org.eclipse.mylar.tasklist.ui.actions.DeleteAction;
+import org.eclipse.mylar.tasklist.ui.actions.GoIntoAction;
+import org.eclipse.mylar.tasklist.ui.actions.OpenTaskEditorAction;
import org.eclipse.mylar.tasklist.ui.views.TaskListView;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
@@ -198,14 +201,19 @@ public class BugzillaTaskHandler implements ITaskHandler {
if(element instanceof BugzillaHit){
return false;
} else if(element instanceof BugzillaTask){
- if(action instanceof DeleteAction){
+ if(action instanceof DeleteAction || action instanceof CopyDescriptionAction || action instanceof OpenTaskEditorAction){
return true;
} else {
return false;
}
} else if(element instanceof BugzillaQueryCategory){
- if(action instanceof DeleteAction){
+ if(action instanceof DeleteAction || action instanceof CopyDescriptionAction || action instanceof OpenTaskEditorAction){
return true;
+ } else if(action instanceof GoIntoAction){
+ BugzillaQueryCategory cat = (BugzillaQueryCategory) element;
+ if(cat.getChildren().size() > 0){
+ return true;
+ }
} else {
return false;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/TaskListImages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/TaskListImages.java
index ca6706f29..4e6683165 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/TaskListImages.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/TaskListImages.java
@@ -48,6 +48,7 @@ public class TaskListImages {
public static final ImageDescriptor NAVIGATE_PREVIOUS = create(T_TOOL, "navigate-previous.gif");
public static final ImageDescriptor NAVIGATE_NEXT = create(T_TOOL, "navigate-next.gif");
+ public static final ImageDescriptor COPY = create(T_TOOL, "copy.png");
public static final ImageDescriptor GO_UP = create(T_TOOL, "go-up.gif");
public static final ImageDescriptor GO_INTO = create(T_TOOL, "go-into.gif");
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/CopyDescriptionAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/CopyDescriptionAction.java
new file mode 100644
index 000000000..db4d8d104
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/CopyDescriptionAction.java
@@ -0,0 +1,39 @@
+package org.eclipse.mylar.tasklist.ui.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.mylar.tasklist.ITaskListElement;
+import org.eclipse.mylar.tasklist.TaskListImages;
+import org.eclipse.mylar.tasklist.ui.views.TaskListView;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+
+public class CopyDescriptionAction extends Action {
+
+ private TaskListView view;
+
+ public CopyDescriptionAction(TaskListView view) {
+ this.view = view;
+ setText("Copy Description");
+ setToolTipText("Copy Description");
+ setImageDescriptor(TaskListImages.COPY);
+ }
+
+ @Override
+ public void run() {
+ ISelection selection = this.view.getViewer().getSelection();
+ Object obj = ((IStructuredSelection)selection).getFirstElement();
+ if (obj instanceof ITaskListElement) {
+ ITaskListElement element = (ITaskListElement)obj;
+ String description = element.getDescription(true);
+
+ // HACK: this should be done using proper copying
+ StyledText styledText = new StyledText(view.getFakeComposite(), SWT.NULL);
+ styledText.setText(description);
+ styledText.selectAll();
+ styledText.copy();
+ styledText.dispose();
+ }
+ }
+}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/GoIntoAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/GoIntoAction.java
new file mode 100644
index 000000000..9a00a6534
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/GoIntoAction.java
@@ -0,0 +1,27 @@
+package org.eclipse.mylar.tasklist.ui.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.mylar.tasklist.TaskListImages;
+import org.eclipse.mylar.tasklist.ui.views.TaskListView;
+import org.eclipse.ui.part.DrillDownAdapter;
+
+public class GoIntoAction extends Action {
+
+ private DrillDownAdapter drillDownAdapter;
+
+ public GoIntoAction(DrillDownAdapter drillDownAdapter) {
+ this.drillDownAdapter = drillDownAdapter;
+
+ setText("Go Into");
+ setToolTipText("Go into category");
+ setImageDescriptor(TaskListImages.GO_INTO);
+ }
+
+ @Override
+ public void run() {
+ drillDownAdapter.goInto();
+ if(TaskListView.getDefault() != null){
+ TaskListView.getDefault().updateDrillDownActions();
+ }
+ }
+}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/GoUpAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/GoUpAction.java
new file mode 100644
index 000000000..976c11687
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/GoUpAction.java
@@ -0,0 +1,26 @@
+package org.eclipse.mylar.tasklist.ui.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.mylar.tasklist.TaskListImages;
+import org.eclipse.mylar.tasklist.ui.views.TaskListView;
+import org.eclipse.ui.part.DrillDownAdapter;
+
+public class GoUpAction extends Action {
+
+ private DrillDownAdapter drillDownAdapter;
+
+ public GoUpAction(DrillDownAdapter drillDownAdapter) {
+ this.drillDownAdapter = drillDownAdapter;
+ setText("Go Up");
+ setToolTipText("Go Up");
+ setImageDescriptor(TaskListImages.GO_UP);
+ }
+
+ @Override
+ public void run() {
+ drillDownAdapter.goBack();
+ if(TaskListView.getDefault() != null){
+ TaskListView.getDefault().updateDrillDownActions();
+ }
+ }
+}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/OpenTaskEditorAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/OpenTaskEditorAction.java
index 8f34d58b3..02712a3fb 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/OpenTaskEditorAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/OpenTaskEditorAction.java
@@ -34,6 +34,8 @@ public class OpenTaskEditorAction extends Action {
*/
public OpenTaskEditorAction(TaskListView view) {
this.view = view;
+ setText("Open");
+ setToolTipText("Open tasklist element");
setId(ID);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskListView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskListView.java
index e7a05c104..241d6213b 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskListView.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskListView.java
@@ -62,10 +62,13 @@ import org.eclipse.mylar.tasklist.internal.TaskPriorityFilter;
import org.eclipse.mylar.tasklist.ui.TaskEditorInput;
import org.eclipse.mylar.tasklist.ui.actions.AutoCloseAction;
import org.eclipse.mylar.tasklist.ui.actions.CollapseAllAction;
+import org.eclipse.mylar.tasklist.ui.actions.CopyDescriptionAction;
import org.eclipse.mylar.tasklist.ui.actions.CreateCategoryAction;
import org.eclipse.mylar.tasklist.ui.actions.CreateTaskAction;
import org.eclipse.mylar.tasklist.ui.actions.DeleteAction;
import org.eclipse.mylar.tasklist.ui.actions.FilterCompletedTasksAction;
+import org.eclipse.mylar.tasklist.ui.actions.GoUpAction;
+import org.eclipse.mylar.tasklist.ui.actions.GoIntoAction;
import org.eclipse.mylar.tasklist.ui.actions.MarkTaskCompleteAction;
import org.eclipse.mylar.tasklist.ui.actions.MarkTaskIncompleteAction;
import org.eclipse.mylar.tasklist.ui.actions.NavigatePreviousAction;
@@ -115,6 +118,12 @@ public class TaskListView extends ViewPart {
private FilteredTree tree;
private DrillDownAdapter drillDownAdapter;
+ private GoIntoAction goIntoAction;
+ private GoUpAction goBackAction;
+
+ private CopyDescriptionAction copyAction;
+ private OpenTaskEditorAction openAction;
+
private CreateTaskAction createTask;
private CreateTaskAction createTaskToolbar;
private CreateCategoryAction createCategory;
@@ -147,6 +156,8 @@ public class TaskListView extends ViewPart {
public static String[] PRIORITY_LEVELS = { "P1", "P2", "P3", "P4", "P5" };
private TaskActivationHistory taskHistory = new TaskActivationHistory();
+
+ private boolean canEnableGoInto = false;
private final class PriorityDropDownAction extends Action implements IMenuCreator {
private Menu dropDownMenu = null;
@@ -880,26 +891,35 @@ public class TaskListView extends ViewPart {
}
private void fillLocalPullDown(IMenuManager manager) {
+ updateDrillDownActions();
manager.add(collapseAll);
manager.add(new Separator());
manager.add(previousTaskAction);
manager.add(nextTaskAction);
manager.add(new Separator());
- drillDownAdapter.addNavigationActions(manager);
+ manager.add(goBackAction);
+// drillDownAdapter.addNavigationActions(manager);
manager.add(new Separator());
manager.add(autoClose);
autoClose.setEnabled(true);
}
void fillContextMenu(IMenuManager manager) {
+ updateDrillDownActions();
+
ITaskListElement element = null;;
final Object selectedObject = ((IStructuredSelection)getViewer().getSelection()).getFirstElement();
if (selectedObject instanceof ITaskListElement) {
element = (ITaskListElement) selectedObject;
}
+
+ addAction(openAction, manager, element);
+ addAction(goIntoAction, manager, element);
+ manager.add(new Separator());
addAction(completeTask, manager, element);
addAction(incompleteTask, manager, element);
addAction(delete, manager, element);
+ addAction(copyAction, manager, element);
manager.add(new Separator());
addAction(createTask, manager, element);
manager.add(new Separator("mylar"));
@@ -951,6 +971,10 @@ public class TaskListView extends ViewPart {
action.setEnabled(true);
} else if(action instanceof CreateTaskAction){
action.setEnabled(false);
+ }else if(action instanceof OpenTaskEditorAction){
+ action.setEnabled(true);
+ } else if(action instanceof CopyDescriptionAction){
+ action.setEnabled(true);
}
} else if(element instanceof TaskCategory) {
if(action instanceof MarkTaskCompleteAction){
@@ -961,10 +985,25 @@ public class TaskListView extends ViewPart {
action.setEnabled(true);
} else if(action instanceof CreateTaskAction){
action.setEnabled(true);
+ } else if(action instanceof GoIntoAction){
+ TaskCategory cat = (TaskCategory) element;
+ if(cat.getChildren().size() > 0){
+ action.setEnabled(true);
+ } else {
+ action.setEnabled(false);
+ }
+ }else if(action instanceof OpenTaskEditorAction){
+ action.setEnabled(false);
+ } else if(action instanceof CopyDescriptionAction){
+ action.setEnabled(true);
}
} else {
action.setEnabled(true);
}
+
+ if(!canEnableGoInto){
+ goIntoAction.setEnabled(false);
+ }
}
/**
@@ -972,6 +1011,13 @@ public class TaskListView extends ViewPart {
*
*/
private void makeActions() {
+
+ copyAction = new CopyDescriptionAction(this);
+ openAction = new OpenTaskEditorAction(this);
+
+ goIntoAction = new GoIntoAction(drillDownAdapter);
+ goBackAction = new GoUpAction(drillDownAdapter);
+
createTask = new CreateTaskAction(this);
createTaskToolbar = new CreateTaskAction(this);
createCategory = new CreateCategoryAction(this);
@@ -1246,6 +1292,28 @@ public class TaskListView extends ViewPart {
public void dispose() {
super.dispose();
}
+
+ public void updateDrillDownActions() {
+ if(drillDownAdapter.canGoBack()){
+ goBackAction.setEnabled(true);
+ } else {
+ goBackAction.setEnabled(false);
+ }
+
+ if(drillDownAdapter.canGoInto()){
+ canEnableGoInto = true;
+ } else {
+ canEnableGoInto = false;
+ }
+ }
+
+ /**
+ * HACK: This is used for the copy action
+ * @return
+ */
+ public Composite getFakeComposite() {
+ return tree;
+ }
}
//TextTransfer textTransfer = TextTransfer.getInstance();

Back to the top