He was an open source enthusiast, an avid blogger of technologies related to, or used with NetBeans IDE. He was also an important member of the NetBeans Community Docs Coordinator (in the past) and NetBeans Dream Team Honorary Member. Currently, working in Infosys Technologies Ltd. on Data Warehousing Projects. He's a passionate programmer and has created various utilities, tools using shell-scripting on Linux environment (since early 2010) at Infosys Hyderabad DC, India. Varun has posted 10 posts at DZone. View Full User Profile

Playing with NetBeans XML Layer Files (Part 1)

  • submit to reddit

I am back with another cool trick and some tips to remember as well. Let me share with you another trick, which I have been making use of for a few weeks, and it is really cool! It is based on the NetBeans Platform, in particular, on the XML layer file, which is a plugin's optional configuration file. This is my first full-fledged post on the NetBeans Platform, as I’m dealing with it almost daily for over a week, for some cool plugin developments.



This trick makes use of an existing tutorial, which is the basis on which I have carried out the trick. Also, you must read this tutorial, if you don’t have any prior experience with NetBeans Platform.

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.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
<folder name="Actions">
<folder name="Tools">
<file name="org-nvarun-tat-SayCheez.instance"/>
<folder name="Menu">
<folder name="Tools">
<file name="org-nvarun-tat-SayCheez.shadow">
<attr name="originalFile" stringvalue="Actions/Tools/org-nvarun-tat-SayCheez.instance"/>
<attr name="position" intvalue="150"/>
<file name="org-nvarun-tat-separatorAfter.instance">
<attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
<attr name="position" intvalue="175"/>
<file name="org-nvarun-tat-separatorBefore.instance">
<attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
<attr name="position" intvalue="125"/>
<folder name="Toolbars">
<folder name="Build">
<file name="org-nvarun-tat-SayCheez.shadow">
<attr name="originalFile" stringvalue="Actions/Tools/org-nvarun-tat-SayCheez.instance"/>
<attr name="position" intvalue="325"/>

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

Your rating: None Average: 5 (2 votes)
Published at DZone with permission of its author, Varun Nischal.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Varun Nischal replied on Thu, 2008/06/26 - 7:56am in response to: Larry Wales


I have added these tricks in Community Docs wiki. You can check it out here-


Glad to help :-)

Mateo Gomez replied on Fri, 2012/06/22 - 3:04am in response to: Varun Nischal

thank you for addin this mexican drinks


Matt Coleman replied on Mon, 2012/07/16 - 5:11am

thanks for the tips...this will help us a lot

buffalo graphic design

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.