Main.java 文件源码

java
阅读 44 收藏 0 点赞 0 评论 0

项目:incubator-netbeans 作者:
/**
 * If there isn't one bring up a terminal running vi and have it
 * go to the given file and lineno.
 */
static void showInEditor(String file, int lineno) {
    if (file == null)
        return;

    if (editorTerminal == null) {
        Program program = new Command("vi");
        editorTerminal = new Terminal(executor(), termType, program, false, rows, cols);

        editorTerminal.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosed(WindowEvent e) {
                editorTerminal = null;
                currentFile = "";
            }
        });

        injector = new Injector();
        editorTerminal.term().pushStream(injector);

        Thread thread = new Thread(editorTerminal);
        thread.start();

        // Give it some time to come up otherwise it's not receptive
        try {
            Thread.sleep(1000);
        } catch (InterruptedException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    if (!file.equals(currentFile)) {
        injector.inject("" + (char) 27 + ":e " + file + "\r\n");
        currentFile = file;
    }
    injector.inject("" + (char) 27 + lineno + "G");
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号