Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 196683 - support queries importing/exporting by drag&drop
Summary: support queries importing/exporting by drag&drop
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 2000
: P2 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Jevgeni Holodkov CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-16 13:04 EDT by Jevgeni Holodkov CLA
Modified: 2007-10-16 12:59 EDT (History)
1 user (show)

See Also:


Attachments
Queries dragging out support (6.68 KB, patch)
2007-08-01 15:44 EDT, Jevgeni Holodkov CLA
no flags Details | Diff
mylyn/context/zip (9.61 KB, application/octet-stream)
2007-08-01 15:44 EDT, Jevgeni Holodkov CLA
no flags Details
Queries drop support (5.52 KB, patch)
2007-08-02 09:59 EDT, Jevgeni Holodkov CLA
no flags Details | Diff
mylyn/context/zip (10.66 KB, application/octet-stream)
2007-08-02 09:59 EDT, Jevgeni Holodkov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jevgeni Holodkov CLA 2007-07-16 13:04:13 EDT
As requested in Bug 189518, it should be possible to export and import a query by dragging out/exporting it to the file system and importing the query by dropping it back to the task list.
Comment 1 Jevgeni Holodkov CLA 2007-07-26 12:25:04 EDT
I suggest implementing this feature this way:
- When Drag is initiated, then the query file is created in a TaskListDragSourceListener.dragStart method (checks, that event.doit is not false and selected element is a query). I suggest adding a timestamp to the query name to avoid overwriting the currently locked file (for example, a query was dragged out to an FTP server and at that time is copied). By that reason I also cannot delete these  files in the dragFinished, so  I suggest cleaning up a folder with query files on Mylyn startup.
- When Drop is initiated, then the file is read in TaskListDropAdapter.performDrop() using the same API as used in "QueryImportAction".

What do you think about? 
Comment 2 Eugene Kuleshov CLA 2007-07-26 13:46:40 EDT
You can actually register more then one transfer types for given drag and drop targets. So, when drag and drop happening inside Eclipse you don't really need file transfer and could use proprietary transfer type that won't require temporary files, hence no issues with cleaning, as long as this transfer type is registered on the both ends.

Also, for the temporary files you can mark them for deletion using deleteOnExit(), though it will be very only little help.
Comment 3 Jevgeni Holodkov CLA 2007-07-27 02:49:29 EDT
I have to be able to drap query out from the Eclipse, therefore I should expect that only FileTranser will work out, unfortunately.
Comment 4 Mik Kersten CLA 2007-07-27 10:16:10 EDT
Jevgeni, plese do use FileTransfers for the reason you mentioned and the additional ease and compatibility reasons discussed on this week's call.

Regarding cleaning up the files, do the following: File file = File.createTempFile(); file.deleteOnExit();.  Then you don't have to worry about clean-up.  I'm not completely sure that you need the multiple time stamp thing, because the user can only have one drag and drop in progress at a time, and as soon as the drag is done the temp file should get transferred or copied to its actual location/target.
Comment 5 Eugene Kuleshov CLA 2007-07-27 10:26:00 EDT
FileTranser should be one of several transfers and it is a good one to start with. However, when dropping into ECF UI it should be possible to avoid these temporary files and probably also provide additional info without getting into the files. Also, I don't think file would be moved anywhere in most of the cases.
Comment 6 Jevgeni Holodkov CLA 2007-07-27 11:31:10 EDT
deleteOnExit() will work only if JVM terminates normally, so there still should be a mechanism to delete ghost files. But yes, you are right, I should leave this for next iteration and now implement use deleteOnExit(). 

As to timestamp - if I drag the file out to a my gtalk window and I wait for acceptance of the file, I would like to be able to drag another query out. I may want to edit it (for example, change the "Assigned To") and try to export this query again. In this case, the first one must not be overwritten. Timestamp seems to be an easy solution.
Comment 7 Eugene Kuleshov CLA 2007-07-27 12:24:57 EDT
Overwriting won't be an issue if you'll use File.createTempFile()
Comment 8 Jevgeni Holodkov CLA 2007-08-01 15:44:22 EDT
Created attachment 75158 [details]
Queries dragging out support

Implemention of queries export by dragging them out. The temp files are created on the D&D start for each selected query, so, if many queries are selected, then 1 file will be created for each query.

Also, have fixed the context exporting, so now it is possible to export more than 1 context (the same logic as with queries). Contexts and queries can be dragged out together as well.

I have found, that the default operation for D&D on Windows is MOVE. It means, that if the context is exported, then the original context file is moved and it's not possible to export it again. Should I create for this a separate task or, can I fast fix it in the scope of this task?
Comment 9 Jevgeni Holodkov CLA 2007-08-01 15:44:25 EDT
Created attachment 75159 [details]
mylyn/context/zip
Comment 10 Eugene Kuleshov CLA 2007-08-01 17:53:24 EDT
I wonder if we should remove context dragging and always zip up context data with the task, so it will be self contained...
Comment 11 Jevgeni Holodkov CLA 2007-08-02 09:56:05 EDT
Eugene, yes, you are right, this functionality should be substituted with Task Export/Import, so I won't pay attention to the issue described above.
Comment 12 Jevgeni Holodkov CLA 2007-08-02 09:59:12 EDT
Created attachment 75224 [details]
Queries drop support

Implementation of queries import by dropping files on the TaskList. Queries import will work only if the current selected element is not an AbstractTask. In case of AbstractTask, the context import occurs. It is possible to import many query files at once.
Comment 13 Jevgeni Holodkov CLA 2007-08-02 09:59:15 EDT
Created attachment 75225 [details]
mylyn/context/zip
Comment 14 Robert Elves CLA 2007-08-02 18:28:42 EDT
Patch from comment#8 applied, ip log updated. We need to disallow or at least handle more gracefully the case where a query is dragged onto a task.
 
 (In reply to comment #10)
> I wonder if we should remove context dragging and always zip up context data
> with the task, so it will be self contained...
+1
Comment 15 Mik Kersten CLA 2007-10-11 23:04:35 EDT
What's left on this?
Comment 16 Jevgeni Holodkov CLA 2007-10-14 13:35:02 EDT
(In reply to comment #15)
> What's left on this?
> 

only redundant QueryHits in the exported xml file, I suppose.
Comment 17 Mik Kersten CLA 2007-10-16 12:59:24 EDT
Please make a new bug for that, core work is done.