简体   繁体   English

在Eclipse RCP中将焦点设置为Eclipse控制台视图

[英]Set Focus to Eclipse Console View in Eclipse RCP

I want to programatically set the focus to the Console View (that is bring that view to being active/displayed in case it isn't). 我想以编程方式将焦点设置为控制台视图(即将视图置于活动/显示状态,以防它不存在)。 How would I even get a reference to the ConsoleView so that I an call set focus to it from another plugin? 我怎样才能获得对ConsoleView的引用,以便我从另一个插件中调用它?

As mentioned in the comment it is done like this: 如评论中所述,它是这样做的:

String id = IConsoleConstants.ID_CONSOLE_VIEW;
IViewPart consoleView = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
                                  .getActivePage().showView(id);

To display a specific (custom) console page: 要显示特定(自定义)控制台页面:

MessageConsole customConsole = ...;
((IConsoleView) consoleView).display(customConsole);

Taken from Eclipse FAQ where futher the custom console creation can be found. 摘自Eclipse FAQ ,可以找到自定义控制台创建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM