Friday June 03, 2005
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):
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.
Jun 03 2005, 06:04:29 AM PDT Permalink



