Bug 105231 - [BIDI] need to add $nl$/ to icon paths for reversed icons
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/AntUIImages.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/AntUIImages.java
index 7ace50c..cff98de 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/AntUIImages.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/AntUIImages.java
@@ -12,14 +12,15 @@
 package org.eclipse.ant.internal.ui;
 
 
-import java.net.MalformedURLException;
 import java.net.URL;
 
-import org.eclipse.jface.action.IAction;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.jface.resource.CompositeImageDescriptor;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.resource.ImageRegistry;
 import org.eclipse.swt.graphics.Image;
+import org.osgi.framework.Bundle;
 
 /**
  * The images provided by the external tools plugin.
@@ -36,20 +37,14 @@
 	 */
 	private static ImageDescriptorRegistry imageDescriptorRegistry;
 
-	/* Declare Common paths */
-	private static URL ICON_BASE_URL= null;
-
-	static {
-		String pathSuffix = "icons/full/"; //$NON-NLS-1$
-		ICON_BASE_URL= AntUIPlugin.getDefault().getBundle().getEntry(pathSuffix);
-	}
+    private static String ICONS_PATH = "$nl$/icons/full/"; //$NON-NLS-1$
 
 	// Use IPath and toOSString to build the names to ensure they have the slashes correct
-	private final static String LOCALTOOL= "elcl16/"; //basic colors - size 16x16 //$NON-NLS-1$
-	private final static String OBJECT= "obj16/"; //basic colors - size 16x16 //$NON-NLS-1$
-	private final static String OVR= "ovr16/"; //basic colors - size 7x8 //$NON-NLS-1$
-	private final static String WIZ= "wizban/"; //$NON-NLS-1$
-	private static final String T_ETOOL= "etool16"; 	//$NON-NLS-1$
+	private final static String LOCALTOOL= ICONS_PATH + "elcl16/"; //basic colors - size 16x16 //$NON-NLS-1$
+	private final static String OBJECT= ICONS_PATH + "obj16/"; //basic colors - size 16x16 //$NON-NLS-1$
+	private final static String OVR= ICONS_PATH + "ovr16/"; //basic colors - size 7x8 //$NON-NLS-1$
+	private final static String WIZ= ICONS_PATH + "wizban/"; //$NON-NLS-1$
+	private static final String T_ETOOL= ICONS_PATH + "etool16"; 	//$NON-NLS-1$
 	
 	/**
 	 * Declare all images
@@ -111,13 +106,15 @@
 	 *				this plugin class is found (i.e. typically the packages directory)
 	 */
 	private final static void declareRegistryImage(String key, String path) {
-		ImageDescriptor desc= ImageDescriptor.getMissingImageDescriptor();
-		try {
-			desc= ImageDescriptor.createFromURL(makeIconFileURL(path));
-		} catch (MalformedURLException me) {
-		}
-		imageRegistry.put(key, desc);
-	}
+        ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
+        Bundle bundle = Platform.getBundle(AntUIPlugin.getUniqueIdentifier());
+        URL url = null;
+        if (bundle != null) {
+            url = Platform.find(bundle, new Path(path));
+            desc = ImageDescriptor.createFromURL(url);
+        }
+        imageRegistry.put(key, desc);
+    }
 	
 	/**
 	 * Returns the ImageRegistry.
@@ -179,63 +176,6 @@
 		return getImageRegistry().getDescriptor(key);
 	}
 	
-	private static URL makeIconFileURL(String iconPath) throws MalformedURLException {
-		if (ICON_BASE_URL == null) {
-			throw new MalformedURLException();
-		}
-			
-		return new URL(ICON_BASE_URL, iconPath);
-	}
-	
-	/**
-	 * 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); //$NON-NLS-1$
-	}
-	
-	private static void setImageDescriptors(IAction action, String type, String relPath) {
-		
-		try {
-			ImageDescriptor id= ImageDescriptor.createFromURL(makeIconFileURL("d" + type, relPath)); //$NON-NLS-1$
-			if (id != null)
-				action.setDisabledImageDescriptor(id);
-		} catch (MalformedURLException e) {
-			AntUIPlugin.log(e);
-		}
-
-		try {
-			ImageDescriptor id= ImageDescriptor.createFromURL(makeIconFileURL("c" + type, relPath)); //$NON-NLS-1$
-			if (id != null)
-				action.setHoverImageDescriptor(id);
-		} catch (MalformedURLException e) {
-			AntUIPlugin.log(e);
-		}
-
-		action.setImageDescriptor(create("e" + type, relPath)); //$NON-NLS-1$
-	}
-	
-	private static URL makeIconFileURL(String prefix, String name) throws MalformedURLException {
-		if (ICON_BASE_URL == null) {
-			throw new MalformedURLException();
-		}
-		
-		StringBuffer buffer= new StringBuffer(prefix);
-		buffer.append('/');
-		buffer.append(name);
-		return new URL(ICON_BASE_URL, buffer.toString());
-	}
-	
-	private static ImageDescriptor create(String prefix, String name) {
-		try {
-			return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
-		} catch (MalformedURLException e) {
-			AntUIPlugin.log(e);
-			return ImageDescriptor.getMissingImageDescriptor();
-		}
-	}
-	
 	/** 
 	 * Returns the image for the given composite descriptor. 
 	 */
diff --git a/ant/org.eclipse.ant.ui/plugin.xml b/ant/org.eclipse.ant.ui/plugin.xml
index ae4be01..aa6b316 100644
--- a/ant/org.eclipse.ant.ui/plugin.xml
+++ b/ant/org.eclipse.ant.ui/plugin.xml
@@ -6,7 +6,7 @@
          point="org.eclipse.ui.editors">
       <editor
             name="%AntEditor.name"
-            icon="icons/full/obj16/ant_buildfile.gif"
+            icon="$nl$/icons/full/obj16/ant_buildfile.gif"
             class="org.eclipse.ant.internal.ui.editor.AntEditor"
             contributorClass="org.eclipse.ant.internal.ui.editor.AntEditorActionContributor"
             id="org.eclipse.ant.ui.internal.editor.AntEditor">
@@ -59,7 +59,7 @@
       </category>
       <view
             name="%View.antView"
-            icon="icons/full/eview16/ant_view.gif"
+            icon="$nl$/icons/full/eview16/ant_view.gif"
             category="org.eclipse.ant.ui.views"
             fastViewWidthRatio="0.40"
             class="org.eclipse.ant.internal.ui.views.AntView"
@@ -392,12 +392,12 @@
    <extension
          point="org.eclipse.debug.ui.launchConfigurationTypeImages">
       <launchConfigurationTypeImage
-            icon="icons/full/obj16/ant.gif"
+            icon="$nl$/icons/full/obj16/ant.gif"
             configTypeID="org.eclipse.ant.AntLaunchConfigurationType"
             id="org.eclipse.ant.launchConfigurationTypeImage.ant">
       </launchConfigurationTypeImage>
       <launchConfigurationTypeImage
-            icon="icons/full/obj16/ant.gif"
+            icon="$nl$/icons/full/obj16/ant.gif"
             configTypeID="org.eclipse.ant.AntBuilderLaunchConfigurationType"
             id="org.eclipse.ant.launchConfigurationTypeImage.ant.builder">
       </launchConfigurationTypeImage>
@@ -433,7 +433,7 @@
          point="org.eclipse.debug.ui.launchShortcuts">
       <shortcut
             label="%AntLaunchShortcut.label"
-            icon="icons/full/obj16/ant.gif"
+            icon="$nl$/icons/full/obj16/ant.gif"
             category="org.eclipse.ui.externaltools"
             helpContextId="org.eclipse.ui.externaltools.launchShortcutHelpContext.antShortcut"
             class="org.eclipse.ant.internal.ui.launchConfigurations.AntLaunchShortcut"
@@ -461,7 +461,7 @@
       </shortcut>
       <shortcut
             label="%AntLaunchShortcutWithDialog.label"
-            icon="icons/full/obj16/ant.gif"
+            icon="$nl$/icons/full/obj16/ant.gif"
             category="org.eclipse.ui.externaltools"
             helpContextId="org.eclipse.ui.externaltools.launchShortcutHelpContext.antShortcutWithDialog"
             class="org.eclipse.ant.internal.ui.launchConfigurations.AntLaunchShortcutWithDialog"
@@ -529,7 +529,7 @@
       <resolver
             name="%ant.resolvers.src"
             type="src"
-            icon="templates/resolver.gif"
+            icon="$nl$/templates/resolver.gif"
             description="%ant.resolvers.src.description"
             contextTypeId="org.eclipse.ant.ui.templateContextType.XML"
             class="org.eclipse.ant.internal.ui.editor.templates.AntVariableResolver">
@@ -537,7 +537,7 @@
       <resolver
             name="%ant.resolvers.dst"
             type="dst"
-            icon="templates/resolver.gif"
+            icon="$nl$/templates/resolver.gif"
             description="%ant.resolvers.dst.description"
             contextTypeId="org.eclipse.ant.ui.templateContextType.XML"
             class="org.eclipse.ant.internal.ui.editor.templates.AntVariableResolver">
@@ -557,7 +557,7 @@
          point="org.eclipse.ui.newWizards">
     <wizard
             name="%antNewJavaProjectWizard.name"
-            icon="icons/full/obj16/ant.gif"
+            icon="$nl$/icons/full/obj16/ant.gif"
             class="org.eclipse.ant.internal.ui.datatransfer.AntNewJavaProjectWizard"
             preferredPerspectives="org.eclipse.jdt.ui.JavaPerspective,org.eclipse.jdt.ui.JavaBrowsingPerspective,org.eclipse.jdt.ui.JavaHierarchyPerspective"
             project="true"
@@ -721,7 +721,7 @@
             id="org.eclipse.ant.ui.export" 
             name="%antExportWizard.name"
             class="org.eclipse.ant.internal.ui.datatransfer.AntBuildfileExportWizard" 
-            icon="icons/full/obj16/ant.gif">
+            icon="$nl$/icons/full/obj16/ant.gif">
          <description> 
             %antExportWizard.description
          </description>
@@ -740,8 +740,8 @@
   				toolbarPath="org.eclipse.ui.edit.text.actionSet.presentation/Presentation" 
   				id="org.eclipse.ant.ui.toggleMarkOccurrences" 
   				definitionId="org.eclipse.ant.ui.toggleMarkOccurrences"
-  				disabledIcon="icons/full/dtool16/mark_occurrences.gif" 
-  				icon="icons/full/etool16/mark_occurrences.gif" 
+  				disabledIcon="$nl$/icons/full/dtool16/mark_occurrences.gif" 
+  				icon="$nl$/icons/full/etool16/mark_occurrences.gif" 
   				label="%toggleMarkOccurrences.label" 
   				retarget="true" 
   				tooltip="%toggleMarkOccurrences.tooltip" />
@@ -749,8 +749,8 @@
   				style="toggle" 
   				toolbarPath="org.eclipse.ui.edit.text.actionSet.presentation/Presentation" 
   				id="org.eclipse.ant.ui.toggleAutoReconcile"
-  				disabledIcon="icons/full/dlcl16/refresh.gif" 
-  				icon="icons/full/elcl16/refresh.gif" 
+  				disabledIcon="$nl$/icons/full/dlcl16/refresh.gif" 
+  				icon="$nl$/icons/full/elcl16/refresh.gif" 
   				label="%toggleAutoReconcile.label" 
   				retarget="true" 
   				tooltip="%toggleAutoReconcile.tooltip" />