简体   繁体   中英

How to create an Eclipse RCP application re-using some “Eclipse IDE plugins”?

How can I create a RCP application, which looks exactly like the Eclipse IDE with all menus, views, dialogs...?

Here is one example: http://richclientplatform.blogspot.com/2007/12/oil-and-gas-industry-using-eclipse.html

I followed Lars Vogel's tutorial to create a simple RCP application: http://www.vogella.de/articles/EclipseRCP/article.html .

... what are the next steps?

The ide bundle provides you with classes and extension points that allow you to use the workspace metaphor but it does not include the extensions that add all the functionality that you would see in the Eclipse IDE.

Since each bundle in an RCP app application adds menu, views, and dialogs the way to get your application to look like the IDE is to include all of the bundle that come with the IDE.

Usually you start with a pretty bare application like something tutorials that Vogel (who I find puts out good tutorials) puts out describe. Then when you find something that you want to add you research which bundle provides it and you add that bundle. As you do this your application will grow in functionality without picking up functionality your user does not need.

EDIT: Let me walk you through creating a simple RCP application.

  • Create a new Project by going to File -> New -> Project
  • Select Plug-in Project
  • Set the Project name to com.mydomain.rcp
  • Click Next
  • Under Rich Client Application select Yes
  • Click Next
  • Select RCP Mail Template
  • Click Finish

You now have an RCP app with some functionality. Next we will run it:

  • Select Run -> Run Configurations...
  • Select Eclipse Application on the left
  • Right click and select New
  • Look for Program to Run/Run a Product. Select com.mydomain.rcp.product
  • Click on the Plug-ins tab
  • Find Launch with at the top and select plug-ins selected below only
  • Click Deselect All on the right
  • In you list of plug-ins select com.mydomain.rcp
  • At the bottom de-select Add new workspace plug-ins to this launch configuration automatically
  • On the right click on Add Required Plug-ins
  • On the bottom click on Run

The application should be running the sample mail application. Go ahead and close it down. Now let's add a plugin so we can get the Search menu to show up like it does in the Eclipse IDE.

  • In your com.mydomain.rcp project open up your plugin.xml file
  • Click on the Dependencies tab
  • Under Required Plug-ins click Add...
  • Type in org.eclipse.search
  • Select org.eclipse.search (not the source one)
  • Click OK
  • Save the plugin.xml file
  • From the menu select Run -> Run Configurations...
  • Click on the Plug-ins tab
  • On the right click on Add Required Plug-ins
  • On the bottom click on Run

You should now see the Search menu with the File Search option just like the IDE has. You will not see the Java Search or the Plug-in Search though because we did not add the appropriate JDT or PDE plugins containing those additions. Hopefully this gives you an idea how to add new plugins.

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