mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 07:05:24 +02:00
110 lines
6.7 KiB
HTML
Executable file
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>"RSESamples"</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>"Default Plug-in Structure"</B>, and press <B>Next ></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->Text Editor</b>.
|
|
Edit the <b>requires</b> statement to add the last lines highlighted here:
|
|
<pre><code>
|
|
<requires>
|
|
<import plugin="org.eclipse.core.resources"/>
|
|
<import plugin="org.eclipse.ui"/>
|
|
<b><import plugin="com.ibm.etools.systems.core"/>
|
|
<import plugin="com.ibm.etools.systems.logging"/></b>
|
|
</requires>
|
|
|
|
</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->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->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>
|
|
<?xml version="1.0" encoding='UTF-8'?>
|
|
<!DOCTYPE MessageFile SYSTEM "../com.ibm.etools.systems.core/messageFile.dtd">
|
|
<!-- This is a message file used by SystemMessage and SystemMessageDialog -->
|
|
<<b>MessageFile</b> Version="1.0">
|
|
<<b>Component</b> Name="RSE Samples" Abbr="RSS">
|
|
<<b>Subcomponent</b> Name="General" Abbr="G">
|
|
<<b>MessageList</b>>
|
|
<<b>Message</b> ID="1001" Indicator="E">
|
|
<<b>LevelOne</b>>Sample message</<b>LevelOne</b>>
|
|
<<b>LevelTwo</b>>This is a sample with one substution variable: %1</<b>LevelTwo</b>>
|
|
</<b>Message</b>>
|
|
</<b>MessageList</b>>
|
|
</<b>Subcomponent</b>>
|
|
</<b>Component</b>>
|
|
</<b>MessageFile</b>>
|
|
</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>
|