Angle.Bracket
Angle.Bracket

Reputation: 1520

Why is this Eclipse RCP plugin missing a view?

I am experimenting with the way an Eclipse RCP application is dealing with its plugins. In Eclipse IDE I created an Eclipse RCP 3.x project with a view that generated all the necessary files and worked just fine.

Assuming that I can transform this application into one that only holds an empty perspective just by removing the respective parts of the plugin.xml file, I commented out all the lines that deal with the view like so:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension
     id="application"
     point="org.eclipse.core.runtime.applications">
       <application>
         <run
           class="pluginwithview.Application">
         </run>
       </application>
    </extension>
    <extension
     point="org.eclipse.ui.perspectives">
       <perspective
        name="Perspective"
        class="pluginwithview.Perspective"
        id="PluginWithView.perspective">
       </perspective>
    </extension>
    <!-- 
       even without these lines 
       there's an Exception thrown saying:
       "Could not create the view: PluginWithView.view
    -->  
    <!-- <extension
          point="org.eclipse.ui.views">
          <view
            name="View"
            inject="true"
            class="pluginwithview.View"
            id="PluginWithView.view">
          </view>
         </extension>
         <extension
           point="org.eclipse.ui.perspectiveExtensions">
           <perspectiveExtension
              targetID="*">
           <view
              standalone="true"
              minimized="false"
              relative="org.eclipse.ui.editorss"
              relationship="left"
              id="PluginWithView.view">
           </view>
         </perspectiveExtension>
      </extension> -->
   <extension
     point="org.eclipse.ui.menus">
     <menuContribution
        locationURI="menu:org.eclipse.ui.main.menu">
     <menu
           label="File">
           <command
              commandId="org.eclipse.ui.file.exit"
              label="Exit">
           </command>
     </menu>
     </menuContribution>
   </extension>
</plugin>

But instead of displaying an empty perspective, the app now looks like so:

Screenshot of RCP app with exception

What must I do to not have the application search for the view ? Is there a config file that I am missing ? (I know there a few reasons to not have a view , but right now I am mainly interested in the inner workings of an Eclipse RCP application)

Upvotes: 0

Views: 305

Answers (1)

greg-449
greg-449

Reputation: 111142

Perspectives remember the views they contained. If you change the perspective definition you will have to do a perspective reset ('Window > Perspective > Reset Perspective') to get it to read the updated definition.

For testing you can also specify the -clean and -clearPersistedState options in the 'Program Arguments' section of the RCP Run Configuration to discard all saved information.

Upvotes: 1

Related Questions