#1365431 (toshihiro) - PHP Editor crashes Windows with JavaScript 'windows.close()'
[phpeclipse.git] / net.sourceforge.phpeclipse.debug.ui / src / net / sourceforge / phpdt / debug / ui / PHPDebugUiImages.java
index 77a48a9..26bffa7 100644 (file)
@@ -3,48 +3,48 @@ package net.sourceforge.phpdt.debug.ui;
 import java.net.MalformedURLException;
 import java.net.URL;
 
-// import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiPlugin;
+import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiPlugin;
 
-//import org.eclipse.jdt.internal.ui.JavaPlugin;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.resource.ImageRegistry;
 import org.eclipse.swt.graphics.Image;
-import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiPlugin;
 
 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 {
-               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);
-               }
+               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) {
@@ -52,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);
@@ -71,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) {
@@ -108,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();