Eclipse RCP MessageConsole:如何允许用户输入和处理这个监听器?

Eclipse RCP MessageConsole: How to allow user to input and handle this listener?(Eclipse RCP MessageConsole:如何允许用户输入和处理这个监听器?)

本文介绍了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;
}

这篇关于Eclipse RCP MessageConsole:如何允许用户输入和处理这个监听器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Eclipse RCP MessageConsole:如何允许用户输入和处理这个监听器?

基础教程推荐