Community
Participate
Working Groups
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.
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?
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.
I have to be able to drap query out from the Eclipse, therefore I should expect that only FileTranser will work out, unfortunately.
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.
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.
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.
Overwriting won't be an issue if you'll use File.createTempFile()
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?
Created attachment 75159 [details] mylyn/context/zip
I wonder if we should remove context dragging and always zip up context data with the task, so it will be self contained...
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.
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.
Created attachment 75225 [details] mylyn/context/zip
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
What's left on this?
(In reply to comment #15) > What's left on this? > only redundant QueryHits in the exported xml file, I suppose.
Please make a new bug for that, core work is done.