Creating a Plug-in Project

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 plugin.xml 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.

If you already have a plugin project, you can safely skip these steps! However, you must update project's classpath as described here. You must also add a requires statement to your plugin.xml file for the com.ibm.etools.systems.core and com.ibm.etools.systems.logging projects.

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.

The following tutorial uses numbered steps to indicate where you are required to do something as you follow along.

Step By Step: Creating an RSE Plug-in Project

  1. Select File->New->Project.
  2. On the left of the dialog box, select Plug-in Development category, and on the right, select the Plug-in Project wizard. Press Next >.
  3. In the first page of the wizard (Plug-in Project Name), enter "RSESamples" for the project name (without the quotes). Press Next >.
  4. In the second page of the wizard (Plug-in Project Structure), just take the defaults, and press Next >.
  5. In the third page of the wizard (Plug-in Code Generators), select "Default Plug-in Structure", and press Next >.
  6. In the fourth page of the wizard (Simple Plug-in Content), enter your company for the Provider Name, and press Finish.
  7. Your new plugin project is created and visible in the Package Explorer of the Plug-in Development perspective. Your new plugin.xml file is also open in the plug-in editor. Close this editor, as you will not be using it in this tutorial.
  8. Follow these steps to setup your project's classpath so the code to be written will compile cleanly.
  9. 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 plugin.xml file, right click and select Open With->Text Editor. Edit the requires statement to add the last lines highlighted here:
       
       <requires>
          <import plugin="org.eclipse.core.resources"/>
          <import plugin="org.eclipse.ui"/>
          <import plugin="com.ibm.etools.systems.core"/>
          <import plugin="com.ibm.etools.systems.logging"/>
       </requires>
    
    
  10. Expand the src folder, then the RSESamples package folder, and double-click on RSESamplesPlugin.java to edit this class.
  11. Follow these steps to edit the generated plugin-class, or simply copy and paste the final result.
  12. Create the project's resources file for translatable strings: right-click on the RSESamples project and select New->File to open the New File wizard. Enter rseSamplesResources.properties for the file name, as was specified in the call to loadResourceBundle in the plug-in class's constructor. Press Finish to create the file. You will populate as you go through the tutorials, so for now just close the editor opened for the file.
  13. Create the project's RSE-style messages file for translatable messages: right-click on the RSESamples project and select New->File to get the New File wizard. Enter rseSamplesMessages.xml for the file name, as was specified in the call to loadMessageFile in the plug-in class's constructor. Press Finish to create the file. You will see the XML editor open for the new file. Press the Source tab at the bottom of the editor, and enter the following lines (so that you can add messages to the file later on):
    
    <?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 -->
    <MessageFile Version="1.0">
         <Component Name="RSE Samples" Abbr="RSS">
              <Subcomponent Name="General" Abbr="G">
                    <MessageList>
                        <Message ID="1001" Indicator="E">
                              <LevelOne>Sample message</LevelOne>		
                              <LevelTwo>This is a sample with one substution variable: %1</LevelTwo>
                        </Message>
                    </MessageList>
              </Subcomponent>
         </Component>
    </MessageFile>
    
    Save and close the file.
  14. 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.