private void addContainerToTree( Object a,
DefaultMutableTreeNode parent,
XIntrospection xIntrospection ) {
try {
// get the introspection access for the given object
XIntrospectionAccess xIntrospectionAccessObject = xIntrospection.inspect( a );
if ( xIntrospectionAccessObject != null ) {
// get the enumeration access
XEnumerationAccess xEnumerationAccess = ( XEnumerationAccess ) UnoRuntime.queryInterface( XEnumerationAccess.class, xIntrospectionAccessObject.queryAdapter( new Type( XEnumerationAccess.class ) ) );
if ( xEnumerationAccess != null ) {
// get the enumeration
XEnumeration xEnumeration = xEnumerationAccess.createEnumeration();
// create a node for the enumeration category
DefaultMutableTreeNode childEnumeration = new DefaultMutableTreeNode( "Enumeration" );
while ( xEnumeration.hasMoreElements() ) {
// the enumeration has more objects
// get the next object from the enumeration
Object objectElement = xEnumeration.nextElement();
// create a node for the object and add it to enumeration category
DefaultMutableTreeNode childEnumerationElement = new DefaultMutableTreeNode( objectElement.toString() );
childEnumeration.add( childEnumerationElement );
}
if ( childEnumeration.getChildCount() > 0 ) {
// there are some objects so that the enumeration root could be added to the tree
parent.add( childEnumeration );
}
}
// get the index access
XIndexAccess xIndexAccess = ( XIndexAccess ) UnoRuntime.queryInterface( XIndexAccess.class, xIntrospectionAccessObject.queryAdapter( new Type( XIndexAccess.class ) ) );
if ( xIndexAccess != null ) {
// create a node for the index category
DefaultMutableTreeNode childIndex = new DefaultMutableTreeNode( "Index" );