# RSE Base Plugin Class

You may find it of value to base your own plugin class on the RSE-supplied base plugin class. If so, there are some methods you are encouraged to create or override in your class. The benefits of using this as your base class is the inherited methods you can access.

## Methods required in your plugin subclass

To use the RSE base plugin class `org.eclipse.rse.ui.SystemBasePlugin`, you subclass it for your own plugin class, and supply some key static methods of your own:

- `getDefault()`. Return a singleton instance of your plugin.
- `getResourceBundle()`. Return the resource bundle for your plugin. This is stored in a static field, initialized in your constructor by calling the `loadResourceBundle(...)` inherited method.
- `getString(String key)`. Return a translated string by calling the inherited method `getString(ResourceBundle rb, String key)`, passing in the static resource bundle field.
- `getPluginMessageFile()`. Return your RSE message file instance, initialized in your constructor by calling `loadMessageFile(...)`.
- `getPluginMessage(String msgID)`. Return the `SystemMessage` for the given ID, by calling the inherited method `getMessage(getPluginMessageFile(), msgId)`. You will call this method often to get message objects.

You may also override some RSE-supplied instance methods:

- `initializeImageRegistry()`. Call `putImageInRegistry(String id, String imageFileName)` to load each of your images.

Of course, there are the usual eclipse-supplied instance methods to override too:

- `initializeDefaultPreferences()`. Good place to call the `initDefaults()` method of your preference pages. Be sure to call `super.initializeDefaultPreferences()`.
- `startup()`. Good place to register adapters and so forth. Be sure to call `super.startup()` at the beginning.
- `shutdown()`. Good place to close any open communication layers. Be sure to call `super.shutdown()` at the end.

## Methods inherited from the RSE base class

The methods you get access to by using the RSE-supplied base plugin class include:

- `getPluginId()`. Return this plugin's ID.
- `getActiveWorkbenchShell()`. Return the shell of the active workbench window.
- `getActiveWorkbenchWindow()`. Return the active workbench window.
- `getWorkspaceRoot()`. Return the root of the workspace.
- `getWorkspace()`. Return the workspace root.
- `getInstallLocation()`. Return the install directory for this plugin.
- `getIconPath()`. Return the typical path for icons, relative to the plugin's folder: "icons/"
- `putImageInRegistry(String id, String fileName)`. Load an image in the image registry, given the ID to retrieve it with, and its filename and path relative to this plugin's folder
- `getImage(String id)`. Return an Image given the ID with which it was registered in putImageInRegistry.
- `getImageDescriptor(String id)`. Return an ImageDescriptor given the ID with which it was registered in putImageInRegistry.
- `loadResourceBundle(IPluginDescriptor descriptor, String fileName)`. Load a resource bundle, given its file name, relative to the given plugin's installation folder.
- `loadResourceBundle(String fileName)`. Load a resource bundle, given its file name, relative to this plugin's installation folder.
- `getString(ResourceBundle rb, String id)`. Return a translated string from a resource bundle, given its key ID.
- `getString(ResourceBundle rb, String id, String default)`. Return a translated string from a resource bundle, given its key ID. If key not found in the resource bundle, returns the given default string.
- `loadMessageFile(IPluginDescriptor descriptor,String fileName)`. Parse an RSE-style message file into memory, given the plugin and message file name.
- `getMessage(SystemMessageFile msgFile, String msgId)`. Retrieve a SystemMessage object, given the message file that contains it, and its message ID including component and subcomponent abbreviations.
- `scanForDuplicateMessages(SystemMessageFile msgFile)`. Scan given message file for duplicate IDs. Typically only called during the development cycle.
- `printMessages(SystemMessageFile msgFile, String fullyQualifiedTargetFile)`. Generate an HTML file documenting the messages in the given message file, given the fully qualified name of the target HTML file.
- `showProgrammerErrorMessage(String msg)`. Show a message to the user, when the message file support is not available.
- `logInfo(String message)`. Log an informational message to the RSE's core log file (`.....\.metadata\.plugins\org.eclipse.rse.core\.log`).
- `logWarning(String message)`. Log a warning message to the RSE's core log file (`.....\.metadata\.plugins\org.eclipse.rse.core\.log`).
- `logError(String message)`. Log an error message to the RSE's core log file (`.....\.metadata\.plugins\org.eclipse.rse.core\.log`).
- `logError(String message, Throwable exception)`. Log an error message resulting from an exception to the RSE's core log file (`.....\.metadata\.plugins\org.eclipse.rse.core\.log`).
- `logDebugMessage(String prefix, String message)`. Log a debug (trace) message to the RSE's core log file (`.....\.metadata\.plugins\org.eclipse.rse.core\.log`).
- `getLogger()`.Return the Logger instance for the RSE default logging file (`.....\.metadata\.plugins\org.eclipse.rse.core\.log`).