views:

233

answers:

1

Hi,

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?

+2  A: 

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.

rancidfishbreath
I fully understand what you said, that is a very good explanation. So, my question now are: 1. What are the steps to add a bundle(plugin) on my RCP application? 2. How can I start this added bundle(plugin) to picking up the functionalities provided by it?
Max
See the response under EDIT in the answer
rancidfishbreath
That is a very precise answer, it is working fine, Thank you so much. Just 1 more question: I read on this forum (http://www.eclipsezone.com/eclipse/forums/t107481.html) that if I included a dependency to `org.eclipse.ui.ide` I would have the behavior that I expected (with all the wizards, preferencePages, menus...) However, after adding this dependency (as I learned with you) it still did not work.
Max
@Max: You do get all the functionality, but since you're running you own implementation of org.eclipse.equinox.app.IApplication in your RCP, the default Eclipse IDE menus (File, Edit, Window, Help, etc.) are not initialized.You have to implement your own org.eclipse.ui.application.WorkbenchWindowAdvisor and most importantly org.eclipse.ui.application.ActionBarAdvisor and basically copy and paste the menus and actions you need from org.eclipse.ui.internal.ide.WorkbenchActionBuilder.I admit it's quite an ugly hack, but this is the only way I found when I needed to do something like this.
Zsolt Török
@Zsolt Török: Thank you, that is a OK solution :). Let me add a few information here (probably you already know about it). There are a couple of perspectives, views, wizards... that was meant to be reused, and you can do that by adding an extension called `org.eclipse.ui.perspectiveExtensions`. Example: http://a.imageshack.us/img828/33/perspectiveextensions.png (you just need to add the proper dependency later).
Max
Avoid creating a dependency to `org.eclipse.ide` (this plugin is not _RCP-Friendly_), do use the `org.eclipse.ui.ide.application` instead. Here is a VERY good explanation for that: https://bugs.eclipse.org/bugs/show_bug.cgi?id=167893
Max