# Changes to Plug-in Class

Here are the steps to change the wizard-generated plug-in class to extend the RSE plug-in class.

1. Add the following import statements to the top of `RSESamplesPlugin.java`:

               import com.ibm.etools.systems.core.*;
               import com.ibm.etools.systems.core.ui.messages.*;
               import org.eclipse.swt.graphics.Image;
               import org.eclipse.jface.preference.*;

2. Change the extends clause in the class declaration to extend `SystemBasePlugin` instead of `AbstractUIPlugin`:

               public class RSESamplesPlugin extends SystemBasePlugin {

3. Add the following class field declaration:

       	    private static SystemMessageFile messageFile = null;

4. Change the constructor as highlighted here:

       	/**
       	 * The constructor.
       	 */
       	public RSESamplesPlugin(IPluginDescriptor descriptor) {
       		super(descriptor, "RSESamples");
       		plugin = this;
       		//try {
       		//	resourceBundle= ResourceBundle.getBundle("RSESamples.RSESamplesPluginResources");
       		//} catch (MissingResourceException x) {
       		//	resourceBundle = null;
       		//}
       		resourceBundle = loadResourceBundle(descriptor,"rseSamplesResources");
       		messageFile = loadMessageFile(descriptor,"rseSamplesMessages.xml");
       	}

5. Change the `getResourceString` method as highlighted here:

       	/**
       	 * Returns the string from the plugin's resource bundle,
       	 * or 'key' if not found.
       	 */
       	public static String getResourceString(String key) {
       		ResourceBundle bundle= RSESamplesPlugin.getDefault().getResourceBundle();
       		return getString(bundle, key); // inherited method.
       		//try {
       		//	return bundle.getString(key);
       		//} catch (MissingResourceException e) {
       		//	return key;
       		//}
       	}

6. Add the following methods to the end of the class:

           /**
            * @see AbstractUIPlugin#initializeDefaultPreferences
            */
       	protected void initializeDefaultPreferences(IPreferenceStore store)
           {
               super.initializeDefaultPreferences(store);
               //RSESamplesPreferencePage.initDefaults(store);
           }
           /**
            *	Initialize the image registry by declaring all of the required graphics.
            */
           protected void initializeImageRegistry()
           {
           	String path = getIconPath();
           	//putImageInRegistry(ISamplesConstants.ICON_XXX_ID,
           	//  			       path+ISamplesConstants.ICON_XXX);
           	// TO RETRIEVE AN ICON, CALL GETIMAGE OR GETIMAGEDESCRIPTOR WITH ITS XXX_ID ID
           }
           /**
            * Starts up this plug-in and returns whether startup was successful.
            */
           public void startup() throws CoreException
           {
           	super.startup();
           }
           /**
            * Return our message file
            */
           public static SystemMessageFile getPluginMessageFile()
           {
           	return messageFile;
           }
           /**
            * Retrieve a message from this plugin's message file
            */
           public static SystemMessage getPluginMessage(String msgId)
           {
           	return getMessage(messageFile, msgId);
           }

7. Click here to see the full finished class.