Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.
like image 718
hanmomhanda Avatar asked Nov 04 '22 05:11

hanmomhanda


1 Answers

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'.

like image 110
hanmomhanda Avatar answered Nov 09 '22 12:11

hanmomhanda