0
votes

i used the sample mail rcp application to test out the common navigator framework. I added a view and attached it to my contentprovider. Unfortunately nothing is shown in my view, no function from my contentprovider or labelprovider even get's called.

Here is my plugin.xml

   <extension
         id="application"
         point="org.eclipse.core.runtime.applications">
      <application>
         <run
               class="rcptest.Application">
         </run>
      </application>
   </extension>
   <extension
         point="org.eclipse.ui.perspectives">
      <perspective
            name="RCP Perspective"
            class="rcptest.Perspective"
            id="RCPTest.perspective">
      </perspective>
   </extension>
   <extension
         point="org.eclipse.ui.views">
      <view
            name="Message"
            allowMultiple="true"
            icon="icons/sample2.gif"
            class="rcptest.View"
            id="RCPTest.view">
      </view>
      <view
            name="Mailboxes"
            allowMultiple="true"
            icon="icons/sample3.gif"
            class="rcptest.NavigationView"
            id="RCPTest.navigationView">
      </view>
      <view
            class="org.eclipse.ui.navigator.CommonNavigator"
            icon="icons/sample.gif"
            id="de.meinss.test"
            name="My Common Navigator"
            restorable="true">
      </view>
   </extension>
   <extension
         point="org.eclipse.ui.commands">
      <category
            name="Mail"
            id="RCPTest.category">
      </category>
      <command
            name="Open Mailbox"
            description="Opens a mailbox"
            categoryId="RCPTest.category"
            id="RCPTest.open">
      </command>
      <command
            name="Open Message Dialog"
            description="Open a message dialog"
            categoryId="RCPTest.category"
            id="RCPTest.openMessage">
      </command>
   </extension>
   <extension
         point="org.eclipse.ui.bindings">
      <key
            commandId="RCPTest.open"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
            sequence="CTRL+2">
      </key>
      <key
            commandId="RCPTest.openMessage"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
            sequence="CTRL+3">
      </key>
      <key
            commandId="org.eclipse.ui.file.exit"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
            sequence="CTRL+X">
      </key>
   </extension>
   <extension
         id="product"
         point="org.eclipse.core.runtime.products">
      <product
            application="RCPTest.application"
            name="RCP Product">
         <property
               name="aboutText"
               value="RCP Mail template created by PDE">
         </property>
         <property
               name="windowImages"
               value="icons/sample2.gif">
         </property>
         <property
               name="aboutImage"
               value="product_lg.gif">
         </property>
      </product>
   </extension>
   <extension
         point="org.eclipse.ui.navigator.viewer">
      <viewer
            viewerId="de.meinss.test">
      </viewer>
      <viewerContentBinding
            viewerId="de.meinss.test">
         <includes>
            <contentExtension
                  pattern="RCPTest.navigatorContent1">
            </contentExtension>
         </includes>
      </viewerContentBinding>
      <viewerActionBinding
            viewerId="de.meinss.test">
         <includes></includes>
      </viewerActionBinding>
   </extension>
   <extension
         point="org.eclipse.ui.perspectiveExtensions">
      <perspectiveExtension
            targetID="*">
         <view
               id="de.meinss.test"
               ratio="0.5"
               relationship="stack"
               relative="org.eclipse.ui.navigator.ProjectExplorer">
         </view>
      </perspectiveExtension>
   </extension>
   <extension
         point="org.eclipse.ui.navigator.navigatorContent">
      <navigatorContent
            activeByDefault="true"
            contentProvider="TreeContentProvider"
            icon="icons/sample.gif"
            id="RCPTest.navigatorContent1"
            labelProvider="TreeLabelProvider"
            name="meineigenes"
            priority="normal"
            providesSaveables="false">
         <possibleChildren>
            <instanceof
                  value="java.lang.String">
            </instanceof>
         </possibleChildren>
      </navigatorContent>
   </extension>

The classes TreeContentProvider and TreeLabelprovider exist and print out to the console if they are called, which they are not. What I'm doing wrong?

Thanks for reading!

Markus

2
Personally I wouldn't use the common navigator. I did in my application and it was a mistake. I don't know what your use cases are, but do understand that this component is really not a first-class component, it has limited features and really don't add that much value. If you need plugins to extend your tree, you can easily write your own extension point and be in control of the features. - andyczerwonka

2 Answers

2
votes

Add:

layout.addView("com.example.test", IPageLayout.RIGHT, 0.3f,IPageLayout.ID_PROJECT_EXPLORER);

In the Perspective.java file. A standard perpective is used at startup. You have to add manually the view, which you want to see at startup.

1
votes

I have compared your code with two projects and found no reason. I can only recommend you these two tutorials, which have helped me very much: michael elder, Simon Zambrovski.