directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1212006 - /directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BinaryAttributesAndSyntaxesPreferencePage.java
Date Thu, 08 Dec 2011 17:57:56 GMT
Author: pamarcelot
Date: Thu Dec  8 17:57:55 2011
New Revision: 1212006

URL: http://svn.apache.org/viewvc?rev=1212006&view=rev
Log:
Fix for DIRSTUDIO-726 (Added a binary attributes in preference is not stored correctly).

Modified:
    directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BinaryAttributesAndSyntaxesPreferencePage.java

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BinaryAttributesAndSyntaxesPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BinaryAttributesAndSyntaxesPreferencePage.java?rev=1212006&r1=1212005&r2=1212006&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BinaryAttributesAndSyntaxesPreferencePage.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BinaryAttributesAndSyntaxesPreferencePage.java
Thu Dec  8 17:57:55 2011
@@ -269,7 +269,7 @@ public class BinaryAttributesAndSyntaxes
                 editAttribute();
             }
         } );
-        
+
         attributeViewer.addSelectionChangedListener( new ISelectionChangedListener()
         {
             public void selectionChanged( SelectionChangedEvent event )
@@ -398,7 +398,21 @@ public class BinaryAttributesAndSyntaxes
         AttributeDialog dialog = new AttributeDialog( getShell(), null, attributeNamesAndOids
);
         if ( dialog.open() == AttributeValueEditorDialog.OK )
         {
-            attributeList.add( dialog.getAttribute() );
+            BinaryAttribute attribute = dialog.getAttribute();
+
+            // Ensuring we use OID for consistency in the table viewer
+            if ( attributeNames2AtdMap.containsKey( attribute.getAttributeNumericOidOrName()
) )
+            {
+                attribute = new BinaryAttribute( attributeNames2AtdMap.get( attribute.getAttributeNumericOidOrName()
)
+                    .getOid() );
+            }
+            else if ( attributeOid2AtdMap.containsKey( attribute.getAttributeNumericOidOrName()
) )
+            {
+                attribute = new BinaryAttribute( attributeOid2AtdMap.get( attribute.getAttributeNumericOidOrName()
)
+                    .getOid() );
+            }
+
+            attributeList.add( attribute );
             attributeViewer.refresh();
         }
     }
@@ -515,8 +529,7 @@ public class BinaryAttributesAndSyntaxes
                     {
                         if ( attributeNames2AtdMap.containsKey( attribute.getAttributeNumericOidOrName()
) )
                         {
-                            AttributeType atd = ( AttributeType ) attributeNames2AtdMap
-                                .get( attribute.getAttributeNumericOidOrName() );
+                            AttributeType atd = attributeNames2AtdMap.get( attribute.getAttributeNumericOidOrName()
);
                             String s = atd.getOid();
                             for ( String attributeName : atd.getNames() )
                             {
@@ -529,8 +542,7 @@ public class BinaryAttributesAndSyntaxes
                         }
                         else if ( attributeOid2AtdMap.containsKey( attribute.getAttributeNumericOidOrName()
) )
                         {
-                            AttributeType atd = ( AttributeType ) attributeOid2AtdMap
-                                .get( attribute.getAttributeNumericOidOrName() );
+                            AttributeType atd = attributeOid2AtdMap.get( attribute.getAttributeNumericOidOrName()
);
                             return SchemaUtils.toString( atd );
                         }
                         else if ( Utils.getOidDescription( attribute.getAttributeNumericOidOrName()
) != null )



Mime
View raw message