|
Remote Systems v6.4.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectAbstractUIPlugin
com.ibm.etools.systems.core.SystemBasePlugin
A base plugin class offering common operations.
Field Summary | |
---|---|
static String |
copyright
|
protected static String |
ICON_PATH
Default folder for icons, relative to this plugin's install folder: "icons\". |
protected static Logger |
log
Logger object for logging messages for servicing purposes. |
Constructor Summary | |
---|---|
SystemBasePlugin()
Constructor. |
Method Summary | |
---|---|
static Shell |
getActiveWorkbenchShell()
Returns the active workbench shell. |
static IWorkbenchWindow |
getActiveWorkbenchWindow()
Returns the active workbench window. |
static SystemBasePlugin |
getBaseDefault()
Returns the singleton object representing the base plugin. |
static String |
getIconPath()
Helper to get the typical icons path ... usually just "icons\". |
Image |
getImage(String key)
Easy retrieval of image by id |
ImageDescriptor |
getImageDescriptor(String key)
Easy retrieval of image descriptor by id |
ImageDescriptor |
getImageDescriptorFromIDE(String relativePath)
Returns an image descriptor from the base IDE. |
protected IPath |
getInstallLocation()
Return the fully qualified install directory for this plugin. |
Logger |
getLogger()
Get the logger for this plugin. |
static SystemMessage |
getMessage(SystemMessageFile msgFile,
String msgId)
Retrieve a message from a message file. |
static ImageDescriptor |
getPluginImage(org.osgi.framework.Bundle bundle,
String fileName)
Retrieve image in any plugin's directory tree, given its file name. |
ImageDescriptor |
getPluginImage(String fileName)
Retrieve image in this plugin's directory tree, given its file name. |
static String |
getString(ResourceBundle resourceBundle,
String key)
Get a string from a given resource bundle. |
static String |
getString(ResourceBundle resourceBundle,
String key,
String defaultString)
Get a string from a given resource bundle, with an english string to use a default if the given key is not found. |
String |
getSymbolicName()
Returns the symbolic name of the bundle. |
IWorkbench |
getWorkbench()
Returns the Platform UI workbench. |
static IWorkspace |
getWorkspace()
Returns the workspace. |
static IWorkspaceRoot |
getWorkspaceRoot()
Returns the workspace root. |
protected abstract void |
initializeImageRegistry()
Initialize the image registry by declaring all of the required graphics. |
boolean |
isHeadless()
Return true if we are running in a headless environment. |
static SystemMessageFile |
loadDefaultMessageFile(org.osgi.framework.Bundle bundle,
String fileName)
Parse the given message file into memory, into a SystemMessageFile object. |
SystemMessageFile |
loadDefaultMessageFile(String fileName)
Parse the given message file that is in the plugin into memory, into a SystemMessageFile object. |
static ResourceBundle |
loadDefaultResourceBundle(org.osgi.framework.Bundle bundle,
String fileName)
Sets the default resource bundle for handling cases where strings aren't translated. |
ResourceBundle |
loadDefaultResourceBundle(String fileName)
Sets the default resource bundle (so that untranslated strings can be obtained). |
static SystemMessageFile |
loadMessageFile(org.osgi.framework.Bundle bundle,
String fileName)
Parse the given message file into memory, into a SystemMessageFile object. |
SystemMessageFile |
loadMessageFile(String fileName)
Parse the given message file that is in the plugin into memory, into a SystemMessageFile object. |
static ResourceBundle |
loadPluginResourceBundle(org.osgi.framework.Bundle bundle)
Returns the plugin.properties resource bundle associated with the specified plugin descriptor |
static ResourceBundle |
loadResourceBundle(org.osgi.framework.Bundle bundle,
String fileName)
Sets the resource bundle. |
ResourceBundle |
loadResourceBundle(String fileName)
Sets the resource bundle. |
static void |
logDebugMessage(String prefix,
String message)
Helper method for logging debug messages to the RSE-style logging file. |
static void |
logError(String message)
Helper method for logging errors (but not exceptions) to the RSE-style logging file. |
static void |
logError(String message,
Throwable exception)
Helper method for logging errors (exceptions) to the RSE-style logging file. |
static void |
logInfo(String message)
Helper method for logging information to the RSE-style logging file. |
static void |
logMessage(SystemMessage message)
Helper method for logging information to the RSE-style logging file. |
static void |
logMessage(SystemMessage message,
Throwable ex)
Helper method for logging information to the RSE-style logging file. |
static void |
logWarning(String message)
Helper method for logging warnings to the RSE-style logging file. |
static boolean |
printMessages(SystemMessageFile msgFile,
String fullyQualifiedTargetFile)
Generate HTML from this plugin's message file. |
protected ImageDescriptor |
putImageInRegistry(String id,
String fileName)
Helper method to put an image into the registry |
static boolean |
scanForDuplicateMessages(SystemMessageFile msgFile)
Scan this plugin's message file for duplicates. |
void |
showProgrammerErrorMessage(String msg)
Put up an error message when a programming error is detected. |
void |
start(org.osgi.framework.BundleContext context)
|
void |
stop(org.osgi.framework.BundleContext context)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String copyright
protected static final String ICON_PATH
protected static Logger log
Constructor Detail |
public SystemBasePlugin()
Method Detail |
public static SystemBasePlugin getBaseDefault()
public String getSymbolicName()
public static Shell getActiveWorkbenchShell()
public static IWorkbenchWindow getActiveWorkbenchWindow()
public static IWorkspaceRoot getWorkspaceRoot()
public static IWorkspace getWorkspace()
protected IPath getInstallLocation()
public void start(org.osgi.framework.BundleContext context) throws Exception
Exception
BundleActivator.start(org.osgi.framework.BundleContext)
public void stop(org.osgi.framework.BundleContext context) throws Exception
Exception
BundleActivator.stop(org.osgi.framework.BundleContext)
public IWorkbench getWorkbench()
This method exists as a convenience for plugin implementors. The
workbench can also be accessed by invoking PlatformUI.getWorkbench()
.
This is an intercept of the AbstractUIPlugin method, so we can do a try/catch around it, as it will throw an exception if we are running headless, in which case the workbench has not even been started.
protected abstract void initializeImageRegistry()
public final SystemMessageFile loadMessageFile(String fileName)
fileName
- - unqualified name of the .xml message file, inluding the .xml extension.
public static String getIconPath()
protected ImageDescriptor putImageInRegistry(String id, String fileName)
id
- - an arbitrary ID to assign to this image. Used later when retrieving it.fileName
- - the name of the icon file, with extension, relative to this plugin's folder.public ImageDescriptor getPluginImage(String fileName)
public static ImageDescriptor getPluginImage(org.osgi.framework.Bundle bundle, String fileName)
public Image getImage(String key)
public ImageDescriptor getImageDescriptor(String key)
public ImageDescriptor getImageDescriptorFromIDE(String relativePath)
ResourceNavigatorActionGroup
public static final ResourceBundle loadResourceBundle(org.osgi.framework.Bundle bundle, String fileName)
public static final ResourceBundle loadPluginResourceBundle(org.osgi.framework.Bundle bundle)
public static final ResourceBundle loadDefaultResourceBundle(org.osgi.framework.Bundle bundle, String fileName)
public final ResourceBundle loadResourceBundle(String fileName)
public final ResourceBundle loadDefaultResourceBundle(String fileName)
public static String getString(ResourceBundle resourceBundle, String key)
public static String getString(ResourceBundle resourceBundle, String key, String defaultString)
If not found, stack trace info is placed in the plugin's log file to help pinpoint the offending code.
public static final SystemMessageFile loadMessageFile(org.osgi.framework.Bundle bundle, String fileName)
fileName
- - unqualified name of the .xml message file, inluding the .xml extension.
public static final SystemMessageFile loadDefaultMessageFile(org.osgi.framework.Bundle bundle, String fileName)
fileName
- - unqualified name of the .xml message file, inluding the .xml extension.
public final SystemMessageFile loadDefaultMessageFile(String fileName)
fileName
- - unqualified name of the .xml message file, inluding the .xml extension.
public static SystemMessage getMessage(SystemMessageFile msgFile, String msgId)
msgFile
- - the system message file containing the message.msgId
- - the ID of the message to retrieve. This is the concatenation of the
message's component abbreviation, subcomponent abbreviation, and message ID as declared
in the message xml file.public static boolean scanForDuplicateMessages(SystemMessageFile msgFile)
com.ibm.etools.systems.core.ui.messages.SystemMessageFile#scanForDuplicates()
method on the SystemMessageFile object.
msgFile
- - the message file to scan
public static boolean printMessages(SystemMessageFile msgFile, String fullyQualifiedTargetFile)
com.ibm.etools.systems.core.ui.messages.SystemMessageFile#printHTML(String)
method on the SystemMessageFile object.
msgFile
- - the message file to print
public void showProgrammerErrorMessage(String msg)
public static void logMessage(SystemMessage message)
message
- - System message to be written to the log filepublic static void logMessage(SystemMessage message, Throwable ex)
message
- - System message to be written to the log fileex
- - Exception to log. If not applicable, this can be null.public static void logInfo(String message)
Because this is an information message, it will only actually be logged if the user has enabled logging of information messages via the Logging preferences page within the Remote Systems preference pages tree.
message
- - Message to be written to the log filepublic static void logWarning(String message)
Because this is a warning message, it will only actually be logged if the user has enabled logging of warning messages via the Logging preferences page within the Remote Systems preference pages tree.
message
- - Message to be written to the log file
Because these messages are only used for servicing purposes, the message typically is not translated.public static void logError(String message)
Because this is an error message, it is always logged, no matter what the preferences settings for the logger.
message
- - Message to be written to the log file
Because these messages are only used for servicing purposes, the message typically is not translated.public static void logError(String message, Throwable exception)
Because this is an error message, it is always logged, no matter what the preferences settings for the logger.
message
- - Message to be written to the log file.
Because these messages are only used for servicing purposes, the message typically is not translated.exception
- - Any exception that generated the error condition. Used to print a stack trace in the log file.
If you pass null, it is the same as calling logError(String)
public static void logDebugMessage(String prefix, String message)
Debug messages are only logged when running this plugin in the workbench, and when Logger.DEBUG has been set to true.
message
- - Message to be written to the log filepublic Logger getLogger()
public boolean isHeadless()
|
Remote Systems v6.4.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |