taT | Play with XML Layer


As I mentioned in my previous entry, that I am starting with a new blog series. This is it- Part One, of Blog Series: XML Layer! Hope you would enjoy, following it. Anyways, coming back to the point. Let me share with you another trick, which I was observing for few weeks, and its really cool! Its based on NetBeans Platform. This is my first full-fledged post on NetBeans Platform, as I’m dealing with it almost daily for over a week, for some cool plugin development.


This trick makes use of the existing tutorial, which is the base on which I have carried out the trick. Also, you must read this tutorial, if you don’t have prior experience with NetBeans Platform. Hey, give this a read as well,

This overview will quickly familiarize you with how NetBeans plug-in modules interact with the NetBeans infrastructure and with each other.

Problem Description

As mentioned in the tutorial, I created an Action Type (CallableSystemAction), made it a Global MenuItem and Toolbar Button. I named the Action Type (Java file) as SayCheez, and display Name as Say Cheez…

Now, I have made this action, as expected in the tutorial. Now, right-click Project & click on Install/Reload in Target Platform in the context-sensitive popup menu (context-menu). Its running successfully!

Now, let me show you the structure of XML Layer (layer.xml), its similar to the one shown in the tutorial, i.e. how it registers the action into the NetBeans IDE. See this image;

So, the trick is how to play with the Layer and don’t waste time, placing actions anywhere else in the IDE, by recreating them.


Note, all the following tricks would work for CallableSystemAction only, I have not tested for CookieAction, though it should work for CookieAction as well, if you are working with only MenuItem, Toolbar Button OR Shortcut Keys! For Editor and File Type Context MenuItem, there would be some other way round, I will see if its comfortable playing with them as well 😉

By Code Deduction

Trick #1- If you want to remove either one of the separators, OR even both of them, then see the following image, the code present in that remove it from the XML Layer, as per your need.

Trick #2 – If you want to remove the Action, from Toolbar, then remove the following code;

Trick #3 – If you want to remove the Action from Tools Menu, and retain it only on the Toolbar, then remove the following code;

By Code Replacement

Trick #4 – If you want to make a Shortcut key for this action, add the following code,

Trick #5 – Sometimes, it might happen, that your action is not suitable for any existing Menu, and you are looking to create your own Menu. By the time, you get ready with your Menu, you can just have this Shortcut Keys alone, i.e. no Menu Item, no Toolbar Button.

Tips to remember

This code has a shortcut key “Alt+F3”, which is represented as “O-F3.shadow”, so this means, if you have some key combination, that uses “Alt”, then use “O”, and for each “+” sign use “-“ ,finally concatenate with the just formed combination with “.shadow”! If you use “Ctrl”, then use “D” and for “Shift”, use “S”!

Following are some key equivalents used in XML Layer;

  1. A to Z (as it is), F1 to F12 (as it is), 0 to 9 (as it is)
  2. / as SLASH, as BACK_SLASH
  3. ; as SEMI_COLON
  4. . as PERIOD
  5. as QUOTE

These were some of the frequently used keys in Shortcut Key combination, if you want to know some more, you can post a comment over here. I would be glad to help you out!

Actually, I was developing a module for past one week, and more intensely on the weekend, and have observed this by hit-and-trial, and thought of sharing the trick with you people. By the way, there’s a surprise! Any guesses, well no prizes for guessing!

Its related to the module, I’m working on for past one week.

Playing with XML Layer, reminded me that I have to resume working on XML Hyperlink Module as well 🙂 Anyways, thanks for following, enjoy and have fun! To know more about the surprise, keep an eye on my blog!

Previously Posted on NetBeans Zone
Update on Issue #136216: MySQL Server Node Error

This blog has been contributed to NetBeans Community Docs Program and for latest updates on this content, refer to the contribution.

Add to Technorati Favorites

sTay Tuned for More…


Blog Series | XML Layer


Its been a long time, since I wrote any Tricks, even in my latest interview I was asked, whether I am going to continue contributing OR not! Its been over a month, since I wrote my last trick, that was submitted for Student Views and Reviews – blogging contest.

Results have been postponed by a week!

Recently, I came across something special, that you could do with XML Layer, I am taking Module Writing seriously, nowadays! So, I present to you a blog series, with a mix of tipsAndTricks, Tutorials, Articles!

Its based on the exploration I did on registering Actions in XML Layer. There are two types;

  1. Always Enabled (@see CallableSystemAction)
  2. Conditionally Enabled (@see CookieAction)

I don’t know how many posts this series would last for. Don’t worry, the solution to your problems is here! Just wait and watch…

sTay Tuned…