Navigating layer files

If you develop NetBeans modules you must be aware of layer files. The layer files are the NetBeans module system's mechanism for declarative registration of almost all aspects of module's functionality. The overall functionality of a NetBeans Platform based application is derived by merging the layer files contributed by all the modules in the application.

The NetBeans modules can be developed using the NetBeans IDE itself, using the NetBeans module projects. The NetBeans module project's logical view has the following nodes related to the layer file(s) (see the first screen shot below).

  • Important Files/XML Layer/<this layer> - This node's children display the structure of the current modules layer file content.
  • Important Files/XML Layer/<this layer in context> - This node's children display the structure of the merged layer file that will be effective when the module runs inside the NetBeans Platform based application. The layer files of the other modules in the module's suite or the NetBeans platform against which it is being deverloped are used to build this structure.

Sometimes it is desirable to quickly find out which layer file(s) a particular node comes from. Starting with today's (6/2/2007) build there is a context menu action called Open Layer File(s) just for such a pupose (see the screenshot below).

Open Layer File(s) Action

When the Open Layer File(s) action is invoked on a particular node, the layer file(s) which declares that node is opened in the editor window. Please note that a particular node (such as Actions folder) may be declared in more than one file, in which case all the layer files will be opened in the editor window. The layer file may be read-only if it comes from a module's jar file in the NetBeans platform against which this module is being built.

Layer File

In the above screen shot the layer file of the debuggercore module project was opened because the Actions/Debug/New Breakpoint... action is declared by it.

The layer file may be owned by other module's in this modules suite. For modules in the NetBeans workspace the layer file may be owned by other NetBeans modules. In those cases you can use the Select in > Projects action in the layer file editors context menu to quickly open the owner project and select the layer file in it's local view. If that module project is not already open you will be prompted to open it as shown in the screen shot below.

Open Project dialog

I hope this helps you with your NetBeans module development. Enjoy!

Comments:

Wow, fantastic.

Posted by Geertjan on June 02, 2007 at 05:29 AM PDT #

Yup. I find this very useful.

BTW, sources of the action impl are here.

Posted by Sandip on June 03, 2007 at 05:29 AM PDT #

BTW if you have file in a non-open project selected in the editor, you can just use Open Project, and the project's dir will be preselected for you. Works just as well as Ctrl-1 "Select in Project", if you do not actually care about selecting it right now.

Posted by Jesse Glick on June 03, 2007 at 09:10 AM PDT #

Thanks Jesse for the info. I did not know that.

BTW "Select in - Projects" is bound to Ctrl+Shift+1. Ctrl+1 simply shows the Projects Window.

Posted by Sandip on June 04, 2007 at 06:53 AM PDT #

Added the functionality to try to locate the selected node in the layer file using a simple text based search.

Posted by Sandip on June 10, 2007 at 03:26 AM PDT #

Post a Comment:
Comments are closed for this entry.
About

sandipchitale

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today