I put a toolbar on the top of my TrimmedWindow in my application. I have a handler which has to check whether a check button is pressed on this menu bar or not.
我在我的应用程序中将一个工具栏放在TrimmedWindow的顶部。我有一个处理程序,必须检查是否在此菜单栏上按下了复选按钮。
I tried putting EMenuService
in my execute()
method of the handler but it has no useful methods. If I debug into my application I can see my menu in the EMenuService
object however.
我尝试将EMenuService放在我的处理程序的execute()方法中,但它没有有用的方法。如果我调试到我的应用程序,我可以在EMenuService对象中看到我的菜单。
How can I get my menu from the Eclipse context?
如何从Eclipse上下文中获取菜单?
1 个解决方案
#1
0
Without code it's hard to help you.
没有代码,很难帮助你。
But the basic idea for your handler is the following :
但是处理程序的基本思想如下:
public class BrokerHandler {
@Inject
// the services you need
@Execute
public void execute(IEclipseContext context, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell)
throws InvocationTargetException, InterruptedException {
// do some stuff
}
}
Then, in your application.e4xmi you need to create a Window>Trimmed Window>Trim Bars>Window Trim>Toolbar>Handled Tool Item
wich points to your Commands>Command
that is binded to your Handlers>Handler
pointing to your java class with a method annotated @Execute
as described above.
然后,在你的application.e4xmi中你需要创建一个Window> Trimmed Window> Trim Bars> Window Trim> Toolbar> Handled Tool Item,它指向你的Commands> Command绑定到你的Handlers> Handler指向你的java类方法注释@Execute如上所述。
Then each execution of the @Execute
method means the user has pressed the toolbar button.
然后每次执行@Execute方法意味着用户按下了工具栏按钮。
You can pass messages to other parts of your app with the event broker service, or store some of your own stuff in the IEclipseContext
.
您可以使用事件代理服务将消息传递到应用程序的其他部分,或者将您自己的一些内容存储在IEclipseContext中。
You can have a look here: http://xseignard.github.com/demoCamp2012/prez/#1
你可以看看这里:http://xseignard.github.com/demoCamp2012/prez/#1
Hope this helps, but your question is too blurry.
希望这会有所帮助,但你的问题太模糊了。
#1
0
Without code it's hard to help you.
没有代码,很难帮助你。
But the basic idea for your handler is the following :
但是处理程序的基本思想如下:
public class BrokerHandler {
@Inject
// the services you need
@Execute
public void execute(IEclipseContext context, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell)
throws InvocationTargetException, InterruptedException {
// do some stuff
}
}
Then, in your application.e4xmi you need to create a Window>Trimmed Window>Trim Bars>Window Trim>Toolbar>Handled Tool Item
wich points to your Commands>Command
that is binded to your Handlers>Handler
pointing to your java class with a method annotated @Execute
as described above.
然后,在你的application.e4xmi中你需要创建一个Window> Trimmed Window> Trim Bars> Window Trim> Toolbar> Handled Tool Item,它指向你的Commands> Command绑定到你的Handlers> Handler指向你的java类方法注释@Execute如上所述。
Then each execution of the @Execute
method means the user has pressed the toolbar button.
然后每次执行@Execute方法意味着用户按下了工具栏按钮。
You can pass messages to other parts of your app with the event broker service, or store some of your own stuff in the IEclipseContext
.
您可以使用事件代理服务将消息传递到应用程序的其他部分,或者将您自己的一些内容存储在IEclipseContext中。
You can have a look here: http://xseignard.github.com/demoCamp2012/prez/#1
你可以看看这里:http://xseignard.github.com/demoCamp2012/prez/#1
Hope this helps, but your question is too blurry.
希望这会有所帮助,但你的问题太模糊了。