https://wiki.eclipse.org/index.php?title=FAQ_How_do_I_create_a_Rich_Client_application%3F&feed=atom&action=historyFAQ How do I create a Rich Client application? - Revision history2024-03-28T20:16:49ZRevision history for this page on the wikiMediaWiki 1.26.4https://wiki.eclipse.org/index.php?title=FAQ_How_do_I_create_a_Rich_Client_application%3F&diff=3190&oldid=prevClaffra at 20:28, 14 March 20062006-03-14T20:28:11Z<p></p>
<p><b>New page</b></p><div>An Eclipse RCP application has full control over<br />
how the user interface is created. The locus of control for an RCP <br />
application&#151;the place where all configuration starts&#151;is <br />
the <tt>WorkbenchAdvisor</tt> class.<br />
Your subclass of <tt>WorkbenchAdvisor</tt> controls the initial layout and <br />
appearance of the workbench window, as well as what commands<br />
appear in the menus and toolbars. Here is an example of a bare-bones<br />
RCP application:<br />
<pre><br />
public class MinimalRCPApp extends WorkbenchAdvisor<br />
implements IPlatformRunnable {<br />
public String getInitialWindowPerspectiveId() {<br />
return "org.eclipse.faq.minimalperspective";<br />
}<br />
public void preWindowOpen(<br />
IWorkbenchWindowConfigurer wwc) {<br />
configurer.setShowMenuBar(false);<br />
configurer.setShowFastViewBars(false);<br />
configurer.setShowStatusLine(false);<br />
configurer.setShowCoolBar(false);<br />
}<br />
public Object run(Object args) throws Exception {<br />
Display d = PlatformUI.createDisplay();<br />
int ret = PlatformUI.createAndRunWorkbench(d, this);<br />
if (ret == PlatformUI.RETURN_RESTART)<br />
return EXIT_RESTART;<br />
return EXIT_OK;<br />
}<br />
}<br />
</pre><br />
<br />
<br />
This application creates a blank workbench window with no toolbars,<br />
no menus, no status line, and no views or editors (Figure 13.1). The application<br />
will run until the user closes the workbench window. <br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;<img src=../images/minimal_app.png><br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;'''Figure 13.1'''&nbsp;&nbsp;<br />
Minimal RCP application<br />
<br />
<br />
<br />
The application&#146;s <tt>run</tt> <br />
method is the one we&#146;ve seen in previous application examples. <br />
You need to specify the name of the class with this <br />
method when declaring your application in the <tt>plugin.xml</tt> <br />
file. This example creates a workbench and runs the event loop by calling<br />
<tt>createAndRunWorkbench</tt>. The <tt>preWindowOpen</tt><br />
method is your opportunity to customize the basic appearance of the<br />
window. Finally, the <tt>getInitialWindowPerspectiveId</tt> method<br />
must specify the ID of the initial perspective to be displayed.<br />
<br />
<br />
That&#146;s all there is to it! The rest of an RCP application is developed just like<br />
any other plug-in. You need to create one or more perspectives and populate<br />
them with the views and editors that apply for your application.<br />
These are created by using the standard <tt>org.eclipse.ui</tt> extension points, <br />
all of which are available in a custom application.<br />
<br />
<br />
A binary download of the RCP can be obtained for any Eclipse<br />
build from the eclipse.org downloads page. This download does not<br />
contain an application, but it can be set as the target platform for<br />
your own RCP application from the '''Plug-in Development &gt;<br />
Target Platform''' preference page.<br />
<br />
<br />
== See Also: ==<br />
<br />
[[FAQ_How_do_I_create_a_new_perspective%3F]]<br />
<br />
[[FAQ_How_do_I_create_an_application%3F]]<br />
<br />
<hr><font size=-2>This FAQ was originally published in [http://www.eclipsefaq.org Official Eclipse 3.0 FAQs]. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the [http://www.eclipse.org/legal/epl-v10.html Eclipse Public License v1.0].</font></div>Claffra