/jEdit/tags/jedit-4-1-pre5/bsh/commands/browseClass.bsh
Unknown | 40 lines | 32 code | 8 blank | 0 comment | 0 complexity | 778e20269eb6e1b45820c44473be720d MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
- /**
- Open the class browser to view the specified class.
- If the argument is a string it is considered to be a class name.
- If the argument is an object, the class of the object is used.
- If the arg is a class, the class is used.
- <p>
- Note: To browse the String class you can't supply a String.
- You'd have to do: browseClass( String.class );
- <p>
- @method void browseClass( String | Object | Class )
- */
- import bsh.Name;
- browseClass( Object o ) {
- if ( o instanceof String)
- classname = o;
- else if ( o instanceof Name.ClassIdentifier )
- clasname = this.namespace.identifierToClass(o).getName();
- else if ( o instanceof Class )
- classname = o.getName();
- else
- classname = o.getClass().getName();
- // really need a way to unset and more poweful testing...
- if ( bsh.system.desktop == void
- || bsh.system.desktop.classbrowser == void
- || bsh.system.desktop.classbrowser == null ) {
- browser = classBrowser();
- } else {
- browser = bsh.system.desktop.classbrowser;
- bsh.system.desktop.classbrowser.toFront();
- }
- browser.driveToClass( classname );
- }