自己的RCP中的CommonNavigator - App没有显示任何内容

时间:2010-05-11 13:58:55

标签: java eclipse-plugin eclipse-rcp

我使用示例邮件rcp应用程序来测试常见的导航框架。我添加了一个视图并将其附加到我的contentprovider。遗憾的是,在我的视图中没有显示任何内容,我的内容提供者或标签提供者的任何功能都没有被调用。

这是我的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>

类TreeContentProvider和TreeLabelprovider存在并打印到控制台,如果它们被调用,它们不是。 我做错了什么?

感谢阅读!

马库斯

2 个答案:

答案 0 :(得分:2)

添加:

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

Perspective.java文件中。启动时使用标准透视图。您必须手动添加要在启动时看到的视图。

答案 1 :(得分:1)

我已将您的代码与两个项目进行比较,但没有找到理由。我只能推荐你这两个教程,这对我非常有帮助: michael elderSimon Zambrovski