PageRenderTime 53ms CodeModel.GetById 49ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-0-pre3/org/gjt/sp/jedit/jedit.bsh

#
Unknown | 62 lines | 53 code | 9 blank | 0 comment | 0 complexity | b92178890dde7bd4ce69d899740418c7 MD5 | raw file
 1/* This script is run on jEdit startup. It should be short and simple for
 2 * performance reasons. */
 3
 4// We use the '__cruft' scripted object to store various junk.
 5__cruft = object();
 6
 7/* By default, BeanShell imports the following packages:
 8
 9   - javax.swing.event
10   - javax.swing
11   - java.awt.event
12   - java.awt
13   - java.net
14   - java.util
15   - java.io
16   - java.lang
17
18   In addition to the above, we import jEdit's packages for convinience. */
19
20import org.gjt.sp.jedit.*;
21import org.gjt.sp.jedit.browser.*;
22import org.gjt.sp.jedit.gui.*;
23import org.gjt.sp.jedit.io.*;
24import org.gjt.sp.jedit.msg.*; // not useful in macros?
25import org.gjt.sp.jedit.options.*; // ditto?
26import org.gjt.sp.jedit.pluginmgr.*;
27import org.gjt.sp.jedit.search.*;
28import org.gjt.sp.jedit.syntax.*;
29import org.gjt.sp.jedit.textarea.*;
30import org.gjt.sp.util.*;
31
32/* This function prints the specified object to the current console if one
33 * exists; otherwise, to the activity log. */
34print(arg)
35{
36	if(arg == null)
37		arg = "null";
38
39	if(arg instanceof Object[])
40	{
41		len = arg.length;
42		print("Array: "+arg +" {");
43		for(int i=0; i< len; i++ )
44		{
45			print(arg[i]);
46		}
47		print("}");
48	}
49	else
50	{
51		if(output != null)
52			output.print(null,String.valueOf(arg));
53		else
54			Log.log(Log.WARNING,BeanShell.class,String.valueOf(arg));
55	}
56}
57
58bsh.help.print = "usage: print ( arg )";
59
60// Print a message once BeanShell initialization is complete
61Log.log(Log.DEBUG,BeanShell.class,"BeanShell interpreter version "
62	+ this.interpreter.VERSION);