blob: cbaf3feda4b547a795acce410571c1c6daf00432 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"><HTML>
<HEAD>
<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">
<title>Creating a PDE plug-in</title>
</head>
<BODY BGCOLOR="#ffffff">
<h1>Creating a plug-in</h1>
<p>Once your working environment is clean and configured, you can start creating
your first plug-in.&nbsp;</p>
<p>You start by creating a special plug-in project.&nbsp; PDE provides a wizard for
setting up the project.&nbsp; You can access this wizard using <b>File&gt;New&gt;Project...</b>
and
selecting <b>Plug-in Project</b> in the list of wizards under 'Plug-in
Development' category.</p>
<p>When you press <b>Next</b>, the first entry you will need to set is the project
name. It is a convention that plug-in project names are the same as plug-in IDs,
but they can be different. As an example, we will choose <b>&quot;com.example.xyz&quot;</b>
for the project name.</p>
<p>The next page shows the initial structure of the plug-in project.&nbsp; If
the project name conforms to the rules for plug-in names, you can keep the
default. Otherwise, you will be asked to change it (See <a href="../../org.eclipse.platform.doc.isv/guide/firstplugin_minimal.htm#firstplugin_minimal_pluginid">plug-in
ids</a> for a description of the format.). The <b>Plug-in
runtime library </b> name will be used to
define where the code of your new plug-in will be packaged once you are ready to
publish it. The <b>Source folder</b> will be created to store your Java source inside the
new project.</p>
<p>If you are creating a plug-in that is not meant to contain Java code, e.g. a
documentation plug-in, select the 'Create a simple project' option and press <b>Finish</b>.&nbsp; PDE will create a simple project containing a plug-in.xml file
with minimal content.</p>
<p align="center">
<img border="0" src="images/project-structure.gif" alt="Plug-in Project Structure" width="500" height="500"></p>
<p>In the next page, you will need to choose what the content of your new plug-in
is going to look like. If you choose a blank plug-in, only the plug-in project
will be created. If you use the template wizards, the PDE will also create
files such as the plug-in class, build properties, and plug-in
manifest. Some of the templates provided by PDE also generate useful content
such as views, editors, property pages etc. This content is generated by
templates that can be combined into a wizard. All the available templates are
individually selectable in the &quot;Custom plug-in wizard&quot;.&nbsp;</p>
<p>In this example, we use the &quot;Hello, World&quot; template wizard. You can
read about the wizard in the area to the right of the wizard list.</p>
<p align="center">
<img border="0" src="images/project-codegen.gif" alt="Plug-in code generators" width="500" height="500"></p>
<p align="left">After the wizard has been selected, the following pages are
under wizard's control. Each template wizard contributes a number of pages that
customize the content about to be generated. However, all the templates share one
common page. It will collect information about the plug-in, such as its name,
version, and provider.&nbsp; It also provides options related to the plug-in
class that will be generated.&nbsp; In this example, we will accept all the
options.</p>
<p align="center">
<img border="0" src="images/default-codegen.gif" alt="Mandatory plug-in content page" width="500" height="500"></p>
<p align="left">&nbsp;</p>
<p align="left">After this page, templates add their own to collect
template-specific information. Our &quot;Hello, World&quot; template has only
one related to the action that will be contributed, as well as the message that
will be shown in a message box.</p>
<p align="center">
<img border="0" src="images/hello-world-page.gif" alt="&quot;Sample Action Set&quot; template page" width="500" height="500"></p>
<p align="left">&nbsp;</p>
<p align="left">When you press <b>Finish</b>, the wizard will create the new
project, all the specified folders and files, and the initial Java build path.
The build path is important for correct compilation of Java classes that are
generated. The wizard will also open the plug-in manifest editor so that you can
define additional attributes of your plug-in.&nbsp;&nbsp;</p>
<p align="left"> After the wizard is
finished, the initial project structure should look like this:</p>
<p align="center">
<img border="0" src="images/initial-structure.gif" alt="Initial plug-in project structure" width="224" height="454"></p>
<p>&nbsp;<br>
<a href="../hglegal2003.htm">
<img src = "../images/ngibmcpy2003.gif" alt="Copyright IBM Corporation and others 2000, 2003" border="0" width="324" height="14"></a>
</p>
</body>
</html>