Eclipse RCP MessageConsole: How to allow user to input and handle this listener?

懵懂的女人 提交于 2019-12-31 03:20:07

问题


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:


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;
}


来源:https://stackoverflow.com/questions/10441986/eclipse-rcp-messageconsole-how-to-allow-user-to-input-and-handle-this-listener

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!