blob: ef2a009d25b0382b21e6d72e8d6493b7a0b86266 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML>
<HEAD>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. 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"></script>
<TITLE>
Creating the plug-in project
</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
<H2>
Creating the plug-in project</H2>
<P >You can use any Java IDE you wish to build Eclipse plug-ins, but of course the
Eclipse SDK provides tooling specific for plug-in development. We'll walk
through the steps for building our plug-in with the Eclipse SDK, since this is the
typical case. If you are not already familiar with the Eclipse workbench and the Java IDE,
consult the Java Development User Guide or PDE Guide for further explanations of the steps
we are taking. For now we are focusing on the code, not the tool;
however, there are some IDE logistics for getting started.</P>
<h3>Creating your plug-in project</h3>
<p>You will need to create a project that contains your work. We'll take advantage of some of the
code-generation facilities of the Plug-in Development Environment (PDE) to give us a template to
start from. This will set up the project for writing Java code and generate the default plug-in
manifest files (explained in a moment) and a class to hold our view.
</p>
<ol>
<li>Open the <b>New Project...</b> wizard
(<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.newWizard")'><img src="PLUGINS_ROOT/org.eclipse.help/command_link.png">
<b>File &gt; New &gt; Project...</b></a>)
and choose <b>Plug-in Project </b>from the <b>Plug-in Development</b> category
and click <strong>Next</strong>.</li>
<li>On the <strong>Plug-in Project </strong> page, use <b>com.example.helloworld</b>
as the name for your project and check the box for <strong>Create a Java project</strong>
(this should be the default). Leave the other settings on the page with their default
settings and then click <strong>Next</strong> to accept the default plug-in project structure.</li>
<li>On the <strong>Plug-in Content</strong> page, look at the default settings. The wizard sets <strong>com.example.helloworld</strong>
as the id of the plug-in.&nbsp; The wizard will also generate a plug-in class for your plug-in and allow you to supply additional information about
contributing to the UI. These defaults are acceptable, so click <strong>Next</strong>. </li>
<li>On the <strong>Templates</strong> page, check the box for <strong>Create a plug-in using one of the templates</strong>. Then
select the <strong>Plug-in with a view</strong> template. Click <strong>Next</strong>. </li>
<li>We want to create a minimal plug-in, so at this point we need to change the default settings to keep things as
simple as possible. On the <strong>Main View Settings</strong> page, change the suggested defaults as follows:
<img border="0" src="images/firstpluginpde.png" alt="Plug-in view settings" >
<ul>
<li>Change the <strong>Java Package Name</strong> from <strong>com.example.helloworld.views</strong> to <strong>com.example.helloworld</strong>
(we don't need a separate package for our view).</li>
<li>Change the <strong>View Class Name</strong> to <strong>HelloWorldView</strong>.</li>
<li>Change the <strong>View Name</strong> to <strong>Hello View</strong>.</li>
<li>Leave the default <strong>View Category Id</strong> as <strong>com.example.helloworld</strong>.</li>
<li>Change the <strong>View Category Name</strong> to <strong>Hello Category</strong>.</li>
<li>Leave the default viewer type as <strong>Table viewer</strong> (we will change this in the code to make it even simpler).</li>
<li>Uncheck the box for <strong>Add the view to the resource perspective</strong>.</li>
<li>Click <strong>Next</strong> to proceed to the next page.</li>
</ul></li>
<li>On the <strong>View Features</strong> page, uncheck all of the boxes so that no extra
features are generated for the plug-in. Click <strong>Finish</strong> to create the project and the plug-in skeleton. </li>
<li>When asked if you would like to switch to the Plug-in Development perspective,
answer <strong>Yes</strong>.</li>
<li>Navigate to your new project and examine its contents.</li>
</ol>
<p>The skeleton project structure includes several folders, files, and a Java package. The important files at this stage are the
<strong>plugin.xml</strong> and <strong>MANIFEST.MF</strong> (manifest) files and the Java source code for your plug-in.
We'll start by looking at the implementation for a view and then
examine the manifest files.</p>
</BODY>
</HTML>