The Bean Browser facility lets you look at the structure of objects live in the IDE, provided they can be represented as JavaBeans (which many API-related objects can). There are several ways to use the Bean Browser:
TopManager
, giving
you access to many parts of the IDE.
You will also see the lookup helper.
In the Bean Browser, by default nodes just show up as themselves, but they will show extra children. First of all, their regular children are displayed in a special subnode, to separate them from other things. Other subnodes may be displayed, including:
BeanInfo
is simply ignored, and all getter methods are treated as fair game--even if they
are not public methods. Useful for classes which have BeanInfo
which
does not include all the information you might to debug with.
InstanceCookie
will show that instance as a Bean.
Node
properties will appear as themselves, after an introduction.
Container
properties (i.e. visual beans) will show the AWT
component hierarchy.
FileSystem
properties additionally display the root folder.
This lets you browse to a specific file in the file system.
FileObject
properties additionally display the data object
(from which you can also see the node delegate). And you get a list of file
attributes by name.
Clipboard
objects show the objects associated
with each currently supported data flavor in their
transferables. Go to TopManager.clipboard
for
example. Also ExClipboard
objects will update this
information when it changes, and MultiTransferObject
objects are broken apart into constituent flavors.
Places
(from the TopManager and Places APIs)
will show the corresponding places, both folders and nodes.
getCookie
method (such as nodes, data objects, and so on)
will be examined for a list of all standard cookie types, and these cookies will be shown
in a separate sublist for examination. It is possible to recognize your own cookie types, too;
if your module defines a cookie you wish to see listed, simply add an XML file to its layer
underneath Services/Hidden/ matching the DTD at
http://www.netbeans.org/dtds/apisupport-cookie-class-list-1_0.dtd.
Here is an example of what you can do with the Browser:
File
.
Phile
. IDE menu bar should change.
Remember to look at tool tips on the nodes, and have fun browsing the IDE!
Associated with the Bean Browser is a special utility action to help you see information about nodes and understand cloning, the node hierarchy, and visualizers. If you select any node, the tools action Explore node... will be enabled, and will have several subitems you can choose; each will open a new Explorer window:
Node.cloneNode
and
displays the result. So you can see if your cloning technique works correctly.
Additionally, this action is presented in the context menu of every Bean Browser node which represents a real node (i.e. every "wrapper"). If you select it on a Bean Browser wrapper node, the real underlying node is used instead, which is occasionally useful.
Under Runtime | Bean Browser | Lookup results you can find out what is currently in the lookup system. Right click on this node and select Add Superclass/interface. You will be asked for a class name. Type in the fully qualified name of any class in the APIs or modules, for example org.openide.filesystems.MIMEResolver or org.openide.awt.HtmlBrowser$Factory.
Now browse underneath the lookup node and you will see all instances of that class registered in the system's default lookup. Each instance can be explored using the Bean Browser. Also the tooltip for an instance gives you the lookup item ID (for example, the name of the data object with which an instance was registered). If the contents of lookup change (e.g. because of module installation), the result node will be refreshed.
To help you understand how the property editor for java.lang.Object
works that is part of the UI of services, the lookup node also has a property
using this property editor restricted to the class you are looking up. Its pulldown
shows the user-oriented displays of the available instances, and its custom property
editor permits you to select one from a tree view of services.