diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemIconConstants.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemIconConstants.java index 48a3559d363..376e8771db6 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemIconConstants.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemIconConstants.java @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Michael Berger (IBM) - 146339 Added refresh action graphic. ********************************************************************************/ package org.eclipse.rse.ui; @@ -22,7 +22,7 @@ package org.eclipse.rse.ui; public interface ISystemIconConstants { public static final String PLUGIN_ID ="org.eclipse.rse.ui"; - public static final String PREFIX = PLUGIN_ID+"."; + public static final String PREFIX = PLUGIN_ID + "."; public static final String SEP = "/"; // Icons @@ -342,6 +342,10 @@ public interface ISystemIconConstants public static final String ICON_SYSTEM_EXPORT_SHELL_HISTORY = ICON_ACTIONS_DIR + ICON_SYSTEM_EXPORT_SHELL_HISTORY_ROOT + ICON_EXT; public static final String ICON_SYSTEM_EXPORT_SHELL_HISTORY_ID = PREFIX + ICON_SYSTEM_EXPORT_SHELL_HISTORY_ROOT + ICON_SUFFIX; + public static final String ICON_SYSTEM_REFRESH_ROOT = "refresh_nav"; + public static final String ICON_SYSTEM_REFRESH = ICON_ACTIONS_DIR + ICON_SYSTEM_REFRESH_ROOT + ICON_EXT; + public static final String ICON_SYSTEM_REFRESH_ID = PREFIX + ICON_SYSTEM_REFRESH_ROOT + ICON_SUFFIX; + // SPECIAL MODEL OBJECT ICONS... public static final String ICON_OBJS_DIR = SEP + "full" + SEP + "obj16" + SEP; public static final String ICON_SYSTEM_ERROR_ROOT = "error"; diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java index 3f05ec66a8d..83501504a5d 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java @@ -197,10 +197,9 @@ public class RSEUIPlugin extends SystemBasePlugin return !dontShowProfilePageInitially; } - /** - * Initialize the image registry by declaring all of the required - * graphics. - */ + /* (non-Javadoc) + * @see org.eclipse.rse.core.SystemBasePlugin#initializeImageRegistry() + */ protected void initializeImageRegistry() { //SystemElapsedTimer timer = new SystemElapsedTimer(); @@ -376,8 +375,8 @@ public class RSEUIPlugin extends SystemBasePlugin putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_WORKWITHCOMPILECMDS_ID, path+ISystemIconConstants.ICON_SYSTEM_WORKWITHCOMPILECMDS); - // putImageInRegistry(ISystemConstants.ICON_SYSTEM_REFRESH_ID, - // path+ISystemConstants.ICON_SYSTEM_REFRESH); D54577 + putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_REFRESH_ID, + path+ISystemIconConstants.ICON_SYSTEM_REFRESH); putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_NEWFILE_ID, path+ISystemIconConstants.ICON_SYSTEM_NEWFILE); diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAction.java index 334d4047f48..02725a191e6 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAction.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAction.java @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Michael Berger (IBM) - 146339 Added refresh action graphic. ********************************************************************************/ package org.eclipse.rse.ui.actions; @@ -44,7 +44,7 @@ public class SystemRefreshAction extends SystemBaseAction public SystemRefreshAction(Shell parent) { super(SystemResources.ACTION_REFRESH_LABEL, SystemResources.ACTION_REFRESH_TOOLTIP, - RSEUIPlugin.getDefault().getImageDescriptorFromIDE(ISystemIconConstants.ICON_IDE_REFRESH_ID), // D54577 + RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_REFRESH_ID), // D54577 parent); allowOnMultipleSelection(true); setContextMenuGroup(ISystemContextMenuConstants.GROUP_BUILD); diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsRefreshAllAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsRefreshAllAction.java index 92ee88c23e0..116cdf1690e 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsRefreshAllAction.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsRefreshAllAction.java @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Michael Berger (IBM) - 146339 Added refresh action graphic. ********************************************************************************/ package org.eclipse.rse.ui.filters.actions; @@ -43,7 +43,7 @@ public class SystemFilterWorkWithFilterPoolsRefreshAllAction extends SystemBaseA public SystemFilterWorkWithFilterPoolsRefreshAllAction(TreeViewer viewer, Shell parent) { super(SystemResources.ACTION_REFRESH_ALL_LABEL,SystemResources.ACTION_REFRESH_ALL_TOOLTIP, - RSEUIPlugin.getDefault().getImageDescriptorFromIDE(ISystemIconConstants.ICON_IDE_REFRESH_ID), + RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_REFRESH_ID), parent); this.viewer = viewer; allowOnMultipleSelection(true); diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewPart.java index f59f6855f8e..0e6b63eb2f4 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewPart.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewPart.java @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Michael Berger (IBM) - 146339 Added refresh action graphic. ********************************************************************************/ package org.eclipse.rse.ui.view; @@ -318,7 +318,7 @@ public class SystemTableViewPart extends ViewPart implements ISelectionListener, { super(SystemResources.ACTION_REFRESH_LABEL, //RSEUIPlugin.getDefault().getImageDescriptor(ICON_SYSTEM_REFRESH_ID)); - RSEUIPlugin.getDefault().getImageDescriptorFromIDE(ISystemIconConstants.ICON_IDE_REFRESH_ID)); + RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_REFRESH_ID)); } public void run() diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/SystemMonitorViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/SystemMonitorViewPart.java index 8fef5c25034..081785839ad 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/SystemMonitorViewPart.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/SystemMonitorViewPart.java @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Michael Berger (IBM) - 146339 Added refresh action graphic. ********************************************************************************/ package org.eclipse.rse.ui.view.monitor; @@ -279,7 +279,7 @@ class SubSetAction extends BrowseAction { super(SystemMonitorViewPart.this, SystemResources.ACTION_REFRESH_LABEL, //RSEUIPlugin.getDefault().getImageDescriptor(ICON_SYSTEM_REFRESH_ID)); - RSEUIPlugin.getDefault().getImageDescriptorFromIDE(ISystemIconConstants.ICON_IDE_REFRESH_ID)); + RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_REFRESH_ID)); setTitleToolTip(SystemResources.ACTION_REFRESH_TOOLTIP); } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewRefreshAllAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewRefreshAllAction.java index 4cdc67a2513..7aa5c93b6a3 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewRefreshAllAction.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewRefreshAllAction.java @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Michael Berger (IBM) - 146339 Added refresh action graphic. ********************************************************************************/ package org.eclipse.rse.ui.view.team; @@ -40,7 +40,7 @@ public class SystemTeamViewRefreshAllAction extends SystemBaseAction public SystemTeamViewRefreshAllAction(Shell parent, SystemTeamViewPart teamView) { super(SystemResources.ACTION_REFRESH_ALL_LABEL,SystemResources.ACTION_REFRESH_ALL_TOOLTIP, - RSEUIPlugin.getDefault().getImageDescriptorFromIDE(ISystemIconConstants.ICON_IDE_REFRESH_ID), + RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_REFRESH_ID), parent); this.teamView = teamView; allowOnMultipleSelection(true); diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/refresh_nav.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/refresh_nav.gif new file mode 100755 index 00000000000..049cac696c3 Binary files /dev/null and b/rse/plugins/org.eclipse.rse.ui/icons/full/elcl16/refresh_nav.gif differ diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemBasePlugin.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemBasePlugin.java index 959992cc4a5..1555533d42f 100644 --- a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemBasePlugin.java +++ b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemBasePlugin.java @@ -20,9 +20,6 @@ import java.io.InputStream; import java.net.URL; import java.util.Hashtable; import java.util.Locale; -import java.util.MissingResourceException; -import java.util.PropertyResourceBundle; -import java.util.ResourceBundle; import java.util.Stack; import org.eclipse.core.resources.IWorkspace; @@ -67,8 +64,7 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin protected static Logger log = null; // instance variables - private Hashtable imageDescriptorRegistry = new Hashtable(); - private ImageRegistry imageRegistry = null; + private Hashtable imageDescriptorRegistry = null; private boolean headless; private boolean headlessSet; @@ -152,10 +148,9 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin } /** - * Helper to get the typical icons path ... usually just "icons/". + * @return the prefix of the path for icons, i.e. "icons/". */ - public static String getIconPath() - { + public static String getIconPath() { return ICON_PATH; } @@ -778,97 +773,103 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin return wb; } - // ---------------------------------- - // ICON METHODS... - // ---------------------------------- - /** - * Initialize the image registry by declaring all of the required - * graphics. Typically this is a series of calls to putImageInRegistry. - * Use getIconPath() to qualify the file name of the icon with its - * relative path. + * Initialize the image registry by declaring all of the required graphics. + * Typically this is a series of calls to putImageInRegistry. Use + * getIconPath() to qualify the file name of the icons with their relative + * path. */ - protected abstract void initializeImageRegistry(); + protected abstract void initializeImageRegistry(); /** - * Helper method to put an image into the registry + * Construct an image descriptor from a file name and place it in the + * image descriptor registry. Actual image construction is delayed until first use. * @param id - an arbitrary ID to assign to this image. Used later when retrieving it. * @param fileName - the name of the icon file, with extension, relative to this plugin's folder. + * @return the image descriptor for this particular id. + * @see SystemBasePlugin#getImage(String); */ protected ImageDescriptor putImageInRegistry(String id, String fileName) { ImageDescriptor fid = getPluginImage(fileName); - imageRegistry.put(id, fid); - - // Because ImageRegistry only allows you to get an image, and not an ImageDescriptor, - // we have to redundantly save the image descriptors for cases when they are needed, - // such as in WizardPage.... - imageDescriptorRegistry.put(id, fid); - - if (imageRegistry.get(id) == null) - logError("Error loading image: " + fileName); - + Hashtable t = getImageDescriptorRegistry(); + t.put(id, fid); return fid; } /** - * Retrieve image in this plugin's directory tree, given its file name. - * The file name should be qualified relative to this plugin's bundle. Eg "icons/myicon.gif" - */ - public ImageDescriptor getPluginImage(String fileName) - { - return getPluginImage(getBundle(), fileName); - } + * Retrieve an image descriptor in this plugin's directory tree given its file name. The + * file name should be qualified relative to this plugin's bundle. + * For example "icons/myicon.gif" + * @parm imagePath the path name to the image relative to this bundle + * @return the image descriptor + */ + public ImageDescriptor getPluginImage(String imagePath) { + return getPluginImage(getBundle(), imagePath); + } /** - * Easy retrieval of image by id + * Retrieves or creates an image based on its id. The image is then stored + * in the image registry if it is created so that it may be retrieved again. + * Thus, image resources retrieved in this way need not be disposed by the + * caller. + * + * @parm key the id of the image to retrieve. + * @return the Image resource for this id. */ public Image getImage(String key) { - if (imageRegistry == null) { - imageRegistry = new ImageRegistry(); - initializeImageRegistry(); - } - - Image image = null; - - try - { - image = imageRegistry.get(key); - } - catch (Throwable t) - { - logError("...error retrieving image for key: " + key); - } - return image; + // First check the image registry + ImageRegistry imageRegistry = getImageRegistry(); + Image image = imageRegistry.get(key); + if (image == null) { // check the image descriptor registry + ImageDescriptor descriptor = getImageDescriptor(key); + if (descriptor != null) { + imageRegistry.put(key, descriptor); + image = imageRegistry.get(key); + } else { + logError("...error retrieving image for key: " + key); + } + } + return image; } /** - * Easy retrieval of image descriptor by id + * Returns the image descriptor that has been registered to this id. + * @parm key the id of the image descriptor to retrieve + * @return an ImageDescriptor */ - public ImageDescriptor getImageDescriptor(String key) - { - if (imageRegistry == null) - { - imageRegistry = new ImageRegistry(); - initializeImageRegistry(); - } - - ImageDescriptor image = (ImageDescriptor)imageDescriptorRegistry.get(key); - - return image; - } + public ImageDescriptor getImageDescriptor(String key) { + Hashtable t = getImageDescriptorRegistry(); + ImageDescriptor descriptor = (ImageDescriptor) t.get(key); + return descriptor; + } + + /** + * Gets the hashtable that is the image descriptor registry. Creates and populates + * it if necessary. + * @return The image descriptor registry hashtable. + */ + private Hashtable getImageDescriptorRegistry() { + if (imageDescriptorRegistry == null) { + imageDescriptorRegistry = new Hashtable(); + initializeImageRegistry(); + } + return imageDescriptorRegistry; + } /** * Returns an image descriptor from the base IDE. - * @see org.eclipse.ui.views.navigator.ResourceNavigatorActionGroup#getImageDescriptor(java.lang.String) + * + * @see org.eclipse.ui.views.navigator.ResourceNavigatorActionGroup#getImageDescriptor(java.lang.String) */ public ImageDescriptor getImageDescriptorFromIDE(String relativePath) { - String iconPath = "icons/full/"; //$NON-NLS-1$ - String key = iconPath + relativePath; - ImageDescriptor descriptor = (ImageDescriptor)imageDescriptorRegistry.get(key); + Hashtable registry = getImageDescriptorRegistry(); + ImageDescriptor descriptor = (ImageDescriptor)registry.get(relativePath); if (descriptor == null) { + String iconPath = "icons/full/"; //$NON-NLS-1$ + String key = iconPath + relativePath; String[] bundleNames = new String[] {"org.eclipse.ui", "org.eclipse.ui.ide"}; for (int i = 0; (i < bundleNames.length) && (descriptor == null); i++) { String bundleName = bundleNames[i]; @@ -881,20 +882,9 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin if (descriptor == null) { descriptor = ImageDescriptor.getMissingImageDescriptor(); } - imageDescriptorRegistry.put(key, descriptor); + registry.put(relativePath, descriptor); } return descriptor; -// try { -// Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID); -// URL installURL = bundle.getEntry("/"); -// URL url = new URL(installURL, key); -// image = ImageDescriptor.createFromURL(url); -// imageDescriptorRegistry.put(key, image); -// return image; -// } catch (MalformedURLException e) { -// // should not happen -// return ImageDescriptor.getMissingImageDescriptor(); -// } } // ----------------------------------------