Geertjan's Blog

  • June 3, 2005

Simple Module to Browse the NetBeans Filesystem

Geertjan Wielenga
Product Manager
Want to browse through all the settings defined in the NetBeans IDE, from inside the IDE? If you do, then this is probably what you're wanting (click to enlarge):

To get this cool view over everything you've defined in the IDE -- as well as default settings provided by the IDE -- you'd need nothing more than an Action class (see previous blog entries on this) that has a performAction() method consisting of the following:

public void performAction() {
ExplorerPanel pnl = new ExplorerPanel();
BeanTreeView btv = new BeanTreeView();
pnl.setLayout(new BorderLayout());
pnl.add(btv, BorderLayout.CENTER);
try {
FileObject root = Repository.getDefault().getDefaultFileSystem().getRoot();
DataObject rootDataObject = DataObject.find(root);
Node rootNode = rootDataObject.getNodeDelegate();
} catch (DataObjectNotFoundException dnfe) {
throw new IllegalStateException(dnfe.getMessage());
pnl.setDisplayName("SFS Browser");

That's it (apart from the layer.xml with Menu entry, manifest.mf, and Ant scripts for building the module). And now you've got a graphical view over everything in your user directory, as well as some things you won't find in there. The relationship between the layer.xml and the content of the filesystem is that you use the layer.xml to extend the filesystem. So when you add a Menu entry to the layer.xml, it gets added to the NetBeans filesystem, and you'll be able to browse it in your user directory or in the graphical browser that's produced by means of the above performAction() method.

Join the discussion

Comments ( 1 )
  • Michel Graciano Monday, July 18, 2005
    I have a doubt about this behavior. How work the ExplorerManager.Provider interface implementation? This doubt is because I studing NetBeans Plugin Development, and I see it´s work, but I don´t see any documentation describing this behavior, justi saying that its work.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.