Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2005-11-14 23:24:30 -0500
committermkersten2005-11-14 23:24:30 -0500
commit711e0b9f9f10ae69dda826cbf6791e6dd8687210 (patch)
tree47d310c6418fe75ba67d8c0a30826a23b654f7b3 /org.eclipse.mylyn.tasks.ui
parentb4016faeda6bdf1004a5730c560c199d84b4b51f (diff)
downloadorg.eclipse.mylyn.tasks-711e0b9f9f10ae69dda826cbf6791e6dd8687210.tar.gz
org.eclipse.mylyn.tasks-711e0b9f9f10ae69dda826cbf6791e6dd8687210.tar.xz
org.eclipse.mylyn.tasks-711e0b9f9f10ae69dda826cbf6791e6dd8687210.zip
formatting only
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/DeleteAction.java56
1 files changed, 24 insertions, 32 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/DeleteAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/DeleteAction.java
index 28106e9f7..faaa49c7f 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/DeleteAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/DeleteAction.java
@@ -28,63 +28,57 @@ import org.eclipse.ui.internal.Workbench;
* @author Mik Kersten and Ken Sueda
*/
public class DeleteAction extends Action {
-
+
public static final String ID = "org.eclipse.mylar.tasklist.actions.delete";
-
+
private final TaskListView view;
public DeleteAction(TaskListView view) {
this.view = view;
setText("Delete");
setId(ID);
- setImageDescriptor(TaskListImages.REMOVE);
+ setImageDescriptor(TaskListImages.REMOVE);
}
-
+
@Override
public void run() {
-
-// MylarPlugin.getDefault().actionObserved(this);
- Object selectedObject = ((IStructuredSelection) this.view.getViewer()
- .getSelection()).getFirstElement();
- if(selectedObject instanceof ITaskListElement &&
- MylarTasklistPlugin.getDefault().getTaskHandlerForElement((ITaskListElement)selectedObject) != null){
- MylarTasklistPlugin.getDefault().getTaskHandlerForElement((ITaskListElement) selectedObject).itemDeleted((ITaskListElement)selectedObject);
- }else if (selectedObject instanceof ITask) {
+
+ // MylarPlugin.getDefault().actionObserved(this);
+ Object selectedObject = ((IStructuredSelection) this.view.getViewer().getSelection()).getFirstElement();
+ if (selectedObject instanceof ITaskListElement && MylarTasklistPlugin.getDefault().getTaskHandlerForElement((ITaskListElement) selectedObject) != null) {
+ MylarTasklistPlugin.getDefault().getTaskHandlerForElement((ITaskListElement) selectedObject).itemDeleted((ITaskListElement) selectedObject);
+ } else if (selectedObject instanceof ITask) {
ITask task = (ITask) selectedObject;
if (task.isActive()) {
- MessageDialog.openError(Workbench.getInstance()
- .getActiveWorkbenchWindow().getShell(), "Delete failed",
+ MessageDialog.openError(Workbench.getInstance().getActiveWorkbenchWindow().getShell(), "Delete failed",
"Task must be deactivated in order to delete.");
return;
}
-
- String message = task.getDeleteConfirmationMessage();
- boolean deleteConfirmed = MessageDialog.openQuestion(
- Workbench.getInstance().getActiveWorkbenchWindow().getShell(),
- "Confirm delete", message);
- if (!deleteConfirmed)
+
+ String message = task.getDeleteConfirmationMessage();
+ boolean deleteConfirmed = MessageDialog.openQuestion(Workbench.getInstance().getActiveWorkbenchWindow().getShell(), "Confirm delete", message);
+ if (!deleteConfirmed)
return;
-
+
MylarTasklistPlugin.getTaskListManager().deleteTask(task);
MylarPlugin.getContextManager().contextDeleted(task.getHandleIdentifier(), task.getPath());
IWorkbenchPage page = MylarTasklistPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
- // if we couldn't get the page, get out of here
- if (page == null)
+ if (page == null) {
+ this.view.getViewer().refresh();
return;
+ }
try {
this.view.closeTaskEditors((ITask) selectedObject, page);
} catch (Exception e) {
MylarPlugin.log(e, " deletion failed");
}
} else if (selectedObject instanceof TaskCategory) {
- boolean deleteConfirmed = MessageDialog.openQuestion(
- Workbench.getInstance().getActiveWorkbenchWindow().getShell(),
- "Confirm delete",
- "Delete the selected category and all contained tasks?");
- if (!deleteConfirmed)
+ boolean deleteConfirmed = MessageDialog.openQuestion(Workbench.getInstance().getActiveWorkbenchWindow().getShell(), "Confirm delete",
+ "Delete the selected category and all contained tasks?");
+ if (!deleteConfirmed)
return;
-
+
TaskCategory cat = (TaskCategory) selectedObject;
for (ITask task : cat.getChildren()) {
MylarPlugin.getContextManager().contextDeleted(task.getHandleIdentifier(), task.getPath());
@@ -99,9 +93,7 @@ public class DeleteAction extends Action {
}
MylarTasklistPlugin.getTaskListManager().deleteCategory(cat);
} else {
- MessageDialog.openError(Workbench.getInstance()
- .getActiveWorkbenchWindow().getShell(), "Delete failed",
- "Nothing selected.");
+ MessageDialog.openError(Workbench.getInstance().getActiveWorkbenchWindow().getShell(), "Delete failed", "Nothing selected.");
return;
}
this.view.getViewer().refresh();

Back to the top