Bug 249021 - OpenTaskAttachmentXXXHandlers do not work for stream based attachments, only for URL based
Summary: OpenTaskAttachmentXXXHandlers do not work for stream based attachments, only...
Status: RESOLVED WONTFIX
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P5 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Steffen Pingel CLA
QA Contact:
URL: http://wiki.eclipse.org/Mylyn/Incubat...
Whiteboard:
Keywords:
Depends on: 220314
Blocks:
  Show dependency tree
 
Reported: 2008-09-29 15:11 EDT by maarten meijer CLA
Modified: 2009-01-23 15:17 EST (History)
3 users (show)

See Also:


Attachments
mylyn/context/zip (922 bytes, application/octet-stream)
2008-09-29 15:12 EDT, maarten meijer CLA
no flags Details
Isn't this what we really want? (42.61 KB, image/png)
2008-10-01 16:14 EDT, maarten meijer CLA
no flags Details
patch that extends browser handler with file:// option (4.33 KB, patch)
2008-10-02 07:51 EDT, maarten meijer CLA
no flags Details | Diff
mylyn/context/zip (9.33 KB, application/octet-stream)
2008-10-02 07:51 EDT, maarten meijer CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description maarten meijer CLA 2008-09-29 15:11:58 EDT
For the Generic SQL Connector with reference implementation in Derby we store all task artifacts in SQL tables.		
This means that an attachment such as a screen shot is stored in an sql BLOB field. We can store and retrieve allright but double clicking and opening in Default editor mostly fail.

We store file name and mime type, so enough info is available to select a default editor on double click, but the open in Browser handler get the double click action, even when no URL is specified. 

I propose we change these handlers so that when no URL is specified but the mime type is openable by browser , the blob data is downloaded from the DB and stored in a TEMP location and opened with a file:// URL instead.
This will give rapid double click access to screenshots. When the attachment is java, or zip we handle it differently.
Comment 1 maarten meijer CLA 2008-09-29 15:12:50 EDT
Created attachment 113796 [details]
mylyn/context/zip
Comment 2 Steffen Pingel CLA 2008-09-29 16:48:02 EDT
Maarten, does the current implementation of "Open With > Default Editor" always work for the generic web connector? If that is the case it could be a good argument to make that the default action.

It certainly would make sense to not show "Open With Browser" if no url is set. Would you be interested in providing a patch for that?
Comment 3 maarten meijer CLA 2008-10-01 16:14:32 EDT
Created attachment 114038 [details]
Isn't this what we really want?

Instead of just Default Editor, why not reuse the Open with... menu options also found in the package explorer.
Comment 4 Steffen Pingel CLA 2008-10-01 16:24:23 EDT
Yes, that would be even better.
Comment 5 maarten meijer CLA 2008-10-02 07:51:41 EDT
Created attachment 114090 [details]
patch that extends browser handler with file:// option

When the attchment is not accessible as a URL, but does contain a file name, a local temporary copyis created and opened with a file URL.
It resolves te display screendumps in a non-url (BLOB) based attachment store.
Comment 6 maarten meijer CLA 2008-10-02 07:51:45 EDT
Created attachment 114091 [details]
mylyn/context/zip
Comment 7 maarten meijer CLA 2008-10-02 08:04:28 EDT
Bugs 249463  and some others would give reason to believe that  you cannot specify an (default) editor for an external file, this precludes downloading to /temp/ and opening an editor (vs a browser) from there.

Bug 230865 being fixed, that should no longer be a problem.
But to use proper content scanning, I understand the attachment repository should be an IFileStore.
Also I think that attachments to bugs are usually read only, so how does that match with the Open in Default Editor behavior now?
Comment 8 Steffen Pingel CLA 2008-10-27 16:27:12 EDT
The patch looks good Maarten. I am still not sure how to reorganize the menu (bug 220314). I will bring this up on the next conference call and then apply your patch.
Comment 9 Steffen Pingel CLA 2008-10-29 00:08:36 EDT
An important point was raised on today's conference call: If an attachment is implicitly downloaded to a local file it become confusing if a user edits the attachment but local changes are not be saved back to the repository. Therefore it was decided to not support this in the tasks framework. 

To satisfy your use case I would suggest that the generic sql connector contributes a new menu item, e.g. "Save and Open with Browser" to the context menu of the attachment table using the implementation in your patch.

I'll mark this bug as wontfix since support for offline attachments is out of the scope of the project.
Comment 10 maarten meijer CLA 2008-10-29 13:55:08 EDT
(In reply to comment #9)
> To satisfy your use case I would suggest that the generic sql connector
> contributes a new menu item, e.g. "Save and Open with Browser" to the context
> menu of the attachment table using the implementation in your patch.
Can we then make the TaskAttachment object queryable with an IActionFilter implementation for the object:
I propose stuff like hasUrl,hasHttpUrl,  hasMimeType, hasFilename  to disable and enamble various actions
so we would not get the void response with the existing Open in Browser action?
Comment 11 Steffen Pingel CLA 2008-10-29 14:12:16 EDT
You can register a property tester. Here is a an example from the plugin.xml of tasks.ui:

      <propertyTester
            class="org.eclipse.mylyn.internal.tasks.ui.util.TaskAttachmentPropertyTester"
            id="org.eclipse.mylyn.tasks.ui.propertyTester.task.attachment"
            namespace="org.eclipse.mylyn.task.attachment"
            properties="isContext"
            type="org.eclipse.mylyn.tasks.core.ITaskAttachment">
      </propertyTester>
Comment 12 maarten meijer CLA 2008-10-29 15:18:56 EDT
I still think that double click - open browser without URL is a bug so must be patch to tasks.ui and those actions must be enabled based on URL present. Agree?
Comment 13 Steffen Pingel CLA 2008-10-29 15:48:14 EDT
It is planed to remap the double click action to open in default browser (bug 220314). We could consider additional extensibility in the attachment part of the task editor to allow connectors to change the default behavior.