Eclipse RCP MessageConsole:如何允许用户输入和处理这个监听器?
我正在编写一个创建新控制台的 eclipse 插件.请看我的源代码:
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");
控制台CLI"出现,但用户输入无法对其进行编辑.我想让用户可以通过在控制台中输入直接输入到控制台中.
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?
推荐答案
使用 IOConsole
代替!MessageConsole
基本上是 IOConsole
的只读版本.
Use an IOConsole
instead! MessageConsole
is basically a read-only version of IOConsole
.
来自 MessageConsole.createPage(...)
:
public IPageBookViewPage createPage(IConsoleView view) {
IOConsolePage page = (IOConsolePage) super.createPage(view);
page.setReadOnly();
return page;
}
相关文章