问题
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