RSESamplesPlugin Class


package RSESamples;

import org.eclipse.ui.plugin.*;
import org.eclipse.core.runtime.*;
import org.eclipse.core.resources.*;
import java.util.*;

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.*;

/**
 * The main plugin class to be used in the desktop.
 */
public class RSESamplesPlugin extends SystemBasePlugin {
	//The shared instance.
	private static RSESamplesPlugin plugin;
	//Resource bundle.
	private ResourceBundle resourceBundle;
	private static SystemMessageFile 	messageFile = null;
	
	/**
	 * 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");
	}

	/**
	 * Returns the shared instance.
	 */
	public static RSESamplesPlugin getDefault() {
		return plugin;
	}

	/**
	 * Returns the workspace instance.
	 */
	public static IWorkspace getWorkspace() {
		return ResourcesPlugin.getWorkspace();
	}

	/**
	 * 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;
		//}
	}

	/**
	 * Returns the plugin's resource bundle,
	 */
	public ResourceBundle getResourceBundle() {
		return resourceBundle;
	}

	/**
	 * @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+ISampleConstants.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);
	}
}