PageRenderTime 170ms CodeModel.GetById 168ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-1-pre5/bsh/commands/editor.bsh

#
Unknown | 44 lines | 36 code | 8 blank | 0 comment | 0 complexity | 9c308cb19a57207a591221cc2b0b8699 MD5 | raw file
 1/**
 2	Open a workspace editor.
 3*/
 4
 5bsh.help.editor = "usage: editor()";
 6import java.awt.*;
 7
 8editor() {
 9	if ( bsh.system.desktop != void ) {
10		return workspaceEditor( this.interpreter );
11	}
12
13	ta = new TextArea(15,40);
14	frame = new Frame("Editor");
15	frame.add(ta, "Center");
16
17	p = new Panel();
18	b = new Button("Eval");
19	b.addActionListener(this);
20	p.add(b);
21	b = new Button("Clear");
22	b.addActionListener(this);
23	p.add(b);
24	b = new Button("Close");
25	b.addActionListener(this);
26	p.add(b);
27
28	frame.add(p, "South");
29	frame.pack();
30	frame.show();
31
32	actionPerformed(e) {
33		if ( e.getActionCommand().equals("Close") )
34			frame.dispose();
35		else if ( e.getActionCommand().equals("Clear") )
36			ta.setText("");
37		else
38			this.interpreter.eval( ta.getText() );
39	}
40
41	print("Editor started...");
42	return frame;
43}
44