如何使用EPartService获取活动部件?

时间:2015-10-02 06:53:12

标签: java swt eclipse-rcp rcp

我想通过使用EPartService来获取活动部件。我可以使用EPartService吗?

1 个答案:

答案 0 :(得分:0)

如果你想在命令处理程序中获取活动部分,可以将其作为参数注入:

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()); 。类似的东西:

function remove($allowedCharacters, $value)
{
    $newDict = $allowedCharacters;
    if(($key = array_search($value, $newDict)))
    {
        unset($newDict[$key]);
    }

    return $newDict;
}

注意:此代码需要Java 8