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.

Bug 253085 - Should have programmatic option to remove Keymap "Show as HTML"
Summary: Should have programmatic option to remove Keymap "Show as HTML"
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Key bindings (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-19 23:03 UTC by tdanard
Modified: 2015-08-05 01:19 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tdanard 2015-06-19 23:03:55 UTC
I have an application based upon the NetBeans platform. When I click the "Show as HTML" button, no browser opens: nothing happens.

I created an empty NetBeans platform-based application from the wizard, and I get the same result. The IDE log shows this error:

INFO [org.netbeans.core.NbURLDisplayer]: showing: nbfs://nbhost/SystemFileSystem/shortcuts.html
java.io.IOException: Failed to open nbfs://nbhost/SystemFileSystem/shortcuts.html. Error message: Access is denied.
	at sun.awt.windows.WDesktopPeer.ShellExecute(WDesktopPeer.java:77)
	at sun.awt.windows.WDesktopPeer.browse(WDesktopPeer.java:70)
	at java.awt.Desktop.browse(Desktop.java:386)
[catch] at org.netbeans.core.NbURLDisplayer$DesktopBrowser$1.setURL(NbURLDisplayer.java:243)
	at org.netbeans.core.NbURLDisplayer$DesktopBrowser$1.reloadDocument(NbURLDisplayer.java:252)
	at org.openide.awt.HtmlBrowser$1URLSetter.run(HtmlBrowser.java:481)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:727)
	at java.awt.EventQueue.access$200(EventQueue.java:103)
	at java.awt.EventQueue$3.run(EventQueue.java:688)
	at java.awt.EventQueue$3.run(EventQueue.java:686)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:697)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)


This button works when I use the same button in the NetBeans IDE itself. Maybe my NetBeans platform application would need to include more modules for this button to work? It might not be the solution: I want to keep the number of NetBeans modules to a minimum.

While the "Show as HTML" is a great option, it should not show if the configuration doesn't allow a correct execution. No matter what, the button should display an error message when an error happens rather than silently ignoring it or just logging the error.

In my case,it would be simpler to not display that button at all than support users who might have configuration issues. A simple way to do this would be to check for the value of KeymapPanel.btnPrintAsHTML.text in the branding. If the value is empty, then don't display that button.
Comment 1 tdanard 2015-07-08 19:11:40 UTC
My workaround has been to add the following modules to my app:

"External Execution API"
"External Execution Implementations"
"External HTML Browser"
Comment 2 Theofanis Oikonomou 2015-07-09 06:59:37 UTC
re-assigning to proper component. Please evaluate. Thank you
Comment 3 tdanard 2015-07-25 15:32:53 UTC
Adding a dependency on "IDE" modules came with their own issues.

The solution I actually ended up using is to make the button invisible using reflection, and plugging my own options controller.
Comment 4 Svata Dedic 2015-08-03 10:44:23 UTC
Enhancement; I slightly improved URL generation, so it could work in your app. If not, you may use 
-J-Dorg.netbeans.modules.options.keymap.ExportShortcutsAction.disable=true 
to remove the button from the dialog layout.

Implemented in jet-main#f2bb697b5054
Comment 5 Quality Engineering 2015-08-05 01:19:17 UTC
Integrated into 'main-silver', will be available in build *201508050002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f2bb697b5054
User: Svata Dedic <sdedic@netbeans.org>
Log: #253085: URL changed to EXTERNAL using URLMapper since external browser is opened anyway. Show as HTML can be disabled by system property