System.out.println("No file specified");
return;
}
ShellManager sm = InitialNaming.lookup(ShellManager.NAME);
TextScreenConsoleManager manager = (TextScreenConsoleManager) sm.getCurrentShell().getConsole().getManager();
TextConsole console = manager.createConsole(
"editor",
(ConsoleManager.CreateOptions.TEXT |
ConsoleManager.CreateOptions.STACKED |
ConsoleManager.CreateOptions.NO_LINE_EDITTING |
ConsoleManager.CreateOptions.NO_SYSTEM_OUT_ERR));
try {
manager.focus(console);
TextEditor te = new TextEditor(console);
File f = new File(argv[0]);
te.ro = argv.length == 2 && "ro".equals(argv[1]);
te.loadFile(f);
} catch (Exception e) {
manager.unregisterConsole(console);
throw e;
}
}