private Thread readOut;
- public MiniTerminal(Composite parent, int style) {
+ public MiniTerminal(Composite parent, String url) {
+ this(parent);
+ setPath(url);
+ }
+
+ public MiniTerminal(Composite parent) {
charset = StandardCharsets.UTF_8;
Display display = parent.getDisplay();
// exit
else if (args.get(0).equals("exit")) {
println("logout");
- area.getShell().dispose();
+ exitCalled();
return;
}
process = pb.start();
stdIn = process.getOutputStream();
- readOut = new Thread("MinitTerminal read out") {
+ readOut = new Thread("MiniTerminal read out") {
@Override
public void run() {
running = true;
// area.setCaret(caret);
}
+ protected void exitCalled() {
+
+ }
+
public void setPath(String path) {
this.currentDir = Paths.get(path);
}
Display display = Display.getCurrent() == null ? new Display() : Display.getCurrent();
Shell shell = new Shell(display, SWT.SHELL_TRIM);
- MiniTerminal miniBrowser = new MiniTerminal(shell, SWT.NONE);
String url = args.length > 0 ? args[0] : System.getProperty("user.home");
- miniBrowser.setPath(url);
+ new MiniTerminal(shell, url) {
+
+ @Override
+ protected void exitCalled() {
+ shell.dispose();
+ System.exit(0);
+ }
+ };
shell.open();
shell.setSize(new Point(800, 480));