如何积极参与 EPartService?
How to take active parts with EPartService?
我想通过使用 EPartService 来积极参与。我可以为此使用 EPartService 吗?
如果你想在诸如命令处理程序之类的东西中获得活动部分,你可以将其作为参数注入:
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart)
{
... handler code
}
如果您想要所有当前显示的部件的列表,您可以使用 EPartService
。类似于:
@Inject
MApplication app;
@Inject
EPartService partService;
// Find all the `MPart` objects in the current presentation
Collection<MPart> parts = partService.getParts();
// Filter the list to include just the parts that are current being displayed (rendered)
parts = parts.stream().filter(MPart::isToBeRendered).collect(Collectors.toList());
注意:此代码需要Java 8
我想通过使用 EPartService 来积极参与。我可以为此使用 EPartService 吗?
如果你想在诸如命令处理程序之类的东西中获得活动部分,你可以将其作为参数注入:
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart)
{
... handler code
}
如果您想要所有当前显示的部件的列表,您可以使用 EPartService
。类似于:
@Inject
MApplication app;
@Inject
EPartService partService;
// Find all the `MPart` objects in the current presentation
Collection<MPart> parts = partService.getParts();
// Filter the list to include just the parts that are current being displayed (rendered)
parts = parts.stream().filter(MPart::isToBeRendered).collect(Collectors.toList());
注意:此代码需要Java 8