This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
For the next release, all (or most) web application-related project types will contain UI for switching the target browser in project properties: - HTML5 Project - Java Web Ant Project - Java Web Maven Project - PHP project With the exception of HTML5 project, this UI is only in project properties, and is not easily discoverable. This makes it less convenient to test web applications with various browsers, and to use the JavaScript debugging features available with Chrome and Embedded WebKit browser. To improve discoverability and allow convenient switching of browsers, it would be useful to present the UI for switching browsers in a more prominent location, e.g. in the IDE toolbar. At the same time, the UI should not take up too much screen estate. So I suggest the following UI: - Icon button representing the browser + down arrow that activates the menu (similar to e.g. the Debug button) - The menu will contain the list of registered browsers (icon + textual description) - The UI will be project-sensitive, i.e. the selected browser will match the browser that's selected in the project properties of the activated project (similarly to the project configurations combo box) - If the activated project does not support browser selection (e.g. Java SE project or C++ project), the browser selection button will be grayed out - This toolbar button will not be present at all in NetBeans distributions that do not contain web development features (Java SE and C++) As a follow-up step, we can consider deemphasizing or removing the concept of project configurations in HTML5 projects, as this UI would to a large extent replace the HTML5 project configurations concept (with the possible exception of PhoneGap build).
I just discussed this with Honza Becicka, cc'ing. One point that Honza made is that in the future, for a few more browsers (besides Chrome) we may want to have two modes - with NetBeans integration (debug) and without NetBeans integration (non-debug). Namely, targets "Android Device", "Android Emulator", "iPhone Device" and "iPhone Simulator" may all have these two variants - which would make the list very long and harder to use. We were thinking how to get around this - one idea is to use the "Run" and "Debug" action distinction, i.e. Run action would launch the browser without NB integration, Debug action would launch it with NB integration. But this has disadvantages that: - It makes NetBeans integration harder to discover, some people will always hit run and will not know that Debug will give them more features - While this association makes some sense for JavaScript debugging, it does not really make sense for visual CSS styling: how would I know that I need to "Debug" if I want to use the visual style editor? - For (Java, PHP) web projects, Debug action already has the semantics of "server-side debugging", so adding more meaning to this action could create more confusion. Also, we would face questions like what if I want to debug the server side, but not the client side, or vice versa? So I would suggest the following solution instead: The drop-down menu associated with the browser selection button would have an extra checkbox (2-state item) called something like "NetBeans integration". Then each browser would appear in the menu only once, and depending on the state of the NetBeans integration item, the browser would be run in debug mode or not. So the menu would look e.g. like this: [ ] NetBeans Integration -------------------- Chrome Safari Firefox External Browser (command line) Android Device Android Emulator iPhone Simulator -------------------- Customize... The corresponding change would need to be made in project properties of all the relevant project types.
One other thing - the state of the NetBeans Integration checkbox could be communicated to the user in the toolbar icon via a badge - i.e. if NB integration is enabled, the browser icon in the toolbar would be badged with the NetBeans cube. What do you think?
Sounds good to me. The only problem I see is that it seems that we have NB integration for all browsers in the list - or not? We should somehow tell user which browsers have NB integration. Thanks.
I'm going to attach two patches: * one with API changes * second with mainly implementation changes The patches implement browser combo box requested by this issue and changes to Web Project and HTML5 project. Nothing was done for PHP project and it will need to be fixed before I can push this change - should be small change. Changes in HTML5 were drastic in area of org.netbeans.modules.web.clientproject.spi.platform package and handling of project configurations. I patched the cordova modules just so that they compile but they will require some work to be done to avoid regression in current functionality. Tomas, Honza, could you review please? You should be able to apply the patches and build your modules and see how it works. Honza, regarding "org.netbeans.modules.web.clientproject.spi.platform" package: I got rid of everything "project configuration" specific; I renamed existing classes to differentiate them from the old ones but new names are pretty long - ClientProjectEnhancedBrowserImplementation. Any suggestions are welcome. Before everything revolved around Project Configuration and now it is "WebBrowser" (see WebBrowser.getBrowserFamilyId). ClientProjectEnhancedBrowserImplementation.getProjectConfigurationProvider is the only addition and allows you to return different configurations per browser type. I tested it and it works quite well - configurations combo gets enabled/disabled as you change browsers depending on if they have configurations or not. There is an small API change for openide.awt to show drop down button as a single button without that line separator between drop down arrow and button itself. I will file it separately once we agreed above patches are OK. Thanks for any comments.
Created attachment 132235 [details] API patch
Created attachment 132236 [details] implementation modules patch
I am not able to apply the 2nd patch against the current trunk [1]. Thanks. [1] patching file cordova/src/org/netbeans/modules/cordova/project/ClientProjectConfigurationImpl.java Hunk #1 FAILED at 49 Hunk #2 FAILED at 60 Hunk #3 FAILED at 70 Hunk #4 FAILED at 79 Hunk #5 FAILED at 131 Hunk #6 FAILED at 141 Hunk #7 FAILED at 155 Hunk #8 succeeded at 110 with fuzz 1 (offset -76 lines). 7 out of 8 hunks FAILED -- saving rejects to file cordova/src/org/netbeans/modules/cordova/project/ClientProjectConfigurationImpl.java.rej
> Nothing was done for PHP project and it will need to be fixed Not sure if some changes will also need to be done for Maven project, cc'ing Martin J.
I created branch browser_toolbar_selector and put the change there. Let's use it to finish this feature.
(In reply to comment #9) > I created branch browser_toolbar_selector and put the change there. Let's use > it to finish this feature. build failed in php.project module...
I think the hotfix is to add a second 'true' parameter in CustomizerBrowser:70: browserModel = WebBrowserSupport.createBrowserModel(uiProps.getBrowserId(), true);
(In reply to comment #11) > I think the hotfix is to add a second 'true' parameter in CustomizerBrowser:70: > > browserModel = > WebBrowserSupport.createBrowserModel(uiProps.getBrowserId(), true); Yes. Or build only javaee cluster as I do.
If I understand it well, the phonegap module is required to provide ClientProjectEnhancedBrowserProvider, right? How should phonegap module provide icons and display names for Android, iOS and PhoneGap browsers? Thanks
(In reply to comment #13) > If I understand it well, the phonegap module is required to provide > ClientProjectEnhancedBrowserProvider, right? ClientProjectEnhancedBrowserProvider is a way to hook your browser into ClientSide project's ActionProvider, customizer, etc. In order to use ClientProjectEnhancedBrowserProvider you will first need to be able to create WebBrowser for your phonegap browsers. > How should phonegap module provide icons and display names for Android, iOS and > PhoneGap browsers? Yeah, I knew this will need to be enhanced. Done in changeset: 247723:754ce9ec9958 branch: browser_toolbar_selector tag: tip user: David Konecny <dkonecny@netbeans.org> date: Mon Mar 11 11:52:16 2013 +1300 summary: making browser icon and display name configurable via browser factory Basically your browser factory must implement org.openide.awt.HtmlBrowser.Factory and org.netbeans.modules.web.browser.spi.EnhancedBrowserFactory. Please let me know if something else is missing. Or if you would prefer to change some APIs completely. Or just change it yourself. Thanks. I also fixed the PHP project: changeset: 247722:c84097b69fe0 branch: browser_toolbar_selector parent: 247558:a909f51206a9 user: David Konecny <dkonecny@netbeans.org> date: Mon Mar 11 11:49:53 2013 +1300 summary: fixing broken build
As we discussed offline, current impl is not yet sufficient. I created 2 dummy browsers to test API: Cordova browser and Android Browser. They did not do any real browsing, but I'm still not able to plug them correctly into the UI. David, I'd like to ask you to register these 2 for me. Thanks changeset: 248296:9e65f6c1c6dc branch: browser_toolbar_selector tag: tip user: Jan Becicka <jbecicka@netbeans.org> date: Wed Mar 20 13:39:17 2013 +0100 summary: Dummy implementation of android and phonegap browser
Done: 5495b2a0bd9f
Thanks David, I work on an implementation: changeset : 248641:b5f65da23253 branch : browser_toolbar_selector tags : tip author : Jan Becicka <jbecicka@netbeans.org> date : Thu Mar 21 16:56:19 CET 2013 summary : Browser switcher - Android Rewrite Now I have problem with multiple instances of android browser. I cannot select the first one in the UI. The problem probably is, that there are 2 instances of WebBrowser with the very same "id". Both instances of WebBrowser returns "ANDROID" from getId(). Probably we need to introduce new method "getId" in EnhancedBrowserFactory ? public interface EnhancedBrowserFactory { BrowserFamilyId getBrowserFamilyId(); Image getIconImage(); String getDisplayName(); + String getId(); }
(In reply to comment #17) > Both instances of WebBrowser returns "ANDROID" from getId(). > > public interface EnhancedBrowserFactory { > + String getId(); > } Yeah, I left a comment in the code that this might be needed. Existing browsers get their ID because they are registered in default filesystem as a Settings file and ID is the filename. I considered the same approach for Services/MobileBrowsers but it too much "registration work" so I wanted to make it easier for you. I will add getId() today.
Done: 3cd5ffbd1d68 and fcd96e9f71c5
Now PhoneGap works - let say - the same way like before changeset : 248747:6c4eb4dd5cbd branch : browser_toolbar_selector author : Jan Becicka <jbecicka@netbeans.org> date : Fri Mar 22 11:17:34 CET 2013 summary : Browser switcher - iOS and Android Rewrite From my point of view I think, that this branch can be merged to trunk and continue there...
Thanks a lot Honza and David - most scenarios now work fine for me. > I think, that this branch can be merged to trunk and continue there... The remaining things that I am aware of are: - PhoneGap application deployment to iOS Simulator does not work for me, but I am not sure if I am doing something wrong - I just filed bug 227824 related to some remaining UI issues - The browser switcher combo box is not integrated with Maven web projects - Mobile browsers are not visible in the combo box for Java web/PHP projects (enhancement 225836) Not sure how easy these will be to resolve. If they may require some substantial changes, then I think we should make these substantial changes on the branch. If not, then I agree we can merge to trunk and continue there.
> The remaining things that I am aware of are: > - PhoneGap application deployment to iOS Simulator does not work for me, but I issue 227820? if not please file a new one. Probably not related to this changes. > - Mobile browsers are not visible in the combo box for Java web/PHP projects > (enhancement 225836) should be easily fixed. just need to do proper registration.
> > - PhoneGap application deployment to iOS Simulator does not work for me, but I > issue 227820? > if not please file a new one. Probably not related to this changes. No, it was different (build succeeded, simulator was launched, but it only showed black screen), but after resetting the simulator everything works fine now.
Branch merged to default
Browser switcher seems to be disabled for PHP projects (gray icon & unclickable). Is it supposed to work already with PHP? Product Version: NetBeans IDE Dev (Build web-main-10182-on-20130327)
Same for me. I also thought this was supposed to work. Tomas, do you know what needs to be done?
No, I don't work on the branch at all.
Integrated into 'main-golden', will be available in build *201303272300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/4e2b6b6b3384 User: David Konecny <dkonecny@netbeans.org> Log: #226124 - UI for switching the project's target browser in the toolbar initial work to implement this feature; see the issue for more details
The issue with PHP project seems to be a bit random, restarting IDE sometimes helps. Also if you're creating new PHP file, you can see that browser icon changes for a second from e.g. Chrome with NB to the gray ("disabled") icon
(In reply to comment #29) > The issue with PHP project seems to be a bit random, restarting IDE sometimes > helps. Also if you're creating new PHP file, you can see that browser icon > changes for a second from e.g. Chrome with NB to the gray ("disabled") icon Tomas, have a look at org.netbeans.modules.web.clientproject.browser.ActiveBrowserAction - the action is sensitive to content of lookup of selected node. The code was copied from MainProjectAction. Perhaps some nodes in PHP project are missing FO/DO in their lookup??
(In reply to comment #30) > Perhaps some nodes in PHP project are missing FO/DO in their lookup?? Well, I am not expert in nodes but I think that in PHP, we use FileObject everywhere (I remember that there were performance problems with DataObjects so FileObjects should be used as much as possible). OTOH, why does ActiveBrowserAction use DataObjects at all? Just for finding project via its FileObject? I can be wrong, but it seems to me that FileObject should be enough... Thanks.
As I said the body of ActiveBrowserAction was mostly copied from the existing MainProject action assuming the action worked well in the past in the PHP context. Feel free to enhance the ActiveBrowserAction in any way you want.
(In reply to comment #32) > As I said the body of ActiveBrowserAction was mostly copied from the existing > MainProject action assuming the action worked well in the past in the PHP > context. Not exact - we have never used Main project functionality in PHP. > Feel free to enhance the ActiveBrowserAction in any way you want. I will do it. Thanks.
(In reply to comment #32) > Feel free to enhance the ActiveBrowserAction in any way you want. http://hg.netbeans.org/web-main/rev/e167e619811b