| <!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>RSE Base Plugin Class</title> |
| </head> |
| |
| <body bgcolor="#ffffff"> |
| <h1>RSE Base Plugin Class</h1> |
| <p>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. |
| </p> |
| <h2>Methods required in your plugin subclass</h2> |
| <p>To use the RSE base plugin class |
| <samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html">org.eclipse.rse.ui.SystemBasePlugin</A></samp>, |
| you subclass it for your own plugin class, and supply some key static methods of your own: |
| </p> |
| <ul> |
| <li><samp>getDefault()</samp>. Return a singleton instance of your plugin. |
| <li><samp>getResourceBundle()</samp>. Return the resource bundle for your plugin. This is stored in |
| a static field, initialized in your constructor by calling the <samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#loadResourceBundle(org.eclipse.core.runtime.IPluginDescriptor, java.lang.String)">loadResourceBundle(...)</A></samp> inherited method. |
| <li><samp>getString(String key)</samp>. Return a translated string by calling the inherited method |
| <samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#getString(java.util.ResourceBundle, java.lang.String)">getString(ResourceBundle rb, String key)</A></samp>, passing in the static resource bundle field. |
| <li><samp>getPluginMessageFile()</samp>. Return your RSE message file instance, initialized in your |
| constructor by calling <samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#loadMessageFile(org.eclipse.core.runtime.IPluginDescriptor, java.lang.String)">loadMessageFile(...)</A></samp>. |
| <li><samp>getPluginMessage(String msgID)</samp>. Return the |
| <samp><A href="../../../reference/api/org/eclipse/rse/services/clientserver/messages/SystemMessage.html">SystemMessage</A></samp> for the given ID, by |
| calling the inherited method |
| <samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#getMessage(org.eclipse.rse.services.clientserver.messages.SystemMessageFile, java.lang.String)">getMessage(getPluginMessageFile(), msgId)</a></samp>. You will call this method often to get message objects. |
| </ul> |
| <p>You may also override some RSE-supplied instance methods: |
| <ul> |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#initializeImageRegistry()">initializeImageRegistry()</A></samp>. Call |
| <samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#putImageInRegistry(java.lang.String, java.lang.String)">putImageInRegistry(String id, String imageFileName)</A></samp> |
| to load each of your images. |
| </ul> |
| </p> |
| <p>Of course, there are the usual eclipse-supplied instance methods to override too: |
| <ul> |
| <li><samp>initializeDefaultPreferences()</samp>. Good place to call the <samp>initDefaults()</samp> method of your preference pages. Be sure to call <samp>super.initializeDefaultPreferences()</samp>. |
| <li><samp>startup()</samp>. Good place to register adapters and so forth. Be sure to call <samp>super.startup()</samp> at the beginning. |
| <li><samp>shutdown()</samp>. Good place to close any open communication layers. Be sure to call <samp>super.shutdown()</samp> at the end. |
| </ul> |
| </p> |
| |
| <h2>Methods inherited from the RSE base class</h2> |
| <p>The methods you get access to by using the RSE-supplied base plugin class include:</p> |
| <ul> |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#getPluginId()">getPluginId()</A></samp>. Return this plugin's ID. |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#getActiveWorkbenchShell()">getActiveWorkbenchShell()</A></samp>. Return the shell of the active workbench window. |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#getActiveWorkbenchWindow()">getActiveWorkbenchWindow()</A></samp>. Return the active workbench window. |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#getWorkspaceRoot()">getWorkspaceRoot()</A></samp>. Return the root of the workspace. |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#getWorkspace()">getWorkspace()</A></samp>. Return the workspace root. |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#getInstallLocation()">getInstallLocation()</A></samp>. Return the install directory for this plugin. |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#getIconPath()">getIconPath()</A></samp>. Return the typical path for icons, relative to the plugin's folder: "icons/" |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#putImageInRegistry(java.lang.String, java.lang.String)">putImageInRegistry(String id, String fileName)</A></samp>. 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 |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#getImage(java.lang.String)">getImage(String id)</A></samp>. Return an Image given the ID with which it was registered in putImageInRegistry. |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#getImageDescriptor(java.lang.String)">getImageDescriptor(String id)</A></samp>. Return an ImageDescriptor given the ID with which it was registered in putImageInRegistry. |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#loadResourceBundle(org.eclipse.core.runtime.IPluginDescriptor, java.lang.String)">loadResourceBundle(IPluginDescriptor descriptor, String fileName)</A></samp>. Load a resource bundle, given its file name, relative to the given plugin's installation folder. |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#loadResourceBundle(java.lang.String)">loadResourceBundle(String fileName)</A></samp>. Load a resource bundle, given its file name, relative to this plugin's installation folder. |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#getString(java.util.ResourceBundle, java.lang.String)">getString(ResourceBundle rb, String id)</A></samp>. Return a translated string from a resource bundle, given its key ID. |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#getString(java.util.ResourceBundle, java.lang.String, java.lang.String)">getString(ResourceBundle rb, String id, String default)</A></samp>. 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. |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#loadMessageFile(org.eclipse.core.runtime.IPluginDescriptor, java.lang.String)">loadMessageFile(IPluginDescriptor descriptor,String fileName)</A></samp>. Parse an RSE-style message file into memory, given the plugin and message file name. |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#getMessage(org.eclipse.rse.services.clientserver.messages.SystemMessageFile, java.lang.String)">getMessage(SystemMessageFile msgFile, String msgId)</A></samp>. Retrieve a SystemMessage object, given the message file that contains it, and its message ID including component and subcomponent abbreviations. |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#scanForDuplicateMessages(org.eclipse.rse.services.clientserver.messages.SystemMessageFile)">scanForDuplicateMessages(SystemMessageFile msgFile)</A></samp>. Scan given message file for duplicate IDs. Typically only called during the development cycle. |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#printMessages(org.eclipse.rse.services.clientserver.messages.SystemMessageFile, java.lang.String)">printMessages(SystemMessageFile msgFile, String fullyQualifiedTargetFile)</A></samp>. Generate an HTML file documenting the messages in the given message file, given the fully qualified name of the target HTML file. |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#showProgrammerErrorMessage(java.lang.String)">showProgrammerErrorMessage(String msg)</A></samp>. Show a message to the user, when the message file support is not available. |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#logInfo(java.lang.String)">logInfo(String message)</A></samp>. Log an informational message to the RSE's core log file (<samp>.....\.metadata\.plugins\org.eclipse.rse.core\.log</samp>). |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#logWarning(java.lang.String)">logWarning(String message)</A></samp>. Log a warning message to the RSE's core log file (<samp>.....\.metadata\.plugins\org.eclipse.rse.core\.log</samp>). |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#logError(java.lang.String)">logError(String message)</A></samp>. Log an error message to the RSE's core log file (<samp>.....\.metadata\.plugins\org.eclipse.rse.core\.log</samp>). |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#logError(java.lang.String, java.lang.Throwable)">logError(String message, Throwable exception)</A></samp>. Log an error message resulting from an exception to the RSE's core log file (<samp>.....\.metadata\.plugins\org.eclipse.rse.core\.log</samp>). |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#logDebugMessage(java.lang.String, java.lang.String)">logDebugMessage(String prefix, String message)</A></samp>. Log a debug (trace) message to the RSE's core log file (<samp>.....\.metadata\.plugins\org.eclipse.rse.core\.log</samp>). |
| <li><samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html#getLogger()">getLogger()</A></samp>.Return the Logger instance for the RSE default logging file (<samp>.....\.metadata\.plugins\org.eclipse.rse.core\.log</samp>). |
| </ul> |
| </body> |
| </html> |