1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 07:05:24 +02:00
cdt/rse/doc/org.eclipse.rse.doc.isv/guide/tutorial/pdeProject.html
2006-05-30 15:32:53 +00:00

110 lines
6.7 KiB
HTML
Executable file

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2006. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
<title>Creating a Plug-in Project</title>
</head>
<body bgcolor="#ffffff">
<h1>Creating a Plug-in Project</h1>
<p>To use any Eclipse extension point, including those defined by the Remote System Explorer,
you must first create a plug-in project using the plug-in development environment (PDE), which you will do shortly.
At its simplest, a plug-in project requires a <samp>plugin.xml</samp> file identifying the extension points being
implemented, and a set of Java classes implementing those extension points. There is usually also a
plug-in class file that is used as the overall manager of the project, and point of integration that other
classes can rely on.
</p>
<P><I>If you already have a plugin project, you can safely skip these
steps! However, you must update project's classpath as described
<A href="pdeProject_changeClasspath.html">here</A>. You must also
add a <samp>requires</samp> statement to your <samp>plugin.xml</samp> file for the
<samp>com.ibm.etools.systems.core</samp> and <samp>com.ibm.etools.systems.logging</samp>
projects.
</p></I>
<p>Eclipse supplies a number of plug-in project templates, which generate a number of project files that
illustrate examples of various Eclipse extension points. While you are free to pick one of these, or indeed
start with any existing plug-in project if you have one, in the RSE tutorials everything is created by
hand so as to keep focused on the RSE-required classes and files.</p>
<p>The following tutorial uses numbered steps to indicate where you are required
to do something as you follow along.</p>
<h2>Step By Step: Creating an RSE Plug-in Project</h2>
<ol>
<li>Select <b>File->New->Project.</b> </LI>
<LI>On the left of the dialog box, select <B>Plug-in Development</B>
category, and on the right, select the <B><A href="pdeProj_1.gif">Plug-in
Project</A></B> wizard. Press <B>Next ></B>.</LI>
<li>In the <A href="pdeProj_wiz_page1.gif">first page</A> of the wizard (Plug-in Project Name), enter <B>&quot;RSESamples&quot;</B> for the
project name (without the quotes). Press <b>Next ></b>.
<li>In the second page of the wizard (Plug-in Project Structure), just take the defaults, and press <b>Next ></b>.
<li>In the <A href="pdeProj_wiz_page3.gif">third page</A> of the wizard
(Plug-in Code Generators), select <B>&quot;Default Plug-in Structure&quot;</B>, and press <B>Next &gt;</B>.</LI>
<LI>In the <A href="pdeProj_wiz_page4.gif">fourth page</A> of the wizard (Simple Plug-in Content), enter your company for the <B>Provider Name</B>,
and press <B>Finish</B>. </LI>
<li>Your new plugin project is created and visible in the Package Explorer of the Plug-in Development perspective.
Your new <samp>plugin.xml</samp> file is also open in the <A href="pdeProj_wiz_after.gif">plug-in editor</A>.
<I>Close this editor</I>, as you will not be using it in this tutorial.
</LI>
<LI>Follow <A href="pdeProject_changeClasspath.html">these steps</A> to
setup your project's classpath so the code to be written will compile cleanly.
</LI>
<LI>It is not enough to only change the project classpath. This works for the Plug-in Development Environment, but not for run time.
Select the <samp>plugin.xml</samp> file, right click and select <b>Open With-&gt;Text Editor</b>.
Edit the <b>requires</b> statement to add the last lines highlighted here:
<pre><code>
&lt;requires&gt;
&lt;import plugin=&quot;org.eclipse.core.resources&quot;/&gt;
&lt;import plugin=&quot;org.eclipse.ui&quot;/&gt;
<b>&lt;import plugin=&quot;com.ibm.etools.systems.core&quot;/&gt;
&lt;import plugin=&quot;com.ibm.etools.systems.logging&quot;/&gt;</b>
&lt;/requires&gt;
</code></pre>
</LI>
<LI>Expand the <B>src</B> folder, then the <B>RSESamples</B> package
folder, and double-click on <SAMP><B>RSESamplesPlugin.java</B></SAMP>
to edit this class.</LI>
<LI>Follow <A href="pdeProject_changePluginClass.html">these steps</A> to edit the generated plugin-class, or simply
copy and paste the <A href="RSESamplesPlugin.html">final result</A>.
</li>
<LI>Create the project's resources file for translatable strings: right-click on the <b>RSESamples</b> project and select <b>New-&gt;File</b> to open
the <b>New File</b> wizard. Enter <samp><b>rseSamplesResources.properties</b></samp> for
the file name, as was specified in the call to <samp>loadResourceBundle</samp> in the plug-in class's constructor.
Press <b>Finish</b> to create the file. You will populate as you go through the tutorials,
so for now just <i>close</i> the editor opened for the file.
</LI>
<LI>Create the project's RSE-style messages file for translatable messages: right-click on the <b>RSESamples</b> project and select <b>New-&gt;File</b> to get
the <b>New File</b> wizard. Enter <samp><b>rseSamplesMessages.xml</b></samp> for
the file name, as was specified in the call to <samp>loadMessageFile</samp> in the plug-in class's constructor.
Press <b>Finish</b> to create the file. You will see the XML editor open for the
new file. Press the <b>Source</b> tab at the bottom of the editor, and enter the
following lines (so that you can add messages to the file later on):
<pre><CODE>
&lt;?xml version=&quot;1.0&quot; encoding='UTF-8'?&gt;
&lt;!DOCTYPE MessageFile SYSTEM &quot;../com.ibm.etools.systems.core/messageFile.dtd&quot;&gt;
&lt;!-- This is a message file used by SystemMessage and SystemMessageDialog --&gt;
&lt;<b>MessageFile</b> Version=&quot;1.0&quot;&gt;
&lt;<b>Component</b> Name=&quot;RSE Samples&quot; Abbr=&quot;RSS&quot;&gt;
&lt;<b>Subcomponent</b> Name=&quot;General&quot; Abbr=&quot;G&quot;&gt;
&lt;<b>MessageList</b>&gt;
&lt;<b>Message</b> ID=&quot;1001&quot; Indicator=&quot;E&quot;&gt;
&lt;<b>LevelOne</b>&gt;Sample message&lt;/<b>LevelOne</b>&gt;
&lt;<b>LevelTwo</b>&gt;This is a sample with one substution variable: %1&lt;/<b>LevelTwo</b>&gt;
&lt;/<b>Message</b>&gt;
&lt;/<b>MessageList</b>&gt;
&lt;/<b>Subcomponent</b>&gt;
&lt;/<b>Component</b>&gt;
&lt;/<b>MessageFile</b>&gt;
</code></pre>
Save and close the file.
</li>
<li>That's it! Your plugin is created and you are ready to go. Now you only need to add
code, to implement the extension points.
</li>
</ol>
</body>
</html>