Simple Module to Browse the NetBeans Filesystem

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();
     pnl.getExplorerManager().setRootContext(rootNode);
  } catch (DataObjectNotFoundException dnfe) {
     throw new IllegalStateException(dnfe.getMessage());
  }
  pnl.setDisplayName("SFS Browser");
  pnl.setName("SFS");
  pnl.open();
  pnl.requestActive();
}

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.

Comments:

Hi, 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.

Thanks!

Posted by Michel Graciano on July 18, 2005 at 11:16 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today