Bug 246149 - delete task repository should delete the tasks and queries automatically
Summary: delete task repository should delete the tasks and queries automatically
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P2 enhancement (vote)
Target Milestone: 3.1   Edit
Assignee: David Shepherd CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on: 243900
Blocks:
  Show dependency tree
 
Reported: 2008-09-03 16:43 EDT by Shawn Minto CLA
Modified: 2009-02-06 10:53 EST (History)
1 user (show)

See Also:


Attachments
Here's a patch to implement the proposed solution. (11.32 KB, patch)
2009-01-29 18:46 EST, David Shepherd CLA
no flags Details | Diff
mylyn/context/zip (5.05 KB, application/octet-stream)
2009-01-29 18:46 EST, David Shepherd CLA
no flags Details
updated (11.30 KB, text/plain)
2009-01-29 19:20 EST, David Shepherd CLA
no flags Details
updated patch (11.30 KB, patch)
2009-01-29 19:26 EST, David Shepherd CLA
no flags Details | Diff
updated (11.30 KB, text/plain)
2009-01-29 19:26 EST, David Shepherd CLA
no flags Details
fixed problem with repository deletions when no tasks or queries (1.45 KB, patch)
2009-01-29 19:54 EST, David Shepherd CLA
no flags Details | Diff
mylyn/context/zip (10.27 KB, application/octet-stream)
2009-01-29 19:54 EST, David Shepherd CLA
no flags Details
fixed according to comments (10.13 KB, patch)
2009-01-30 12:24 EST, David Shepherd CLA
no flags Details | Diff
mylyn/context/zip (43.46 KB, application/octet-stream)
2009-01-30 12:24 EST, David Shepherd CLA
no flags Details
fixed a updateSelection problem (10.13 KB, patch)
2009-01-30 12:30 EST, David Shepherd CLA
no flags Details | Diff
mylyn/context/zip (44.23 KB, application/octet-stream)
2009-01-30 12:30 EST, David Shepherd CLA
no flags Details
updated patch (10.49 KB, patch)
2009-01-31 23:20 EST, Steffen Pingel CLA
no flags Details | Diff
updated as per your comments (12.20 KB, patch)
2009-02-02 20:13 EST, David Shepherd CLA
no flags Details | Diff
mylyn/context/zip (28.85 KB, application/octet-stream)
2009-02-02 20:13 EST, David Shepherd CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Shawn Minto CLA 2008-09-03 16:43:48 EDT
Currently, when deleting a task repoistory, the user is just presented with a dialog telling them that they have queries and tasks that are still associated and need to be deleted before the repository can be deleted. Maybe we should consider having the delete task repository action support deleting all of the queries and the tasks for a repository so that it is easier for a user to delete a task repository.
Comment 1 Mik Kersten CLA 2009-01-27 17:46:19 EST
In terms of UI, I think we need the delete dialog for a repository to state the following.

------------------------
Delete the "Mumble Frotz" task repository?

This will delete [2000] tasks and [20] queries from your Task List.
------------------------

Other:
* Label needs to be changed to "Delete Repository..."
* Don't support deleting multiple repositories since that complicates the UI, instead disable for more than 1 selection
Comment 2 David Shepherd CLA 2009-01-29 18:46:45 EST
Created attachment 124222 [details]
Here's a patch to implement the proposed solution.
Comment 3 David Shepherd CLA 2009-01-29 18:46:48 EST
Created attachment 124223 [details]
mylyn/context/zip
Comment 4 David Shepherd CLA 2009-01-29 19:20:54 EST
Created attachment 124225 [details]
updated
Comment 5 David Shepherd CLA 2009-01-29 19:26:00 EST
Created attachment 124226 [details]
updated patch
Comment 6 David Shepherd CLA 2009-01-29 19:26:00 EST
Created attachment 124227 [details]
updated
Comment 7 David Shepherd CLA 2009-01-29 19:54:17 EST
Created attachment 124230 [details]
fixed problem with repository deletions when no tasks or queries
Comment 8 David Shepherd CLA 2009-01-29 19:54:22 EST
Created attachment 124231 [details]
mylyn/context/zip
Comment 9 Steffen Pingel CLA 2009-01-29 20:56:01 EST
Thanks for the patch. The last attachment seems to have only one file, can you attach it again? 

A few notes: Please simplify the expression in updateSelection(). The nested loops in run() seem a bit complicated. Try building a set of repositories first, then iterate over all queries and tasks once and add the elements that need to be deleted to a list. Executing the deletion in the progress monitor will not work well unless you call Display.readAndDispatch() to update the UI. IProgressService.busyCursorWhile() could work better in this case, even though it doesn't provide cancellation support. Generally monitor.beginTask() should always be followed by monitor.done():
 
 try {
   monitor.beginTask();
   ... 
 } finally {
   monitor.done();
 }
 
You should never call PlatformUI.getWorkbench().getActiveWorkbenchWindow() without checking if the returned window is null. A progress dialog, error dialog or other shells might get displayed between the event that invoked your action and execution of your action. In this case you could have used TasksUiInternal.getShell() which does the checking.

   
Comment 10 David Shepherd CLA 2009-01-30 12:24:16 EST
(In reply to comment #9)
> A few notes: Please simplify the expression in updateSelection(). 
Done (although the original expression was way more fun)
> The nested
> loops in run() seem a bit complicated. Try building a set of repositories first,
> then iterate over all queries and tasks once and add the elements that need to
> be deleted to a list. 
Done.*  Note: This is how the function was originally written.  Generally, should I refactor code when submitting patches?  I had shied away from this, as I didn't want to make any major changes to existing code, which could obviously cause problems.  What's the policy you follow in this type of situation?
> Executing the deletion in the progress monitor will not
> work well unless you call Display.readAndDispatch() to update the UI.
> IProgressService.busyCursorWhile() could work better in this case, even though
> it doesn't provide cancellation support. Generally monitor.beginTask() should
> always be followed by monitor.done():
Done (used progressservice, do I need to also call Display.readAndDispatch in this case?).
> You should never call PlatformUI.getWorkbench().getActiveWorkbenchWindow()...
Done.
Comment 11 David Shepherd CLA 2009-01-30 12:24:43 EST
Created attachment 124300 [details]
fixed according to comments
Comment 12 David Shepherd CLA 2009-01-30 12:24:46 EST
Created attachment 124301 [details]
mylyn/context/zip
Comment 13 David Shepherd CLA 2009-01-30 12:30:12 EST
Created attachment 124305 [details]
fixed a updateSelection problem
Comment 14 David Shepherd CLA 2009-01-30 12:30:15 EST
Created attachment 124306 [details]
mylyn/context/zip
Comment 15 Steffen Pingel CLA 2009-01-31 23:20:13 EST
Created attachment 124367 [details]
updated patch
Comment 16 Steffen Pingel CLA 2009-01-31 23:24:11 EST
I have wrapped the all modifications in an ITaskListRunnable to avoid concurrent changes of the task list while deletion is in progress. Please look into these two cases before I apply the patch:
* If there a no queries or tasks the message should be different, i.e. "Are you sure you want to delete the repository?"
* Unsubmitted tasks for the repository need to be deleted as well.
Comment 17 David Shepherd CLA 2009-02-02 20:13:37 EST
Created attachment 124499 [details]
updated as per your comments
Comment 18 David Shepherd CLA 2009-02-02 20:13:41 EST
Created attachment 124500 [details]
mylyn/context/zip
Comment 19 David Shepherd CLA 2009-02-02 20:14:03 EST
> * If there a no queries or tasks the message should be different, i.e. "Are you
> sure you want to delete the repository?"
Done.
> * Unsubmitted tasks for the repository need to be deleted as well.
Done.
Comment 20 Steffen Pingel CLA 2009-02-03 00:57:13 EST
Patch applied. I have refactored the implementation that executed the deletion of task list elements to also close editors, delete task data and contexts.
Comment 21 Mik Kersten CLA 2009-02-06 10:53:22 EST
(This is an old comment, which I neglected to submit a while back.  Ignore it if it's obsolete.)

In terms of UI, I think we need the delete dialog for a repository to state the following.

------------------------
Delete the "Mumble Frotz" task repository?

This will delete [2000] tasks and [20] queries from your Task List.
------------------------

Other:
* Label needs to be changed to "Delete Repository..."
* Don't support deleting multiple repositories since that complicates the UI, instead disable for more than 1 selection