blob: b4df64779a2c42c8d2df79be23970ad68230b8d5 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html lang="en">
<HEAD>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2011. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="../book.css" CHARSET="ISO-8859-1" TYPE="text/css">
<script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js" type="text/javascript"></script>
<TITLE>
Running the plug-in
</TITLE>
<link rel="stylesheet" type="text/css" HREF="../book.css">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H2>
Running the plug-in</H2>
<P > We have all the pieces needed to run our new plug-in. Now we need to build
the plug-in. If your Eclipse workbench is set up to build automatically, then
your new view class should have compiled as soon as you saved the new content.
If not, then select your new project and choose
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.perspectives.showPerspective(org.eclipse.ui.perspectives.showPerspective.perspectiveId=org.eclipse.ui.project.buildProject)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="command link">
<b>Project &gt; Build Project</b></a>.
The class should compile without error.</p>
<p>There are two ways to run a plug-in once it has been built.</p>
<ol>
<li>The plug-in's manifest files and jar file can be installed in the <strong>eclipse/plugins</strong> directory. When
the workbench is restarted, it will find the new plug-in.</li>
<li>The PDE tool can be used to run another workbench from within your current workbench. This
<strong>runtime workbench</strong> is handy for testing new plug-ins immediately as you develop them
from your workbench. (For more information about how a runtime workbench works, check the PDE guide.)</li>
</ol>
<p>
For simplicity, we'll run the new plug-in from within the Eclipse workbench. </p>
<h3>Launching the workbench</h3>
<p>To launch a runtime workbench, choose
<a class="command-link" href='javascript:executeCommand("org.eclipse.debug.ui.commands.OpenRunConfigurations")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="command link">
<b>Run &gt; Run...</b></a>.
This dialog will show you all the different kinds of ways you can launch a program.
Choose <strong>Eclipse Application</strong>, click <strong>New</strong> and accept all of the default settings.
This will cause another instance of the Eclipse workbench, the runtime workbench,
to start. </p>
<h3>Running Hello World</h3>
<P > So where is our new view? We can see all of the views that have been contributed
by plug-ins using the <b>Window &gt; Show View</b> menu.</P>
<img src="images/perspectivemenu.png" alt="" border="0">
<P >
This menu shows us what views are available for the current perspective. You can see all of the views that are contributed to the platform (regardless of perspective) by selecting
<b>Other...</b>. This will display a list of view categories and the views available under each category. </P>
<P >
The workbench creates the full list of views by using the extension registry to
find all the plug-ins that have provided extensions for the
<a href="../reference/extension-points/org_eclipse_ui_views.html"><b> org.eclipse.ui.views</b></a> extension point. </P>
<img src="images/showview.png" alt="Show View dialog with Hello entry" border="0">
<P >
There we are! The view called &quot;Hello View&quot; has been added to the <b> Show View</b> window underneath our category &quot;Hello Category.&quot; The labels for our category and view were obtained from the extension point configuration markup in the
<b>plugin.xml</b>. </P>
<P ><i><b>
Up to this point, we still have not run our plug-in code!&nbsp; </b></i>The
declarations we made in the <b>plugin.xml</b> (which can be seen by other plug-ins using the extension registry)
are enough for the workbench to find out that there is a
view called &quot;Hello View&quot; available in the &quot;Hello&quot; category. It even knows what class
implements the view. But none of our code will be run until we decide to
show the view.</P>
<P >
If we choose the &quot;Hello View&quot; view from the <b> Show View</b> list, the
workbench will activate our plug-in, instantiate and initialize our view class, and show the
new view in the workbench along with all of the other views. Now our code is running.&nbsp;</P>
<img src="images/workbenchwithhello.png" alt="Workbench with Hello World view" border="0">
<P >
There it is, our first plug-in! We'll cover more specifics about UI classes and extension points later on.</P>
</BODY>
</HTML>