PageRenderTime 183ms CodeModel.GetById 176ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-3-pre5/bsh/commands/reloadClasses.bsh

#
Unknown | 55 lines | 45 code | 10 blank | 0 comment | 0 complexity | 163987cef91bba94ca0f5edc93128003 MD5 | raw file
 1/**
 2	Reload the specified class, package name, or all classes if no name is 
 3	given.  e.g.
 4	<p>
 5
 6	<pre>
 7    reloadClasses();
 8    reloadClasses("mypackage.*");
 9    reloadClasses(".*")  // reload unpackaged classes
10    reloadClasses("mypackage.MyClass") 
11	</pre>
12	<p>
13
14	See "Class Path Management"
15
16	@method void reloadClasses( [ package name ] )
17*/
18
19bsh.help.reloadClasses= 
20	"usage: reloadClasses( String class | String package | String [] classes )";
21
22import bsh.ClassPathException;
23
24void reloadClasses( item ) 
25{
26	this.bcm = this.caller.namespace.getClassManager();
27
28	try {
29		if ( item instanceof String [] )
30			bcm.reloadClasses( item );
31		else {
32			this.name = item;
33
34			if ( name.endsWith(".*" ) ) {
35				if ( name.equals(".*" ) )
36					this.pack = "<unpackaged>";
37				else
38					this.pack = name.substring( 0, name.length()-2 );
39				
40				bcm.reloadPackage( pack );
41			} else
42				bcm.reloadClasses( new String[] { name } );
43		}
44	} catch ( ClassPathException e ) {
45		error( e.getMessage() );
46	}
47}
48
49/**
50	Reload all classes
51*/
52void reloadClasses() 
53{
54	this.caller.namespace.getClassManager().reloadAllClasses();
55}