taT | Play with XML Layer

Hey,

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.

Pre-requisites

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.

Solution

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!

HINT
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…

Advertisements

9 thoughts on “taT | Play with XML Layer

  1. Pingback: taT | Play with XML Layer (Part Two) | 4 « NetBeans Guru

  2. Pingback: NetBeans Zone | Everyone’s Playing « NetBeans Guru

  3. Pingback: 10 Tips and Tricks « N, Varun

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s