directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r636689 - /directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ValueEditorsPreferencePage.java
Date Thu, 13 Mar 2008 09:59:28 GMT
Author: seelmann
Date: Thu Mar 13 02:59:25 2008
New Revision: 636689

URL: http://svn.apache.org/viewvc?rev=636689&view=rev
Log:
Fix for DIRSTUDIO-290: fixed image handling in properties dialog

Modified:
    directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ValueEditorsPreferencePage.java

Modified: directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ValueEditorsPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ValueEditorsPreferencePage.java?rev=636689&r1=636688&r2=636689&view=diff
==============================================================================
--- directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ValueEditorsPreferencePage.java
(original)
+++ directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ValueEditorsPreferencePage.java
Thu Mar 13 02:59:25 2008
@@ -24,7 +24,9 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
@@ -41,6 +43,7 @@
 import org.apache.directory.studio.valueeditors.ValueEditorManager;
 import org.apache.directory.studio.valueeditors.ValueEditorManager.ValueEditorExtension;
 import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.DoubleClickEvent;
 import org.eclipse.jface.viewers.IDoubleClickListener;
@@ -122,6 +125,8 @@
     /** The syntax remove button. */
     private Button syntaxRemoveButton;
 
+    /** The map of images */
+    private Map<ImageDescriptor, Image> imageMap;
 
     /**
      * Creates a new instance of ValueEditorsPreferencePage.
@@ -130,6 +135,7 @@
     {
         super( "Value Editors" );
         super.setDescription( "Specify value editors:" );
+        this.imageMap = new HashMap<ImageDescriptor, Image>();
     }
 
 
@@ -144,6 +150,24 @@
     /**
      * {@inheritDoc}
      */
+    public void dispose()
+    {
+        if ( imageMap != null ) {
+            for ( Image image : imageMap.values() )
+            {
+                if ( image != null && !image.isDisposed() )
+                {
+                    image.dispose();
+                }
+            }
+        }
+        super.dispose();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
     protected Control createContents( Composite parent )
     {
         Composite composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
@@ -552,7 +576,16 @@
                 if ( index == 2 )
                 {
                     ValueEditorExtension vee = class2ValueEditorExtensionMap.get( relation.getValueEditorClassName()
);
-                    return vee != null ? vee.icon.createImage() : null;
+                    if ( vee != null )
+                    {
+                        if ( !imageMap.containsKey( vee.icon ) )
+                        {
+                            Image image = vee.icon.createImage();
+                            imageMap.put( vee.icon, image );
+                        }
+                        return imageMap.get( vee.icon );
+                    }
+                    return null;
                 }
             }
 
@@ -601,7 +634,16 @@
                 if ( index == 2 )
                 {
                     ValueEditorExtension vee = class2ValueEditorExtensionMap.get( relation.getValueEditorClassName()
);
-                    return vee != null ? vee.icon.createImage() : null;
+                    if ( vee != null )
+                    {
+                        if ( !imageMap.containsKey( vee.icon ) )
+                        {
+                            Image image = vee.icon.createImage();
+                            imageMap.put( vee.icon, image );
+                        }
+                        return imageMap.get( vee.icon );
+                    }
+                    return null;
                 }
             }
 



Mime
View raw message