1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 22:25:25 +02:00

Changed the way images URLs are constructed. Used "/" as separator everywhere instead of File.separator. URLs must use "/". When packaging plugins as jars, the URL requirements appear to be much more strict.

This commit is contained in:
David Dykstal 2006-04-27 15:48:23 +00:00
parent a8d5909765
commit 1d5f0041b1
2 changed files with 15 additions and 21 deletions

View file

@ -23,16 +23,17 @@ public interface ISystemIconConstants
{
public static final String PLUGIN_ID ="org.eclipse.rse.ui";
public static final String PREFIX = PLUGIN_ID+".";
public static final String SEP = "/";
// Icons
public static final String ICON_DIR = "icons";
public static final String ICON_PATH = java.io.File.separator + ICON_DIR + java.io.File.separator;
public static final String ICON_PATH = SEP + ICON_DIR + SEP;
public static final String ICON_SUFFIX = "Icon";
public static final String ICON_BANNER_SUFFIX = "BannerIcon";
public static final String ICON_EXT = ".gif";
// WIZARD ICONS...
public static final String ICON_WIZARD_DIR = java.io.File.separator + "full" + java.io.File.separator + "wizban" + java.io.File.separator + "";
public static final String ICON_WIZARD_DIR = SEP + "full" + SEP + "wizban" + SEP + "";
public static final String ICON_SYSTEM_NEWPROFILEWIZARD_ROOT = "newprofile_wiz";
public static final String ICON_SYSTEM_NEWPROFILEWIZARD = ICON_WIZARD_DIR + ICON_SYSTEM_NEWPROFILEWIZARD_ROOT + ICON_EXT;
public static final String ICON_SYSTEM_NEWPROFILEWIZARD_ID = PREFIX + ICON_SYSTEM_NEWPROFILEWIZARD_ROOT + ICON_BANNER_SUFFIX;
@ -59,7 +60,7 @@ public interface ISystemIconConstants
// THING ICONS...
public static final String ICON_MODEL_DIR = java.io.File.separator + "full" + java.io.File.separator + "obj16" + java.io.File.separator + "";
public static final String ICON_MODEL_DIR = SEP + "full" + SEP + "obj16" + SEP + "";
public static final String ICON_SYSTEM_USERACTION_NEW_ROOT = "user_action_new_obj";
public static final String ICON_SYSTEM_USERACTION_NEW = ICON_MODEL_DIR + ICON_SYSTEM_USERACTION_NEW_ROOT+ICON_EXT;
@ -170,7 +171,7 @@ public interface ISystemIconConstants
public static final String ICON_SYSTEM_TARGET_ID = PREFIX+ICON_SYSTEM_TARGET_ROOT+ICON_SUFFIX;
// NEW ACTION ICONS...
public static final String ICON_NEWACTIONS_DIR = java.io.File.separator + "full" + java.io.File.separator + "ctool16" + java.io.File.separator + "";
public static final String ICON_NEWACTIONS_DIR = SEP + "full" + SEP + "ctool16" + SEP + "";
public static final String ICON_SYSTEM_NEW_ROOT = "new";
public static final String ICON_SYSTEM_NEW = ICON_NEWACTIONS_DIR + ICON_SYSTEM_NEW_ROOT+ICON_EXT;
@ -206,7 +207,7 @@ public interface ISystemIconConstants
// OTHER ACTION ICONS...
public static final String ICON_ACTIONS_DIR = java.io.File.separator + "full" + java.io.File.separator + "elcl16" + java.io.File.separator + "";
public static final String ICON_ACTIONS_DIR = SEP + "full" + SEP + "elcl16" + SEP + "";
public static final String ICON_SYSTEM_COMPILE_ROOT = "compile";
public static final String ICON_SYSTEM_COMPILE = ICON_ACTIONS_DIR + ICON_SYSTEM_COMPILE_ROOT+ICON_EXT;
@ -342,7 +343,7 @@ public interface ISystemIconConstants
public static final String ICON_SYSTEM_EXPORT_SHELL_HISTORY_ID = PREFIX + ICON_SYSTEM_EXPORT_SHELL_HISTORY_ROOT + ICON_SUFFIX;
// SPECIAL MODEL OBJECT ICONS...
public static final String ICON_OBJS_DIR = java.io.File.separator + "full" + java.io.File.separator + "obj16" + java.io.File.separator;
public static final String ICON_OBJS_DIR = SEP + "full" + SEP + "obj16" + SEP;
public static final String ICON_SYSTEM_ERROR_ROOT = "error";
public static final String ICON_SYSTEM_ERROR_ID = PREFIX + ICON_SYSTEM_ERROR_ROOT + ICON_SUFFIX;
public static final String ICON_SYSTEM_ERROR = ICON_OBJS_DIR + ICON_SYSTEM_ERROR_ROOT + ICON_EXT;

View file

@ -16,10 +16,8 @@
package org.eclipse.rse.core;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Hashtable;
import java.util.MissingResourceException;
@ -46,7 +44,6 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.ide.IDEWorkbenchAdvisor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@ -70,9 +67,9 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
private static SystemBasePlugin baseInst = null;
/**
* Default folder for icons, relative to this plugin's install folder: "icons\".
* Default folder for icons, relative to this plugin's install folder: "icons".
*/
protected static final String ICON_PATH = "icons" + File.separatorChar;
protected static final String ICON_PATH = "icons";
/**
* Logger object for logging messages for servicing purposes.
@ -311,7 +308,7 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
}
/**
* Helper to get the typical icons path ... usually just "icons\".
* Helper to get the typical icons path ... usually just "icons/".
*/
public static String getIconPath()
{
@ -341,7 +338,7 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
/**
* Retrieve image in this plugin's directory tree, given its file name.
* The file name should be qualified relative to this plugin's folder. Eg "icons\myicon.gif"
* The file name should be qualified relative to this plugin's bundle. Eg "icons/myicon.gif"
*/
public ImageDescriptor getPluginImage(String fileName)
{
@ -350,17 +347,13 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
/**
* Retrieve image in any plugin's directory tree, given its file name.
* The file name should be qualified relative to this plugin's folder. Eg "icons\myicon.gif"
* The file name should be qualified relative to this plugin's bundle. Eg "icons/myicon.gif"
*/
public static ImageDescriptor getPluginImage(Bundle bundle, String fileName)
{
URL path = bundle.getEntry("/");
URL fullPathString = null;
try {
fullPathString = new URL(path,fileName);
return ImageDescriptor.createFromURL(fullPathString);
} catch (MalformedURLException e) {}
return null;
URL path = bundle.getEntry("/" + fileName);
ImageDescriptor descriptor = ImageDescriptor.createFromURL(path);
return descriptor;
}
/**