Eclipse RCP MessageConsole: How to allow user to i

2019-02-26 11:12发布

I'm writing an eclipse-plugin which creating a new Console. Please see my source code:

IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IConsoleView consoleView = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW);

MessageConsole myConsole = new MessageConsole("CLI", null);
ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { myConsole });
consoleView.display(myConsole);

MessageConsoleStream stream = myConsole.newMessageStream();
stream.println("Hello World");

The Console "CLI" appeared, but it is not editable by user input. I would like to make user can input directly into the Console by typing in the Console.

And I also want to handle the input but any listener or keybinding.

Anyone know can help me?

1条回答
太酷不给撩
2楼-- · 2019-02-26 12:01

Use an IOConsole instead! MessageConsole is basically a read-only version of IOConsole.

From MessageConsole.createPage(...):

public IPageBookViewPage createPage(IConsoleView view) {
    IOConsolePage page = (IOConsolePage) super.createPage(view);
    page.setReadOnly();
    return page;
}
查看更多
登录 后发表回答