简体   繁体   English

扩展Eclipse Package Explorer是不可能的吗?

[英]Is Extending Eclipse Package Explorer Impossible?

Is it possible to extend the Package Explorer of Eclipse by binding a custom navigatorContent? 通过绑定自定义的navigatorContent可以扩展Eclipse的Package Explorer吗?

When I tested the Project Explorer with my custom navigatorContent, like the xml code below, my contentProvider and labelProvider worked fine with the Project Explorer. 当我使用自定义的navigatorContent测试项目浏览器时,例如下面的xml代码,我的contentProvider和labelProvider在项目浏览器中运行良好。

But with the Package Explorer, which means that I substituted 'org.eclipse.ui.navigator.ProjectExplorer' with 'org.eclipse.jdt.ui.PackageExplorer' in the 'viewerId' attribute, it didn't. 但是使用Package Explorer,这意味着我在'viewerId'属性中将'org.eclipse.ui.navigator.ProjectExplorer'替换为'org.eclipse.jdt.ui.PackageExplorer'。

So I want to confirm whether the Package Explorer can be extended by custom navigatorContent or not. 因此,我想确认是否可以通过自定义navigatorContent扩展Package Explorer。

Here is the abstract of my plugin.xml. 这是我的plugin.xml的摘要。

<extension
    point="org.eclipse.ui.navigator.viewer">
    <viewer
        viewerId="org.eclipse.ui.navigator.ProjectExplorer">
    </viewer>
    <viewerContentBinding
        viewerId="org.eclipse.ui.navigator.ProjectExplorer">
        <includes>
            <contentExtension
                pattern="abc.pkg.explorer.navigator.propertiesContent">
            </contentExtension>
        </includes>
    </viewerContentBinding>
</extension>
<extension
    point="org.eclipse.ui.navigator.navigatorContent"> 
    <navigatorContent
        id="abc.pkg.explorer.navigator.propertiesContent"
    .. omitted below.

I found the answer. 我找到了答案。

It is not possible because 'Package Explorer' doesn't use the 'CommonNavigator'. 这是不可能的,因为“ Package Explorer”不使用“ CommonNavigator”。

If you want to extend the 'Package Explorer', you should do the other way. 如果要扩展“ Package Explorer”,则应采用其他方法。

That is to say, you need to make a custom view extending 'CommonNavigator', and then bind 'Java Element' navigatorContent with your custom view. 也就是说,您需要创建一个扩展“ CommonNavigator”的自定义视图,然后将“ Java Element” navigatorContent与您的自定义视图绑定。 You can find 'Java Element' navigatorContent in the 'org.eclipse.jdt.ui' plug-in which includes the 'Package Explorer'. 您可以在“ org.eclipse.jdt.ui”插件(其中包括“ Package Explorer”)中找到“ Java Element” navigatorContent。

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

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