changeset 38:c884a1ab6db3

resource loading, fix type in image names
author Frank Benoit <benoit@tionex.de>
date Sun, 06 Apr 2008 14:15:58 +0200
parents e10d9c2648be
children 644f1334b451
files dwtx/jface/action/StatusLine.d dwtx/jface/dialogs/PopupDialog.d dwtx/jface/fieldassist/FieldDecorationRegistry.d dwtx/jface/resource/FileImageDescriptor.d dwtx/jface/resource/ImageDescriptor.d dwtx/jface/resource/JFaceResources.d dwtx/jface/viewers/DialogCellEditor.d res/dwts.jface.action.images.stop.gif res/dwts.jface.dialogs.images.help.gif res/dwts.jface.dialogs.images.message_error.gif res/dwts.jface.dialogs.images.message_info.gif res/dwts.jface.dialogs.images.message_warning.gif res/dwts.jface.dialogs.images.popup_menu.gif res/dwts.jface.dialogs.images.popup_menu_disabled.gif res/dwts.jface.dialogs.images.title_banner.gif res/dwts.jface.fieldassist.images.contassist_ovr.gif res/dwts.jface.fieldassist.images.error_ovr.gif res/dwts.jface.fieldassist.images.errorqf_ovr.gif res/dwts.jface.fieldassist.images.info_ovr.gif res/dwts.jface.fieldassist.images.required_field_cue.gif res/dwts.jface.fieldassist.images.warn_ovr.gif res/dwts.jface.images.dots_button.gif res/dwts.jface.preference.images.pref_dialog_title.gif res/dwts.jface.wizard.images.page.gif res/dwtx.jface.action.images.stop.gif res/dwtx.jface.dialogs.images.help.gif res/dwtx.jface.dialogs.images.message_error.gif res/dwtx.jface.dialogs.images.message_info.gif res/dwtx.jface.dialogs.images.message_warning.gif res/dwtx.jface.dialogs.images.popup_menu.gif res/dwtx.jface.dialogs.images.popup_menu_disabled.gif res/dwtx.jface.dialogs.images.title_banner.gif res/dwtx.jface.fieldassist.images.contassist_ovr.gif res/dwtx.jface.fieldassist.images.error_ovr.gif res/dwtx.jface.fieldassist.images.errorqf_ovr.gif res/dwtx.jface.fieldassist.images.info_ovr.gif res/dwtx.jface.fieldassist.images.required_field_cue.gif res/dwtx.jface.fieldassist.images.warn_ovr.gif res/dwtx.jface.images.dots_button.gif res/dwtx.jface.preference.images.pref_dialog_title.gif res/dwtx.jface.wizard.images.page.gif
diffstat 41 files changed, 66 insertions(+), 73 deletions(-) [+]
line wrap: on
line diff
--- a/dwtx/jface/action/StatusLine.d	Sun Apr 06 13:21:48 2008 +0200
+++ b/dwtx/jface/action/StatusLine.d	Sun Apr 06 14:15:58 2008 +0200
@@ -114,10 +114,10 @@
     protected static ImageDescriptor fgStopImage;
 
     static this() {
+        fgStopImage = ImageDescriptor.createFromFile(
+            import("dwtx.jface.action.images.stop.gif"));//$NON-NLS-1$
         JFaceResources.getImageRegistry().put(
                 "dwtx.jface.parts.StatusLine.stopImage", fgStopImage);//$NON-NLS-1$
-        fgStopImage = ImageDescriptor
-            .createFromFile(StatusLine.classinfo, "images/stop.gif");//$NON-NLS-1$
     }
 
     /**
--- a/dwtx/jface/dialogs/PopupDialog.d	Sun Apr 06 13:21:48 2008 +0200
+++ b/dwtx/jface/dialogs/PopupDialog.d	Sun Apr 06 14:15:58 2008 +0200
@@ -698,10 +698,10 @@
 
         GridDataFactory.fillDefaults().align_(DWT.END, DWT.CENTER).applyTo(toolBar);
 
-        menuImage = ImageDescriptor.createFromFile(PopupDialog.classinfo,
-                "images/popup_menu.gif").createImage();//$NON-NLS-1$
-        disabledMenuImage = ImageDescriptor.createFromFile(PopupDialog.classinfo,
-                "images/popup_menu_disabled.gif").createImage();//$NON-NLS-1$
+        menuImage = ImageDescriptor.createFromFile(
+            import("dwtx.jface.dialogs.images.popup_menu.gif")).createImage();//$NON-NLS-1$
+        disabledMenuImage = ImageDescriptor.createFromFile(
+            import("dwtx.jface.dialogs.images.popup_menu_disabled.gif")).createImage();//$NON-NLS-1$
         viewMenuButton.setImage(menuImage);
         viewMenuButton.setDisabledImage(disabledMenuImage);
         viewMenuButton.setToolTipText(JFaceResources
--- a/dwtx/jface/fieldassist/FieldDecorationRegistry.d	Sun Apr 06 13:21:48 2008 +0200
+++ b/dwtx/jface/fieldassist/FieldDecorationRegistry.d	Sun Apr 06 14:15:58 2008 +0200
@@ -109,27 +109,22 @@
         ImageRegistry imageRegistry = JFaceResources.getImageRegistry();
 
         // Define the images used in the standard decorations.
-        imageRegistry.put(IMG_DEC_FIELD_CONTENT_PROPOSAL, ImageDescriptor
-                .createFromFile(FieldDecorationRegistry.classinfo,
-                        "images/contassist_ovr.gif"));//$NON-NLS-1$
+        imageRegistry.put(IMG_DEC_FIELD_CONTENT_PROPOSAL, ImageDescriptor.createFromFile(
+            import("dwtx.jface.fieldassist.images.contassist_ovr.gif")));//$NON-NLS-1$
         imageRegistry.put(IMG_DEC_FIELD_ERROR, ImageDescriptor.createFromFile(
-                FieldDecorationRegistry.classinfo, "images/error_ovr.gif"));//$NON-NLS-1$
+            import("dwtx.jface.fieldassist.images.error_ovr.gif")));//$NON-NLS-1$
 
-        imageRegistry.put(IMG_DEC_FIELD_WARNING, ImageDescriptor
-                .createFromFile(FieldDecorationRegistry.classinfo,
-                        "images/warn_ovr.gif"));//$NON-NLS-1$
+        imageRegistry.put(IMG_DEC_FIELD_WARNING, ImageDescriptor.createFromFile(
+            import("dwtx.jface.fieldassist.images.warn_ovr.gif")));//$NON-NLS-1$
 
-        imageRegistry.put(IMG_DEC_FIELD_REQUIRED, ImageDescriptor
-                .createFromFile(FieldDecorationRegistry.classinfo,
-                        "images/required_field_cue.gif"));//$NON-NLS-1$
+        imageRegistry.put(IMG_DEC_FIELD_REQUIRED, ImageDescriptor.createFromFile(
+            import("dwtx.jface.fieldassist.images.required_field_cue.gif")));//$NON-NLS-1$
 
-        imageRegistry.put(IMG_DEC_FIELD_ERROR_QUICKFIX, ImageDescriptor
-                .createFromFile(FieldDecorationRegistry.classinfo,
-                        "images/errorqf_ovr.gif"));//$NON-NLS-1$
+        imageRegistry.put(IMG_DEC_FIELD_ERROR_QUICKFIX, ImageDescriptor.createFromFile(
+            import("dwtx.jface.fieldassist.images.errorqf_ovr.gif")));//$NON-NLS-1$
 
-        imageRegistry.put(IMG_DEC_FIELD_INFO, ImageDescriptor
-                .createFromFile(FieldDecorationRegistry.classinfo,
-                        "images/info_ovr.gif"));//$NON-NLS-1$
+        imageRegistry.put(IMG_DEC_FIELD_INFO, ImageDescriptor.createFromFile(
+            import("dwtx.jface.fieldassist.images.info_ovr.gif")));//$NON-NLS-1$
 
         // Define the standard decorations. Some do not have standard
         // descriptions. Use null in these cases.
--- a/dwtx/jface/resource/FileImageDescriptor.d	Sun Apr 06 13:21:48 2008 +0200
+++ b/dwtx/jface/resource/FileImageDescriptor.d	Sun Apr 06 14:15:58 2008 +0200
@@ -28,6 +28,7 @@
 import dwt.dwthelper.InputStream;
 import dwt.dwthelper.FileInputStream;
 import dwt.dwthelper.BufferedInputStream;
+import dwt.dwthelper.ByteArrayInputStream;
 
 /**
  * An image descriptor that loads its image information
@@ -39,12 +40,13 @@
      * The class whose resource directory contain the file,
      * or <code>null</code> if none.
      */
-    private ClassInfo location;
+//     private ClassInfo location;
 
     /**
      * The name of the file.
      */
-    private String name;
+//     private String name;
+    private void[] importdata;
 
     /**
      * Creates a new file image descriptor.
@@ -60,9 +62,10 @@
      *   <code>null</code>
      * @param filename the name of the file
      */
-    this(ClassInfo clazz, String filename) {
-        this.location = clazz;
-        this.name = filename;
+    this(void[] importdata/+ClassInfo clazz, String filename+/) {
+//         this.location = clazz;
+//         this.name = filename;
+        this.importdata = importdata;
     }
 
     /* (non-Javadoc)
@@ -73,16 +76,16 @@
             return false;
         }
         FileImageDescriptor other = cast(FileImageDescriptor) o;
-        if (location !is null) {
-            if ( location.name != other.location.name ) {
-                return false;
-            }
-        } else {
-            if (other.location !is null) {
-                return false;
-            }
-        }
-        return name == other.name;
+//         if (location !is null) {
+//             if ( location.name != other.location.name ) {
+//                 return false;
+//             }
+//         } else {
+//             if (other.location !is null) {
+//                 return false;
+//             }
+//         }
+        return importdata == other.importdata;
     }
 
     /* (non-Javadoc)
@@ -117,16 +120,17 @@
     private InputStream getStream() {
         InputStream is_ = null;
 
-        if (location !is null) {
-            is_ = ClassInfoGetResourceAsStream( location, name);
+//         if (location !is null) {
+            is_ = new ByteArrayInputStream(cast(byte[]) importdata);
+//             is_ = ClassInfoGetResourceAsStream( location, name);
 
-        } else {
-            try {
-                is_ = new FileInputStream(name);
-            } catch (/+FileNotFoundException+/ IOException e) {
-                return null;
-            }
-        }
+//         } else {
+//             try {
+//                 is_ = new FileInputStream(name);
+//             } catch (/+FileNotFoundException+/ IOException e) {
+//                 return null;
+//             }
+//         }
         if (is_ is null) {
             return null;
         } else {
@@ -138,10 +142,10 @@
      * Method declared on Object.
      */
     public override hash_t toHash() {
-        int code = dwt.dwthelper.utils.toHash(name);
-        if (location !is null) {
-            code += location.toHash();
-        }
+        int code = dwt.dwthelper.utils.toHash(cast(char[])importdata/+name+/);
+//         if (location !is null) {
+//             code += location.toHash();
+//         }
         return code;
     }
 
@@ -153,6 +157,7 @@
      * returns a string representation of this object which is suitable only for debugging.
      */
     public override String toString() {
-        return "FileImageDescriptor(location=" ~ location.toString() ~ ", name=" ~ name ~ ")";//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+//         return "FileImageDescriptor(location=" ~ location.toString() ~ ", name=" ~ name ~ ")";//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+        return "FileImageDescriptor()";//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
     }
 }
--- a/dwtx/jface/resource/ImageDescriptor.d	Sun Apr 06 13:21:48 2008 +0200
+++ b/dwtx/jface/resource/ImageDescriptor.d	Sun Apr 06 14:15:58 2008 +0200
@@ -89,8 +89,8 @@
      * @param filename the file name
      * @return a new image descriptor
      */
-    public static ImageDescriptor createFromFile(ClassInfo location, String filename) {
-        return new FileImageDescriptor(location, filename);
+    public static ImageDescriptor createFromFile( void[] importdata/+ClassInfo location, String filename+/) {
+        return new FileImageDescriptor(importdata/+location, filename+/);
     }
 
     /**
--- a/dwtx/jface/resource/JFaceResources.d	Sun Apr 06 13:21:48 2008 +0200
+++ b/dwtx/jface/resource/JFaceResources.d	Sun Apr 06 14:15:58 2008 +0200
@@ -441,28 +441,21 @@
 //         } catch (NoClassDefFoundError exception) {
 //             // Test to see if OSGI is present
 //         }
-        declareImage(bundle, Wizard.DEFAULT_IMAGE, ICONS_PATH ~ "page.gif", //$NON-NLS-1$
-                Wizard.classinfo, "images/page.gif"); //$NON-NLS-1$
-
+        declareImage(bundle, Wizard.DEFAULT_IMAGE, ICONS_PATH
+                ~ "page.gif", import( "dwtx.jface.wizard.images.page.gif" )); //$NON-NLS-1$
         // register default images for dialogs
         declareImage(bundle, Dialog.DLG_IMG_MESSAGE_INFO, ICONS_PATH
-                ~ "message_info.gif", Dialog.classinfo, "images/message_info.gif"); //$NON-NLS-1$ //$NON-NLS-2$
+                ~ "message_info.gif", import( "dwtx.jface.dialogs.images.message_info.gif")); //$NON-NLS-1$ //$NON-NLS-2$
         declareImage(bundle, Dialog.DLG_IMG_MESSAGE_WARNING, ICONS_PATH
-                ~ "message_warning.gif", Dialog.classinfo, //$NON-NLS-1$
-                "images/message_warning.gif"); //$NON-NLS-1$
+                ~ "message_warning.gif", import( "dwtx.jface.dialogs.images.message_warning.gif")); //$NON-NLS-1$
         declareImage(bundle, Dialog.DLG_IMG_MESSAGE_ERROR, ICONS_PATH
-                ~ "message_error.gif", Dialog.classinfo, "images/message_error.gif");//$NON-NLS-1$ //$NON-NLS-2$
+                ~ "message_error.gif", import( "dwtx.jface.dialogs.images.message_error.gif"));//$NON-NLS-1$ //$NON-NLS-2$
         declareImage(bundle, Dialog.DLG_IMG_HELP, ICONS_PATH
-                ~ "help.gif", Dialog.classinfo, "images/help.gif");//$NON-NLS-1$ //$NON-NLS-2$
-        declareImage(
-                bundle,
-                TitleAreaDialog.DLG_IMG_TITLE_BANNER,
-                ICONS_PATH ~ "title_banner.png", TitleAreaDialog.classinfo, "images/title_banner.gif");//$NON-NLS-1$ //$NON-NLS-2$
-        declareImage(
-                bundle,
-                PreferenceDialog.PREF_DLG_TITLE_IMG,
-                ICONS_PATH ~ "pref_dialog_title.gif", PreferenceDialog.classinfo, "images/pref_dialog_title.gif");//$NON-NLS-1$ //$NON-NLS-2$
-
+                ~ "help.gif", import( "dwtx.jface.dialogs.images.help.gif"));//$NON-NLS-1$ //$NON-NLS-2$
+        declareImage(bundle, TitleAreaDialog.DLG_IMG_TITLE_BANNER, ICONS_PATH
+                ~ "title_banner.png", import( "dwtx.jface.dialogs.images.title_banner.gif"));//$NON-NLS-1$ //$NON-NLS-2$
+        declareImage(bundle, PreferenceDialog.PREF_DLG_TITLE_IMG, ICONS_PATH
+                ~ "pref_dialog_title.gif", import( "dwtx.jface.preference.images.pref_dialog_title.gif"));//$NON-NLS-1$ //$NON-NLS-2$
     }
 
     /**
@@ -486,7 +479,7 @@
      *
      */
     private static final void declareImage(Object bundle, String key,
-            String path, ClassInfo fallback, String fallbackPath) {
+            String path, void[] importdata/+ClassInfo fallback, String fallbackPath+/) {
 
 
         ImageDescriptor descriptor = null;
@@ -500,7 +493,7 @@
 
         // If we failed then load from the backup file
         if (descriptor is null)
-            descriptor = ImageDescriptor.createFromFile(fallback, fallbackPath);
+            descriptor = ImageDescriptor.createFromFile( importdata /+fallback, fallbackPath+/);
 
         imageRegistry.put(key, descriptor);
     }
--- a/dwtx/jface/viewers/DialogCellEditor.d	Sun Apr 06 13:21:48 2008 +0200
+++ b/dwtx/jface/viewers/DialogCellEditor.d	Sun Apr 06 14:15:58 2008 +0200
@@ -96,7 +96,7 @@
     static this() {
         ImageRegistry reg = JFaceResources.getImageRegistry();
         reg.put(CELL_EDITOR_IMG_DOTS_BUTTON, ImageDescriptor.createFromFile(
-                DialogCellEditor.classinfo, "images/dots_button.gif"));//$NON-NLS-1$
+                import("dwtx.jface.images.dots_button.gif")));//$NON-NLS-1$
     }
 
     /**
Binary file res/dwts.jface.action.images.stop.gif has changed
Binary file res/dwts.jface.dialogs.images.help.gif has changed
Binary file res/dwts.jface.dialogs.images.message_error.gif has changed
Binary file res/dwts.jface.dialogs.images.message_info.gif has changed
Binary file res/dwts.jface.dialogs.images.message_warning.gif has changed
Binary file res/dwts.jface.dialogs.images.popup_menu.gif has changed
Binary file res/dwts.jface.dialogs.images.popup_menu_disabled.gif has changed
Binary file res/dwts.jface.dialogs.images.title_banner.gif has changed
Binary file res/dwts.jface.fieldassist.images.contassist_ovr.gif has changed
Binary file res/dwts.jface.fieldassist.images.error_ovr.gif has changed
Binary file res/dwts.jface.fieldassist.images.errorqf_ovr.gif has changed
Binary file res/dwts.jface.fieldassist.images.info_ovr.gif has changed
Binary file res/dwts.jface.fieldassist.images.required_field_cue.gif has changed
Binary file res/dwts.jface.fieldassist.images.warn_ovr.gif has changed
Binary file res/dwts.jface.images.dots_button.gif has changed
Binary file res/dwts.jface.preference.images.pref_dialog_title.gif has changed
Binary file res/dwts.jface.wizard.images.page.gif has changed
Binary file res/dwtx.jface.action.images.stop.gif has changed
Binary file res/dwtx.jface.dialogs.images.help.gif has changed
Binary file res/dwtx.jface.dialogs.images.message_error.gif has changed
Binary file res/dwtx.jface.dialogs.images.message_info.gif has changed
Binary file res/dwtx.jface.dialogs.images.message_warning.gif has changed
Binary file res/dwtx.jface.dialogs.images.popup_menu.gif has changed
Binary file res/dwtx.jface.dialogs.images.popup_menu_disabled.gif has changed
Binary file res/dwtx.jface.dialogs.images.title_banner.gif has changed
Binary file res/dwtx.jface.fieldassist.images.contassist_ovr.gif has changed
Binary file res/dwtx.jface.fieldassist.images.error_ovr.gif has changed
Binary file res/dwtx.jface.fieldassist.images.errorqf_ovr.gif has changed
Binary file res/dwtx.jface.fieldassist.images.info_ovr.gif has changed
Binary file res/dwtx.jface.fieldassist.images.required_field_cue.gif has changed
Binary file res/dwtx.jface.fieldassist.images.warn_ovr.gif has changed
Binary file res/dwtx.jface.images.dots_button.gif has changed
Binary file res/dwtx.jface.preference.images.pref_dialog_title.gif has changed
Binary file res/dwtx.jface.wizard.images.page.gif has changed