|
RSE Release 3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.core.runtime.Plugin
org.eclipse.ui.plugin.AbstractUIPlugin
org.eclipse.rse.ui.SystemBasePlugin
public abstract class SystemBasePlugin
A base plugin class offering common operations.
Field Summary | |
---|---|
protected static Logger |
log
Logger object for logging messages for servicing purposes. |
Fields inherited from class org.eclipse.core.runtime.Plugin |
---|
PLUGIN_PREFERENCE_SCOPE, PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME, PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME |
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()
|
Image |
getImage(String key)
Retrieves or creates an image based on its id. |
ImageDescriptor |
getImageDescriptor(String key)
Returns the image descriptor that has been registered to this id. |
ImageDescriptor |
getImageDescriptorFromIDE(String relativePath)
Returns an image descriptor from the base IDE. |
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(Bundle bundle,
String fileName)
Retrieve image in any plugin's directory tree, given its file name. |
ImageDescriptor |
getPluginImage(String imagePath)
Retrieve an image descriptor in this plugin's directory tree given its file name. |
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()
Deprecated. this method is useless right now because SystemBasePlugin is part of the rse.ui plugin which depends on workbench and therefore we can never load this class while actually being in headless mode. Normally this should return false however, because the javadoc says we "equate this to mean that the workbench is not running", it's possible early on that the method may return true if the workbench has not yet been instantiated - although it will later return false. |
static SystemMessageFile |
loadDefaultMessageFile(Bundle bundle,
String fileName)
Parse the given message file into memory, into a SystemMessageFile object. |
static SystemMessageFile |
loadMessageFile(Bundle bundle,
String fileName)
Parse the given message file into memory, into a SystemMessageFile object. |
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)
Construct an image descriptor from a file name and place it in the image descriptor registry. |
static URL |
resolveBundleNameNL(Bundle bundle,
String name)
Resolves the bundle relative name to its URL inside a bundle if the resource named by that name exists. |
static boolean |
scanForDuplicateMessages(SystemMessageFile msgFile)
Scan this plugin's message file for duplicates. |
void |
start(BundleContext context)
|
void |
stop(BundleContext context)
|
Methods inherited from class org.eclipse.ui.plugin.AbstractUIPlugin |
---|
createImageRegistry, getDialogSettings, getImageRegistry, getPreferenceStore, imageDescriptorFromPlugin, initializeDefaultPluginPreferences, initializeDefaultPreferences, initializeImageRegistry, loadDialogSettings, loadPreferenceStore, refreshPluginActions, saveDialogSettings, savePreferenceStore, shutdown, startup |
Methods inherited from class org.eclipse.core.runtime.Plugin |
---|
find, find, getBundle, getDescriptor, getLog, getPluginPreferences, getStateLocation, internalInitializeDefaultPluginPreferences, isDebugging, openStream, openStream, savePluginPreferences, setDebugging, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static Logger log
Constructor Detail |
---|
public SystemBasePlugin()
Method Detail |
---|
public static SystemBasePlugin getBaseDefault()
public static Shell getActiveWorkbenchShell()
public static IWorkbenchWindow getActiveWorkbenchWindow()
public static IWorkspaceRoot getWorkspaceRoot()
public static IWorkspace getWorkspace()
public static String getIconPath()
public static ImageDescriptor getPluginImage(Bundle bundle, String fileName)
public static final URL resolveBundleNameNL(Bundle bundle, String name)
bundle
- The bundle in which to look for the resourcename
- The name of the resource
public static final SystemMessageFile loadMessageFile(Bundle bundle, String fileName)
bundle
- -
the descriptor for this pluginfileName
- -
unqualified name of the .xml message file, inluding the .xml
extension.
public static final SystemMessageFile loadDefaultMessageFile(Bundle bundle, String fileName)
bundle
- -
the descriptor for this pluginfileName
- -
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)
SystemMessageFile.scanForDuplicates()
method on the SystemMessageFile object.
msgFile
- - the message file to scan
public static boolean printMessages(SystemMessageFile msgFile, String fullyQualifiedTargetFile)
SystemMessageFile.printHTML(String)
method on the SystemMessageFile object.
msgFile
- - the message file to print
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.
prefix
- - Class issuing the debug message. Typically you pass getClass().getName()message
- - Message to be written to the log filepublic String getSymbolicName()
public void start(BundleContext context) throws Exception
start
in interface BundleActivator
start
in class AbstractUIPlugin
Exception
BundleActivator.start(org.osgi.framework.BundleContext)
public void stop(BundleContext context) throws Exception
stop
in interface BundleActivator
stop
in class AbstractUIPlugin
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.
getWorkbench
in class AbstractUIPlugin
protected abstract void initializeImageRegistry()
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 imagePath)
imagePath
- the path name to the image relative to this bundle
public Image getImage(String key)
key
- the id of the image to retrieve.
public ImageDescriptor getImageDescriptor(String key)
key
- the id of the image descriptor to retrieve
public ImageDescriptor getImageDescriptorFromIDE(String relativePath)
ResourceNavigatorActionGroup
public Logger getLogger()
public boolean isHeadless()
|
RSE Release 3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |