You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2008/03/19 23:02:12 UTC

svn commit: r639036 - in /directory/studio/branches/1.1.0: ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/ ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/

Author: seelmann
Date: Wed Mar 19 15:02:09 2008
New Revision: 639036

URL: http://svn.apache.org/viewvc?rev=639036&view=rev
Log:
Fix for DIRSTUDIO-287: Replacing all occurrencies of 'ValueProvider' in the XML with 'ValueEditor'

Modified:
    directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/ValueEditorsPreferences.java
    directory/studio/branches/1.1.0/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SyntaxValueEditorRelation.java

Modified: directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/ValueEditorsPreferences.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/ValueEditorsPreferences.java?rev=639036&r1=639035&r2=639036&view=diff
==============================================================================
--- directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/ValueEditorsPreferences.java (original)
+++ directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/ValueEditorsPreferences.java Wed Mar 19 15:02:09 2008
@@ -27,7 +27,6 @@
 import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeValueEditorRelation;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.SyntaxValueEditorRelation;
 import org.apache.directory.studio.ldapbrowser.core.utils.Utils;
-
 import org.eclipse.jface.preference.IPreferenceStore;
 
 
@@ -46,7 +45,7 @@
     /** The syntax value editor cache. */
     private Map<String, String> syntaxValueEditorCache;
 
-    
+
     /**
      * Gets a Map containing all the Attribute Value Editors.
      *
@@ -63,8 +62,8 @@
             {
                 if ( relations[i].getAttributeNumericOidOrType() != null )
                 {
-                    attributeValueEditorCache.put( relations[i].getAttributeNumericOidOrType()
-                        .toLowerCase(), relations[i].getValueEditorClassName() );
+                    attributeValueEditorCache.put( relations[i].getAttributeNumericOidOrType().toLowerCase(),
+                        relations[i].getValueEditorClassName() );
                 }
             }
         }
@@ -80,7 +79,14 @@
      */
     public AttributeValueEditorRelation[] getAttributeValueEditorRelations()
     {
-        AttributeValueEditorRelation[] aver = ( AttributeValueEditorRelation[] ) load( BrowserCommonConstants.PREFERENCE_ATTRIBUTE_VALUEEDITOR_RELATIONS );
+        IPreferenceStore store = BrowserCommonActivator.getDefault().getPreferenceStore();
+        String s = store.getString( BrowserCommonConstants.PREFERENCE_ATTRIBUTE_VALUEEDITOR_RELATIONS );
+        // Migration issue from 1.0.1 to 1.1.0 (DIRSTUDIO-287): class AttributeValueProviderRelation 
+        // was renamed to AttributeValueEditorRelation, to be able to load the old configuration it
+        // is necessary to replace the old class name with the new class name.
+        s = s.replaceAll( "AttributeValueProviderRelation", "AttributeValueEditorRelation" );
+        s = s.replaceAll( "valueProviderClassname", "valueEditorClassName" );
+        AttributeValueEditorRelation[] aver = ( AttributeValueEditorRelation[] ) Utils.deserialize( s );
         return aver;
     }
 
@@ -106,7 +112,14 @@
      */
     public AttributeValueEditorRelation[] getDefaultAttributeValueEditorRelations()
     {
-        AttributeValueEditorRelation[] aver = ( AttributeValueEditorRelation[] ) loadDefault( BrowserCommonConstants.PREFERENCE_ATTRIBUTE_VALUEEDITOR_RELATIONS );
+        IPreferenceStore store = BrowserCommonActivator.getDefault().getPreferenceStore();
+        String s = store.getDefaultString( BrowserCommonConstants.PREFERENCE_ATTRIBUTE_VALUEEDITOR_RELATIONS );
+        // Migration issue from 1.0.1 to 1.1.0 (DIRSTUDIO-287): class AttributeValueProviderRelation 
+        // was renamed to AttributeValueEditorRelation, to be able to load the old configuration it
+        // is necessary to replace the old class name with the new class name.
+        s = s.replaceAll( "AttributeValueProviderRelation", "AttributeValueEditorRelation" );
+        s = s.replaceAll( "valueProviderClassname", "valueEditorClassName" );
+        AttributeValueEditorRelation[] aver = ( AttributeValueEditorRelation[] ) Utils.deserialize( s );
         return aver;
     }
 
@@ -117,14 +130,12 @@
      * @param attributeValueEditorRelations
      *      an array containing all the default Attribute Value Editor Relations
      */
-    public void setDefaultAttributeValueEditorRelations(
-        AttributeValueEditorRelation[] attributeValueEditorRelations )
+    public void setDefaultAttributeValueEditorRelations( AttributeValueEditorRelation[] attributeValueEditorRelations )
     {
         storeDefault( BrowserCommonConstants.PREFERENCE_ATTRIBUTE_VALUEEDITOR_RELATIONS, attributeValueEditorRelations );
     }
 
 
-
     /**
      * Gets a Map containing all the Syntax Value Editors.
      *
@@ -171,7 +182,14 @@
      */
     public SyntaxValueEditorRelation[] getSyntaxValueEditorRelations()
     {
-        SyntaxValueEditorRelation[] sver = ( SyntaxValueEditorRelation[] ) load( BrowserCommonConstants.PREFERENCE_SYNTAX_VALUEPEDITOR_RELATIONS );
+        IPreferenceStore store = BrowserCommonActivator.getDefault().getPreferenceStore();
+        String s = store.getString( BrowserCommonConstants.PREFERENCE_SYNTAX_VALUEPEDITOR_RELATIONS );
+        // Migration issue from 1.0.1 to 1.1.0 (DIRSTUDIO-287): class SyntaxValueProviderRelation 
+        // was renamed to SyntaxValueEditorRelation, to be able to load the old configuration it
+        // is necessary to replace the old class name with the new class name.
+        s = s.replaceAll( "SyntaxValueProviderRelation", "SyntaxValueEditorRelation" );
+        s = s.replaceAll( "valueProviderClassname", "valueEditorClassName" );
+        SyntaxValueEditorRelation[] sver = ( SyntaxValueEditorRelation[] ) Utils.deserialize( s );
         return sver;
     }
 
@@ -184,7 +202,14 @@
      */
     public SyntaxValueEditorRelation[] getDefaultSyntaxValueEditorRelations()
     {
-        SyntaxValueEditorRelation[] sver = ( SyntaxValueEditorRelation[] ) loadDefault( BrowserCommonConstants.PREFERENCE_SYNTAX_VALUEPEDITOR_RELATIONS );
+        IPreferenceStore store = BrowserCommonActivator.getDefault().getPreferenceStore();
+        String s = store.getDefaultString( BrowserCommonConstants.PREFERENCE_SYNTAX_VALUEPEDITOR_RELATIONS );
+        // Migration issue from 1.0.1 to 1.1.0 (DIRSTUDIO-287): class SyntaxValueProviderRelation 
+        // was renamed to SyntaxValueEditorRelation, to be able to load the old configuration it
+        // is necessary to replace the old class name with the new class name.
+        s = s.replaceAll( "SyntaxValueProviderRelation", "SyntaxValueEditorRelation" );
+        s = s.replaceAll( "valueProviderClassname", "valueEditorClassName" );
+        SyntaxValueEditorRelation[] sver = ( SyntaxValueEditorRelation[] ) Utils.deserialize( s );
         return sver;
     }
 
@@ -202,22 +227,6 @@
 
 
     /**
-     * Loads the current value of the string-valued property with the given name.
-     *
-     * @param key
-     *      the name of the property
-     * @return
-     *      the corresponding object
-     */
-    private static Object load( String key )
-    {
-        IPreferenceStore store = BrowserCommonActivator.getDefault().getPreferenceStore();
-        String s = store.getString( key );
-        return Utils.deserialize( s );
-    }
-
-
-    /**
      * Stores the current value of the string-valued property with the given name.
      *
      * @param key
@@ -230,22 +239,6 @@
         IPreferenceStore store = BrowserCommonActivator.getDefault().getPreferenceStore();
         String s = Utils.serialize( o );
         store.setValue( key, s );
-    }
-
-
-    /**
-     * Loads the default value for the string-valued property with the given name.
-     *
-     * @param key
-     *      the name of the property
-     * @return
-     *      the default value of the named property
-     */
-    private static Object loadDefault( String key )
-    {
-        IPreferenceStore store = BrowserCommonActivator.getDefault().getPreferenceStore();
-        String s = store.getDefaultString( key );
-        return Utils.deserialize( s );
     }
 
 

Modified: directory/studio/branches/1.1.0/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SyntaxValueEditorRelation.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/1.1.0/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SyntaxValueEditorRelation.java?rev=639036&r1=639035&r2=639036&view=diff
==============================================================================
--- directory/studio/branches/1.1.0/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SyntaxValueEditorRelation.java (original)
+++ directory/studio/branches/1.1.0/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SyntaxValueEditorRelation.java Wed Mar 19 15:02:09 2008
@@ -22,7 +22,7 @@
 
 
 /**
- * A SyntaxValueProviderRelation is used to set the relation 
+ * A SyntaxValueEditorRelation is used to set the relation 
  * from a syntax to its value editor.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>