Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Fix for bug 35092

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/ChangeLog,v
retrieving revision 1.115
diff -u -r1.115 ChangeLog
--- ChangeLog 25 Mar 2003 20:55:30 -0000 1.115
+++ ChangeLog 25 Mar 2003 21:19:23 -0000
@@ -1,4 +1,8 @@
 2003-03-25 Mikhail Khodjaiants
+ Fix for bug 35092.
+ * CDebugImages.java
+
+2003-03-25 Mikhail Khodjaiants
  Added the 'logErrorMessage' static method to the 'CDebugUIPlugin' class.
  * CDebugUIPlugin.java
 
Index: src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java,v
retrieving revision 1.17
diff -u -r1.17 CDebugImages.java
--- src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java 11 Feb 2003 19:17:26 -0000 1.17
+++ src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java 25 Mar 2003 21:19:23 -0000
@@ -7,6 +7,8 @@
 
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
 
 import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
 import org.eclipse.jface.action.IAction;
@@ -41,7 +43,8 @@
  }
 
  // The plugin registry
- private final static ImageRegistry IMAGE_REGISTRY = new ImageRegistry( CDebugUIPlugin.getStandardDisplay() );
+ private static ImageRegistry fgImageRegistry = null;
+ private static HashMap fgAvoidSWTErrorMap = null;
 
  /*
   * Available cached Images in the C/C++ debug plug-in image registry.
@@ -133,7 +136,7 @@
   */
  public static Image get( String key )
  {
-  return IMAGE_REGISTRY.get( key );
+  return getImageRegistry().get( key );
  }
 
  /**
@@ -157,10 +160,19 @@
  /*
   * Helper method to access the image registry from the JDIDebugUIPlugin class.
   */
- /* package */
- static ImageRegistry getImageRegistry()
+ /* package */ static ImageRegistry getImageRegistry()
  {
-  return IMAGE_REGISTRY;
+  if ( fgImageRegistry == null )
+  {
+   fgImageRegistry = new ImageRegistry();
+   for ( Iterator iter = fgAvoidSWTErrorMap.keySet().iterator(); iter.hasNext(); )
+   {
+    String key = (String)iter.next();
+    fgImageRegistry.put( key, (ImageDescriptor)fgAvoidSWTErrorMap.get( key ) );
+   }
+   fgAvoidSWTErrorMap = null;
+  }
+  return fgImageRegistry;
  }
 
  //---- Helper methods to access icons on the file system --------------------------------------
@@ -198,7 +210,15 @@
   try
   {
    ImageDescriptor result = ImageDescriptor.createFromURL( makeIconFileURL( prefix, name.substring( NAME_PREFIX_LENGTH ) ) );
-   IMAGE_REGISTRY.put( name, result );
+   if ( fgAvoidSWTErrorMap == null )
+   {
+    fgAvoidSWTErrorMap = new HashMap();
+   }
+   fgAvoidSWTErrorMap.put( name, result );
+   if ( fgImageRegistry != null )
+   {
+    CDebugUIPlugin.logErrorMessage( "Internal Error: Image registry already defined" ); //$NON-NLS-1$
+   }
    return result;
   }
   catch( MalformedURLException e )

Back to the top