Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ClearContextAction.java')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ClearContextAction.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ClearContextAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ClearContextAction.java
new file mode 100644
index 000000000..a22ab1538
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ClearContextAction.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2004 - 2005 University Of British Columbia 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:
+ * University Of British Columbia - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylar.tasks.ui.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.mylar.core.MylarPlugin;
+import org.eclipse.mylar.tasks.BugzillaHit;
+import org.eclipse.mylar.tasks.BugzillaTask;
+import org.eclipse.mylar.tasks.ITask;
+import org.eclipse.mylar.tasks.Task;
+import org.eclipse.mylar.tasks.ui.views.TaskListView;
+import org.eclipse.mylar.ui.MylarImages;
+
+/**
+ * @author Mik Kersten and Ken Sueda
+ */
+public class ClearContextAction extends Action {
+
+ public static final String ID = "org.eclipse.mylar.tasks.actions.context.clear";
+
+ private final TaskListView view;
+
+ public ClearContextAction(TaskListView view) {
+ this.view = view;
+ setText("Clear Task Context");
+ setToolTipText("Clear Task Context");
+ setId(ID);
+ setImageDescriptor(MylarImages.ERASE_TASKSCAPE);
+ }
+ @Override
+ public void run() {
+ MylarPlugin.getDefault().actionObserved(this);
+ Object selectedObject = ((IStructuredSelection)this.view.getViewer().getSelection()).getFirstElement();
+ if (selectedObject != null && selectedObject instanceof ITask) {
+ MylarPlugin.getTaskscapeManager().taskDeleted(((ITask)selectedObject).getHandle(), ((Task)selectedObject).getPath());
+ this.view.getViewer().refresh();
+ } else if (selectedObject != null && selectedObject instanceof BugzillaHit) {
+ BugzillaTask task = ((BugzillaHit)selectedObject).getAssociatedTask();
+ if(task != null){
+ MylarPlugin.getTaskscapeManager().taskDeleted(task.getHandle(), task.getPath());
+ }
+ this.view.getViewer().refresh();
+ }
+ }
+} \ No newline at end of file

Back to the top