Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333461 - [actions] Javadoc view: "Open Attached Javadoc in External Browser" should open URL
Summary: [actions] Javadoc view: "Open Attached Javadoc in External Browser" should op...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.3 M7   Edit
Assignee: Martin Mathew CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-04 06:40 EST by Markus Keller CLA
Modified: 2013-04-23 02:59 EDT (History)
1 user (show)

See Also:


Attachments
Patch. (554 bytes, patch)
2013-04-23 01:14 EDT, Martin Mathew CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2011-01-04 06:40:08 EST
N20101221-2000

Show Javadoc of org.eclipse.swt.layout.FormLayout in the Javadoc view. Scroll down and click the link "Sample code and further information". This shows the linked URL in the Javadoc view. But now, I have no way to open the shown page in an external browser. I see 2 solutions (preferring A):

A) When the Javadoc view shows an URL, rename the button / context menu action to "Open in External Browser" and then open the URL.

B) Never show a linked page in the Javadoc view, but always open an external browser (like the Javadoc hover).
Comment 1 Markus Keller CLA 2012-05-15 05:55:09 EDT
Solution A) would also have to add support for Back/Forward navigation in the Javadoc view when an external page is shown. Currently, there's no way back.
Comment 2 Dani Megert CLA 2013-04-18 09:42:57 EDT
This used to work (e.g. 3.4) but got broken. The code is mostly still in the JavadocView.

Manju, when fixing this, please also fix the enablement of the button (see bug for 405376 details).
Comment 3 Martin Mathew CLA 2013-04-19 01:32:41 EDT
(In reply to comment #2)
> This used to work (e.g. 3.4) but got broken. The code is mostly still in the
> JavadocView.

Yes, this feature was broken during the fix for bug 236850. In JavadocView#handleExternalLink() a new condition was added:
 (fCurrent.getInputElement() instanceof URL && url.toExternalForm().equals(((URL)fCurrent.getInputElement()).toExternalForm()))
If I revert back this condition to the earlier one, then we get the desired result.
Markus, can you tell the consequence of reverting the condition?
Comment 4 Markus Keller CLA 2013-04-22 10:49:26 EDT
(In reply to comment #3)
Good findings!

The change in JavadocView#handleExternalLink() was unrelated to bug 236850. However, it's important that we never call URL#equals(Object), since the default implementation is badly broken (see e.g. bug 286229 comment 0).

Unfortunately, I got the condition wrong. Fixed with http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=74f9735980e7fa9a1c1f1288e79b906146957217
Comment 5 Martin Mathew CLA 2013-04-23 01:14:37 EDT
Created attachment 230002 [details]
Patch.

This bug fix is supposed to take care of enablement of 'Open in Browser' button also. Uploading the patch for that.
Comment 6 Dani Megert CLA 2013-04-23 02:42:01 EDT
(In reply to comment #5)
> Created attachment 230002 [details] [diff]
> Patch.
> 
> This bug fix is supposed to take care of enablement of 'Open in Browser'
> button also. Uploading the patch for that.

The call should be before the 'if', because the 'else' can exit with an exception. Otherwise the fix is OK. Please adjust and commit.
Comment 7 Dani Megert CLA 2013-04-23 02:42:09 EDT
.
Comment 8 Martin Mathew CLA 2013-04-23 02:59:45 EDT
Thanks Dani. Moved the fix before 'if'. Fixed with http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=56a71d2ee66ee21cb47311029b03237f147ab8dd