Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Eclipse rcp 在E4应用程序中添加系统托盘和活动Workbech外壳参考_Eclipse Rcp_E4 - Fatal编程技术网

Eclipse rcp 在E4应用程序中添加系统托盘和活动Workbech外壳参考

Eclipse rcp 在E4应用程序中添加系统托盘和活动Workbech外壳参考,eclipse-rcp,e4,Eclipse Rcp,E4,我是E4应用程序开发新手。我成功地在RCP 3.7.x中添加了系统托盘图标。 在e4应用程序中添加系统托盘图标。我使用e4应用程序生命周期以以下方式添加系统托盘图标: 公共类生命周期管理器{ @后上下文创建 无效postContextCreate(IAApplicationContext appContext,显示){ SystemNotifier图标=新的SystemNotifier(shell); SystemNotifier.trayItem=icon.initTaskItem(shell

我是E4应用程序开发新手。我成功地在RCP 3.7.x中添加了系统托盘图标。 在e4应用程序中添加系统托盘图标。我使用e4应用程序生命周期以以下方式添加系统托盘图标:

公共类生命周期管理器{
@后上下文创建
无效postContextCreate(IAApplicationContext appContext,显示){
SystemNotifier图标=新的SystemNotifier(shell);
SystemNotifier.trayItem=icon.initTaskItem(shell);
如果(SystemNotifier.trayItem!=null){
icon.hookPopupMenu();
}
}  
}

如何在e4应用程序中获取活动工作台Shell的引用。
哪个注释使用e4应用程序生命周期添加系统托盘运行
@PostContextCreate
时,应用程序外壳不可用。您需要等待应用程序启动完成事件,如:

@PostContextCreate
void postContextCreate(IEclipseContext上下文,IEventBroker事件代理)
{
订阅(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE,新的AppStartupCompleteEventHandler(eventBroker,context));
}
私有静态最终类AppStartupCompleteEventHandler实现EventHandler
{
私人最终投资经纪人(eventBroker);;
私有最终IEclipseContext\u上下文;
AppStartupCompleteEventHandler(IEventBroker事件代理,IEclipseContext上下文)
{
_eventBroker=eventBroker;
_上下文=上下文;
}
@凌驾
公共无效handleEvent(最终事件)
{
_eventBroker.取消订阅(此);
Shell=(Shell)\u context.get(IServiceConstants.ACTIVE\u Shell);
…你的代码。。。
}

}

什么是
SystemNotifier
?SystemNofier是我自己的类,它包含系统托盘的代码。如果您觉得这有帮助,您应该通过单击答案旁边的勾选框来“接受”答案。我在Eclipse IDE中遇到一个错误“IEventBroker无法解析为类型”我正在使用Eclipse Luna 4.4IEventBroker,它位于
org.Eclipse.e4.core.services
插件中,因此您需要将它添加到插件的依赖项中。这段代码是为Eclipse4.4编写的