简体   繁体   中英

Is Extending Eclipse Package Explorer Impossible?

Is it possible to extend the Package Explorer of Eclipse by binding a custom navigatorContent?

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.

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.

So I want to confirm whether the Package Explorer can be extended by custom navigatorContent or not.

Here is the abstract of my 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'.

If you want to extend the 'Package Explorer', you should do the other way.

That is to say, you need to make a custom view extending 'CommonNavigator', and then bind 'Java Element' navigatorContent with your custom view. You can find 'Java Element' navigatorContent in the 'org.eclipse.jdt.ui' plug-in which includes the 'Package Explorer'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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