Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 344632

Summary: Show attachment in task editor link opens web page when no attachment pressent
Product: z_Archived Reporter: Sam Davis <sam.davis>
Component: MylynAssignee: Frank Becker <eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: eclipse, robert.elves, steffen.pingel
Version: unspecified   
Target Milestone: 3.6   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
patch V1
none
mylyn/context/zip none

Description Sam Davis CLA 2011-05-03 14:44:02 EDT
Clicking Show attachment in task editor on a link to an attachment in a comment opens the web ui, if there is no attachment on that task (e.g. if the comment was pasted in from a different task). It should either do nothing or display an error message (or else not even be a hyperlink).
Comment 1 Steffen Pingel CLA 2011-05-06 16:12:59 EDT
Frank, if it's not too expensive we could validate if attachment exists when parsing the text.
Comment 2 Frank Becker CLA 2011-05-08 02:33:12 EDT
(In reply to comment #1)
> Frank, if it's not too expensive we could validate if attachment exists when
> parsing the text.

Steffen,

I see no way to check if the attachment is in the task.

BugzillaConectorUI.findHyperlinks has TaskRepository and ITask as parameters but not TaskData.

I see no way that we can get the needed TaskData in an cheap way.

Thoughts?
Comment 3 Steffen Pingel CLA 2011-05-08 05:23:57 EDT
Thanks for checking. In this case we won't be able to suppress the hyperlink and should improve error handling instead.
Comment 4 Frank Becker CLA 2011-05-08 06:22:31 EDT
(In reply to comment #3)
> Thanks for checking. In this case we won't be able to suppress the hyperlink and
> should improve error handling instead.

That we open the the attachment in the web page is the fallback.
Should we bring up an Dialog first so the the user can cancel the action?
Comment 5 Steffen Pingel CLA 2011-05-16 13:24:48 EDT
Makes sense. I suggest something along the lines of "Attachment xyz is not attached to the open bug. Open attachment in web browser?"
Comment 6 Sam Davis CLA 2011-05-16 15:07:00 EDT
We can't know what attachement to show in the web browser, because we don't know where the attachment link was pasted from.
Comment 7 Steffen Pingel CLA 2011-05-16 15:39:33 EDT
Sam, can you post an example? Obviously we have to assume that the link is referring to the current repository unless it's a qualified URL. The same applies tasks or any other relative hyperlink but I'm not sure I understand the concern.
Comment 8 Sam Davis CLA 2011-05-16 15:53:23 EDT
Nevermind, I forgot that the attachment link includes the unique id of the attachment, so opening in the browser works. Here is an example link:

(In reply to comment #6)
> Created attachment 195156 [details]
> framework patch
> 
> Here's the part of the patch for the framework.
Comment 9 Frank Becker CLA 2011-05-16 16:23:44 EDT
Created attachment 195789 [details]
patch V1

can someone verify this so we can include this in 3.6?
Comment 10 Frank Becker CLA 2011-05-16 16:23:47 EDT
Created attachment 195790 [details]
mylyn/context/zip
Comment 11 Steffen Pingel CLA 2011-05-16 16:30:31 EDT
Looks good except for one nit, please replace the call to PlatformUI.getWorkbench().getDisplay().getActiveShell() by WorkbenchUtil.getShell().
Comment 12 Frank Becker CLA 2011-05-17 00:00:23 EDT
patch V1 is now in HEAD with the changes requested in comment#11.