X

Geertjan's Blog

  • November 14, 2014

Bug Fixes and Enhancements for NetBeans Cheat Sheets

Geertjan Wielenga
Product Manager

I fixed several problems in the Cheat Sheets plugin and added a cool new feature.

  1. Installation problem. Several people weren't able to install the plugin in the first place, or didn't see the two new windows provided by the plugin when they thought they had installed it. That's because the plugin was built with all the patches for 8.0.1 included, which meant that one of the NetBeans modules used in the plugin was at a higher level than what you'd have in 8.0.1 if you hadn't updated it, i.e., to patch 1.1. I discovered that the problematic module (the Datasystems API) wasn't needed in any case, so removed that module from the dependency list. Now the plugin should install successfully if you're using 8.0.1 without any of the patches installed.

  2. Parsing problem 1. Several people were able to install the plugin but didn't see anything in the two windows provided by the plugin. That's because the parser attempts to validate and resolve any references in the document, automatically, including "netbeans.org". When you're using the plugin while not on-line or behind a proxy, the automatic resolver fails and the plugin crashes. I was able to reproduce this problem and, following the instructions here, I fixed the problem, and now even when I am not on-line, the plugin works, because the automatic resolution is disabled.

  3. Parsing problem 2. The PHP and HTML code templates files weren't parsed correctly, so that only the left-hand side of the Code Templates window was shown, not the right-hand side. That's fixed now.

  4. Context-sensitivity enhancement. I was demonstrating the plugin during Devoxx to my ex-colleague (and current Red Hatter) Cojan van Ballegooijen (and we encountered parsing problem 1 several times), who suggested the following new feature: "Whenever a document of a certain type is opened, the Code Templates window should automatically switch to the relevant set of code templates." That's a cool idea and thanks to the Lookup (i.e., in the TopComponent, listen to the Lookup for the current FileObject in the global context, check for its MIME type, and then switch the code templates accordingly).

Below you can see the point, i.e., now an HTML file is open and hence automatically the Code Templates window shows the code templates specific to HTML files.

From the above, you can also see that the plugin hasn't only been tried successfully on Windows, but on Ubuntu too.

Right now, code templates for PHP, HTML, Java, and XML are supported. A next feature could be support for more code template files, as well as an automatic update of the windows when the key bindings or code templates are changed in the Options window, because right now any changes you make will not be reflected, whether you restart or not. That's because changes to the settings shown above are done in different files to the ones that the plugin listens to, at the moment. So the next enhancement will be to listen to changes to the file where changes to these settings are stored.

If you'd like to try out these changes, go to the plugin's location in the Plugin Portal below, download the NBM, install it into NetBeans IDE 8.0.1 (you should notice in the Plugin Manager that the version of the plugin is 4.0), and then (after a moment, while the plugin installs) you should see your new windows appear, which are also openable under the Window menu, where you should see "Code Templates" and "Key Bindings" menu items.

http://plugins.netbeans.org/plugin/49660/netbeans-cheat-sheets

Join the discussion

Comments ( 2 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha