PageRenderTime 36ms CodeModel.GetById 31ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 1/**
 2	Open the class browser to view the specified class.  
 3	If the argument is a string it is considered to be a class name.  
 4	If the argument is an object, the class of the object is used.  
 5	If the arg is a class, the class is used.
 6	<p>
 7
 8	Note: To browse the String class you can't supply a String.
 9	You'd have to do:  browseClass( String.class );
10	<p>
11
12
13	@method void browseClass( String | Object | Class )
14*/
15import bsh.Name;
16
17browseClass( Object o ) {
18
19	if ( o instanceof String)
20		classname = o;
21	else if ( o instanceof Name.ClassIdentifier )
22		clasname = this.namespace.identifierToClass(o).getName();
23	else if ( o instanceof Class )
24		classname = o.getName();
25	else 
26		classname = o.getClass().getName();
27
28	// really need a way to unset and more poweful testing...
29	if ( bsh.system.desktop == void 
30			|| bsh.system.desktop.classbrowser == void 
31			|| bsh.system.desktop.classbrowser == null ) {
32		browser = classBrowser();
33	} else {
34		browser = bsh.system.desktop.classbrowser;
35		bsh.system.desktop.classbrowser.toFront();
36	}
37
38	browser.driveToClass( classname );
39}
40