简体   繁体   English

在eclipse e4中从处理程序更新视图

[英]updating the view from handler in eclipse e4

I am new to eclipse e4 application. 我是eclipse e4应用的新手。 I have a menu item open handler, when i click on it the filedialog appears and I can select the files and I should display the selected files on the view part. 我有一个菜单项打开处理程序,当我点击它时出现了filedialog,我可以选择文件,我应该在视图部分显示所选的文件。

Can anyone please help me how to update the view from the handler? 谁能帮助我如何从处理程序更新视图?

You can use EPartService to find your part in the handler: 您可以使用EPartService在处理程序中查找您的部件:

@Execute
void execute(EPartService partService)
{
  MPart part = partService.findPart("part id ");

  // TODO use FileDialog

  YourClass yourClass = (YourClass)part.getObject();

  // TODO call a method in YourClass to set the table input
}

where YourClass is the class you defined for the part. 其中YourClass是您为零件定义的类。 You then just need to add a method to YourClass that you can call to set the table input. 然后,您只需要向YourClass添加一个方法,您可以调用该方法来设置表输入。 "part id" is the id you specified for the MPart in the application model. “part id”是您在应用程序模型中为MPart指定的ID。

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

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