Bug 244047 - [Browser] Extension point schema previews open in internal browser
Summary: [Browser] Extension point schema previews open in internal browser
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: User Assistance (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M3   Edit
Assignee: platform-ua-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-13 12:55 EDT by Markus Keller CLA
Modified: 2022-04-02 13:33 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2008-08-13 12:55:27 EDT
I20080812-0800, was OK in 3.4

Extension point schema previews open in an internal browser, even though I've set Preferences > General > Web Browsing > Use external Web browser.
Comment 1 Markus Keller CLA 2008-10-07 06:23:08 EDT
I find this rather annoying, given that there's no easy way to transfer an internal browser window to an external browser.
Comment 2 Chris Aniszczyk CLA 2008-10-07 10:59:34 EDT
How are you opening the schema Markus? From where?

The preference page?

The editor?
Comment 3 Curtis Windatt CLA 2008-10-07 11:31:04 EDT
One place it happens is if you right click on a extension point element in the schema editor and go to Preview reference document.

In ShowDescriptionAction.showURL() we have an option to force external, but if it is false, we open up a browser using the following line:

IWebBrowser browser = support.createBrowser(IWorkbenchBrowserSupport.AS_EDITOR | IWorkbenchBrowserSupport.STATUS, file.getName(), fPointID, fPointID);

Looking at the browser support code, if you specify IWorkbenchBrowserSupport.AS_EDITOR it always opens in an editor.  If you remove that line, it respects the user preference.  Haven't seen any bad side effects from removing it.
Comment 4 Markus Keller CLA 2008-10-07 11:44:21 EDT
> One place it happens is if you right click on a extension point element in the
> schema editor and go to Preview reference document.

Yes, I see it there, and also in the plu-in manifest editor, when select the ext. pt. name in an extension and choose "Show Description".
Comment 5 Markus Keller CLA 2008-10-07 12:06:58 EDT
(In reply to comment #3)
> Looking at the browser support code, if you specify
> IWorkbenchBrowserSupport.AS_EDITOR it always opens in an editor.  If you remove
> that line, it respects the user preference.  Haven't seen any bad side effects
> from removing it.

I think that's a bug in DefaultBrowserSupport 1.15. Line 104 should read:
    ((style & (AS_EDITOR | AS_VIEW)) != 0 && WebBrowserPreference...

I think Plat/UA should fix this breaking change (from bug 215941).
Comment 6 Markus Keller CLA 2008-10-07 12:21:12 EDT
Actually, I don't understand the reason for
    (style & (AS_EDITOR + AS_VIEW)) == 0 && ...
in HEAD. Line 104 should be restored to:
    WebBrowserPreference.getBrowserChoice() != WebBrowserPreference.INTERNAL

If the user said it should open in an external browser, then the style flags should not matter at all, see contract of org.eclipse.ui.browser.IWorkbenchBrowserSupport.createBrowser(int, ..):
 * <p>
 * If the user has chosen not to use the internal browser or it is not
 * available on the current platform, an external browser will be used and
 * all style parameters will be ignored.
 * </p>

Moving to UA.
Comment 7 Chris Goldthorpe CLA 2008-10-07 13:22:41 EDT
Targeting 3.5
Comment 8 Chris Goldthorpe CLA 2008-10-07 16:57:02 EDT
Here's the history behind the change I made. There is a preference which specifies to use an external editor when opening a browser. There are also three flags which affect where an editor is opened:

/**
* Style constant (value 1&lt;&lt;5) indicating that the internal web
* browser will be hosted in a workbench editor area. This is just a hint -
* implementers of the browser support may not honor it.
*/
int AS_EDITOR = 1 << 5;

/**
* Style constant (value 1&lt;&lt;6) indicating that the internal web
* browser will be hosted in a workbench view. This is just a hint -
* implementers of the browser support may not honor it.
*/
int AS_VIEW = 1 << 6;

/**
* Style constant (value 1&lt;&lt;7) indicating that the external web
* browser must be used even if the implementation supports internal
* browsers and the user didn't set the preference to external browsers.
*/
int AS_EXTERNAL = 1 << 7;

From reading the JavaDoc my feeling was that the flags should have higher priority than the preferences, i.e. if AS_EDITOR is specified then the document will open in an editor (if the OS supports it) regardless of the setting of the preference. Otherwise there is no way to force the document to open in an editor, regardless of the preferences. I thought that no-one would be using the AS_EDITOR flag unless they wanted the document to always open in an editor and that the old (3.4) behavior was incorrect.

Having seen this bug I realize that the documentation does not specify exactly what should happen if you pass in AS_EDITOR, and there are cases where you want it to behave exactly as it did in Eclipse 3.4, where AS_EDITOR means "if the preference is not set to use an external browser open in an editor". Since my reasoning which led me to believe that this change would not break anyone was incorrect I will restore the old behavior, however I still have a need to force the editor to be opened regardless of the use external browser preference. Much as I hate to do this I may have to add yet another flag which is the opposite of AS_EXTERNAL in that it would prevent the external browser from being used.
Comment 9 Chris Goldthorpe CLA 2008-10-09 12:21:39 EDT
Fixed (and without having to add any more flags).