X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/debug/ui/PHPDebugUiImages.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/debug/ui/PHPDebugUiImages.java index e447ff7..26bffa7 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/debug/ui/PHPDebugUiImages.java +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/debug/ui/PHPDebugUiImages.java @@ -13,31 +13,38 @@ import org.eclipse.swt.graphics.Image; public class PHPDebugUiImages { protected static final String NAME_PREFIX = "net.sourceforge.phpdt.debug.ui."; + protected static final int NAME_PREFIX_LENGTH = NAME_PREFIX.length(); + protected static URL iconBaseURL; static { - String pathSuffix = "icons/"; - try { - iconBaseURL = new URL(PHPDebugUiPlugin.getDefault().getDescriptor().getInstallURL(), pathSuffix); - } catch (MalformedURLException e) { - PHPDebugUiPlugin.log(e); - } + iconBaseURL = PHPDebugUiPlugin.getDefault().getBundle().getEntry( + "/icons/"); //$NON-NLS-1$ } + /* + * static { String pathSuffix = "icons/"; try { iconBaseURL = new + * URL(PHPDebugUiPlugin.getDefault().getDescriptor().getInstallURL(), + * pathSuffix); } catch (MalformedURLException e) { PHPDebugUiPlugin.log(e); } } + */ protected static final ImageRegistry IMAGE_REGISTRY = new ImageRegistry(); protected static final String CTOOL_PREFIX = "ctool16"; + protected static final String EVIEW_PREFIX = "eview16"; - public static final String IMG_EVIEW_ARGUMENTS_TAB = NAME_PREFIX + "arguments_tab.gif"; + public static final String IMG_EVIEW_ARGUMENTS_TAB = NAME_PREFIX + + "arguments_tab.gif"; - public static final ImageDescriptor DESC_EVIEW_ARGUMENTS_TAB = createManaged(EVIEW_PREFIX, IMG_EVIEW_ARGUMENTS_TAB); + public static final ImageDescriptor DESC_EVIEW_ARGUMENTS_TAB = createManaged( + EVIEW_PREFIX, IMG_EVIEW_ARGUMENTS_TAB); /** * Returns the image managed under the given key in this registry. * - * @param key the image's key + * @param key + * the image's key * @return the image managed under the given key */ public static Image get(String key) { @@ -45,16 +52,16 @@ public class PHPDebugUiImages { } /** - * Sets the three image descriptors for enabled, disabled, and hovered to an action. The actions - * are retrieved from the *tool16 folders. + * Sets the three image descriptors for enabled, disabled, and hovered to an + * action. The actions are retrieved from the *tool16 folders. */ public static void setToolImageDescriptors(IAction action, String iconName) { setImageDescriptors(action, "tool16", iconName); } /** - * Sets the three image descriptors for enabled, disabled, and hovered to an action. The actions - * are retrieved from the *lcl16 folders. + * Sets the three image descriptors for enabled, disabled, and hovered to an + * action. The actions are retrieved from the *lcl16 folders. */ public static void setLocalImageDescriptors(IAction action, String iconName) { setImageDescriptors(action, "lcl16", iconName); @@ -64,28 +71,36 @@ public class PHPDebugUiImages { return IMAGE_REGISTRY; } - //---- Helper methods to access icons on the file system -------------------------------------- + // ---- Helper methods to access icons on the file system + // -------------------------------------- - protected static void setImageDescriptors(IAction action, String type, String relPath) { + protected static void setImageDescriptors(IAction action, String type, + String relPath) { try { - ImageDescriptor id = ImageDescriptor.createFromURL(makeIconFileURL("d" + type, relPath)); + ImageDescriptor id = ImageDescriptor.createFromURL(makeIconFileURL( + "d" + type, relPath)); if (id != null) action.setDisabledImageDescriptor(id); - } catch (MalformedURLException e) {} + } catch (MalformedURLException e) { + } try { - ImageDescriptor id = ImageDescriptor.createFromURL(makeIconFileURL("c" + type, relPath)); + ImageDescriptor id = ImageDescriptor.createFromURL(makeIconFileURL( + "c" + type, relPath)); if (id != null) action.setHoverImageDescriptor(id); - } catch (MalformedURLException e) {} + } catch (MalformedURLException e) { + } action.setImageDescriptor(create("e" + type, relPath)); } protected static ImageDescriptor createManaged(String prefix, String name) { try { - ImageDescriptor result = ImageDescriptor.createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH))); + ImageDescriptor result = ImageDescriptor + .createFromURL(makeIconFileURL(prefix, name + .substring(NAME_PREFIX_LENGTH))); IMAGE_REGISTRY.put(name, result); return result; } catch (MalformedURLException e) { @@ -101,7 +116,8 @@ public class PHPDebugUiImages { } } - protected static URL makeIconFileURL(String prefix, String name) throws MalformedURLException { + protected static URL makeIconFileURL(String prefix, String name) + throws MalformedURLException { if (iconBaseURL == null) throw new MalformedURLException();