directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r609212 [1/2] - in /directory/studio/trunk: studio-ldapbrowser-common/ studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/ studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/c...
Date Sat, 05 Jan 2008 20:42:22 GMT
Author: seelmann
Date: Sat Jan  5 12:42:20 2008
New Revision: 609212

URL: http://svn.apache.org/viewvc?rev=609212&view=rev
Log:
- Added "Colors and Fonts" preference page
- Usage of generics and foreach loop
- Renamed some classes and methods
- Code cleaning and Javadoc

Added:
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ColorsAndFontsPreferencePage.java   (with props)
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/AttributeValueEditorRelation.java
      - copied, changed from r609021, directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/AttributeValueProviderRelation.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SyntaxValueEditorRelation.java
      - copied, changed from r609021, directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SyntaxValueProviderRelation.java
Removed:
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/AttributeValueProviderRelation.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SyntaxValueProviderRelation.java
Modified:
    directory/studio/trunk/studio-ldapbrowser-common/plugin.xml
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/ValueEditorsPreferences.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributeDialog.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributeValueEditorDialog.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributesPreferencePage.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BinaryAttributesAndSyntaxesPreferencePage.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BrowserPreferencePage.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/EntryEditorPreferencePage.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/MainPreferencePage.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxDialog.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxValueEditorDialog.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/TextFormatsPreferencePage.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ValueEditorsPreferencePage.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java
    directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/preferences/SearchResultEditorPreferencePage.java

Modified: directory/studio/trunk/studio-ldapbrowser-common/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/plugin.xml?rev=609212&r1=609211&r2=609212&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/plugin.xml (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/plugin.xml Sat Jan  5 12:42:20 2008
@@ -44,6 +44,13 @@
             class="org.apache.directory.studio.ldapbrowser.common.dialogs.preferences.AttributesPreferencePage"
             id="org.apache.directory.studio.ldapbrowser.preferences.AttributesPreferencePage"
             name="Attributes">
+         <keywordReference id="org.apache.directory.studio.ldapbrowser.keyword.ldap"/>
+      </page>
+      <page
+            category="org.apache.directory.studio.ldapbrowser.preferences.MainPreferencePage"
+            class="org.apache.directory.studio.ldapbrowser.common.dialogs.preferences.ColorsAndFontsPreferencePage"
+            id="org.apache.directory.studio.ldapbrowser.preferences.ColorsAndFontsPreferencePage"
+            name="Colors and Fonts">
          <keywordReference id="org.apache.directory.studio.ldapbrowser.keyword.colors"/>
          <keywordReference id="org.apache.directory.studio.ldapbrowser.keyword.fonts"/>
          <keywordReference id="org.apache.directory.studio.ldapbrowser.keyword.ldap"/>

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java?rev=609212&r1=609211&r2=609212&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java Sat Jan  5 12:42:20 2008
@@ -58,9 +58,9 @@
 
     public static final String PREFERENCE_COUNT_LIMIT = "countLimit";
 
-    public static final String PREFERENCE_SYNTAX_VALUEPROVIDER_RELATIONS = "syntaxValueProviderRelations";
+    public static final String PREFERENCE_SYNTAX_VALUEPEDITOR_RELATIONS = "syntaxValueProviderRelations";
 
-    public static final String PREFERENCE_ATTRIBUTE_VALUEPROVIDER_RELATIONS = "attributeValueProviderRelations";
+    public static final String PREFERENCE_ATTRIBUTE_VALUEEDITOR_RELATIONS = "attributeValueProviderRelations";
 
     public static final String PREFERENCE_FORMAT_TABLE_ATTRIBUTEDELIMITER = "formatTableAttributeDelimiter";
 

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java?rev=609212&r1=609211&r2=609212&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java Sat Jan  5 12:42:20 2008
@@ -25,8 +25,8 @@
 import java.util.Collection;
 
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeValueProviderRelation;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.SyntaxValueProviderRelation;
+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.valueeditors.ValueEditorManager;
 import org.apache.directory.studio.valueeditors.ValueEditorManager.ValueEditorExtension;
 import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
@@ -91,27 +91,26 @@
         store.setDefault( BrowserCommonConstants.PREFERENCE_SHOW_RAW_VALUES, false );
 
         // Value Editors
-        Collection<AttributeValueProviderRelation> avprs = new ArrayList<AttributeValueProviderRelation>();
-        Collection<SyntaxValueProviderRelation> svprs = new ArrayList<SyntaxValueProviderRelation>();
-        Collection<ValueEditorExtension> valueEditorProxys = ValueEditorManager.getValueEditorProxys();
-        for ( ValueEditorExtension proxy : valueEditorProxys )
+        Collection<AttributeValueEditorRelation> avprs = new ArrayList<AttributeValueEditorRelation>();
+        Collection<SyntaxValueEditorRelation> svprs = new ArrayList<SyntaxValueEditorRelation>();
+        Collection<ValueEditorExtension> valueEditorExtensions = ValueEditorManager.getValueEditorExtensions();
+        for ( ValueEditorExtension vee : valueEditorExtensions )
         {
-            for ( String attributeType : proxy.attributeTypes )
+            for ( String attributeType : vee.attributeTypes )
             {
-                AttributeValueProviderRelation avpr = new AttributeValueProviderRelation( attributeType,
-                    proxy.className );
-                avprs.add( avpr );
+                AttributeValueEditorRelation aver = new AttributeValueEditorRelation( attributeType, vee.className );
+                avprs.add( aver );
             }
-            for ( String syntaxOid : proxy.syntaxOids )
+            for ( String syntaxOid : vee.syntaxOids )
             {
-                SyntaxValueProviderRelation svpr = new SyntaxValueProviderRelation( syntaxOid, proxy.className );
-                svprs.add( svpr );
+                SyntaxValueEditorRelation sver = new SyntaxValueEditorRelation( syntaxOid, vee.className );
+                svprs.add( sver );
             }
         }
-        BrowserCommonActivator.getDefault().getValueEditorsPreferences().setDefaultAttributeValueProviderRelations(
-            avprs.toArray( new AttributeValueProviderRelation[0] ) );
-        BrowserCommonActivator.getDefault().getValueEditorsPreferences().setDefaultSyntaxValueProviderRelations(
-            svprs.toArray( new SyntaxValueProviderRelation[0] ) );
+        BrowserCommonActivator.getDefault().getValueEditorsPreferences().setDefaultAttributeValueEditorRelations(
+            avprs.toArray( new AttributeValueEditorRelation[0] ) );
+        BrowserCommonActivator.getDefault().getValueEditorsPreferences().setDefaultSyntaxValueEditorRelations(
+            svprs.toArray( new SyntaxValueEditorRelation[0] ) );
 
         // Browser
         store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_EXPAND_BASE_ENTRIES, false );

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/ValueEditorsPreferences.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/ValueEditorsPreferences.java?rev=609212&r1=609211&r2=609212&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/ValueEditorsPreferences.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/ValueEditorsPreferences.java Sat Jan  5 12:42:20 2008
@@ -24,8 +24,8 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeValueProviderRelation;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.SyntaxValueProviderRelation;
+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;
@@ -53,18 +53,18 @@
      * @return
      *      a Map containing all the Attribute Value Editors
      */
-    public Map getAttributeValueEditorMap()
+    public Map<String, String> getAttributeValueEditorMap()
     {
         if ( attributeValueEditorCache == null )
         {
             attributeValueEditorCache = new HashMap<String, String>();
-            AttributeValueProviderRelation[] relations = getAttributeValueProviderRelations();
+            AttributeValueEditorRelation[] relations = getAttributeValueEditorRelations();
             for ( int i = 0; i < relations.length; i++ )
             {
                 if ( relations[i].getAttributeNumericOidOrType() != null )
                 {
                     attributeValueEditorCache.put( relations[i].getAttributeNumericOidOrType()
-                        .toLowerCase(), relations[i].getValueProviderClassname() );
+                        .toLowerCase(), relations[i].getValueEditorClassName() );
                 }
             }
         }
@@ -73,54 +73,54 @@
 
 
     /**
-     * Gets an array containing all the Attribute Value Provider Relations.
+     * Gets an array containing all the Attribute Value Editor Relations.
      *
      * @return
-     *      an array containing all the Attribute Value Provider Relations
+     *      an array containing all the Attribute Value Editor Relations
      */
-    public AttributeValueProviderRelation[] getAttributeValueProviderRelations()
+    public AttributeValueEditorRelation[] getAttributeValueEditorRelations()
     {
-        AttributeValueProviderRelation[] avpr = ( AttributeValueProviderRelation[] ) load( BrowserCommonConstants.PREFERENCE_ATTRIBUTE_VALUEPROVIDER_RELATIONS );
-        return avpr;
+        AttributeValueEditorRelation[] aver = ( AttributeValueEditorRelation[] ) load( BrowserCommonConstants.PREFERENCE_ATTRIBUTE_VALUEEDITOR_RELATIONS );
+        return aver;
     }
 
 
     /**
-     * Sets the Attribute Value Provider Relations.
+     * Sets the Attribute Value Editor Relations.
      *
-     * @param attributeValueProviderRelations
-     *      an array containing all the Attribute Value Provider Relations
+     * @param attributeValueEditorRelations
+     *      an array containing all the Attribute Value Editor Relations
      */
-    public void setAttributeValueProviderRelations( AttributeValueProviderRelation[] attributeValueProviderRelations )
+    public void setAttributeValueEditorRelations( AttributeValueEditorRelation[] attributeValueEditorRelations )
     {
-        store( BrowserCommonConstants.PREFERENCE_ATTRIBUTE_VALUEPROVIDER_RELATIONS, attributeValueProviderRelations );
+        store( BrowserCommonConstants.PREFERENCE_ATTRIBUTE_VALUEEDITOR_RELATIONS, attributeValueEditorRelations );
         attributeValueEditorCache = null;
     }
 
 
     /**
-     * Gets the default Attribute Value Provider Relations.
+     * Gets the default Attribute Value Editor Relations.
      *
      * @return
-     *      an array containing all the default Attribute Value Provider Relations
+     *      an array containing all the default Attribute Value Editor Relations
      */
-    public AttributeValueProviderRelation[] getDefaultAttributeValueProviderRelations()
+    public AttributeValueEditorRelation[] getDefaultAttributeValueEditorRelations()
     {
-        AttributeValueProviderRelation[] avpr = ( AttributeValueProviderRelation[] ) loadDefault( BrowserCommonConstants.PREFERENCE_ATTRIBUTE_VALUEPROVIDER_RELATIONS );
-        return avpr;
+        AttributeValueEditorRelation[] aver = ( AttributeValueEditorRelation[] ) loadDefault( BrowserCommonConstants.PREFERENCE_ATTRIBUTE_VALUEEDITOR_RELATIONS );
+        return aver;
     }
 
 
     /**
-     * Sets the default Attribute Value Provider Relations.
+     * Sets the default Attribute Value Editor Relations.
      *
-     * @param attributeValueProviderRelations
-     *      an array containing all the default Attribute Value Provider Relations
+     * @param attributeValueEditorRelations
+     *      an array containing all the default Attribute Value Editor Relations
      */
-    public void setDefaultAttributeValueProviderRelations(
-        AttributeValueProviderRelation[] attributeValueProviderRelations )
+    public void setDefaultAttributeValueEditorRelations(
+        AttributeValueEditorRelation[] attributeValueEditorRelations )
     {
-        storeDefault( BrowserCommonConstants.PREFERENCE_ATTRIBUTE_VALUEPROVIDER_RELATIONS, attributeValueProviderRelations );
+        storeDefault( BrowserCommonConstants.PREFERENCE_ATTRIBUTE_VALUEEDITOR_RELATIONS, attributeValueEditorRelations );
     }
 
 
@@ -131,18 +131,18 @@
      * @return
      *      a Map containing all the Syntax Value Editors
      */
-    public Map getSyntaxValueEditorMap()
+    public Map<String, String> getSyntaxValueEditorMap()
     {
         if ( syntaxValueEditorCache == null )
         {
             syntaxValueEditorCache = new HashMap<String, String>();
-            SyntaxValueProviderRelation[] relations = getSyntaxValueProviderRelations();
+            SyntaxValueEditorRelation[] relations = getSyntaxValueEditorRelations();
             for ( int i = 0; i < relations.length; i++ )
             {
                 if ( relations[i].getSyntaxOID() != null )
                 {
                     syntaxValueEditorCache.put( relations[i].getSyntaxOID().toLowerCase(), relations[i]
-                        .getValueProviderClassname() );
+                        .getValueEditorClassName() );
                 }
             }
         }
@@ -151,53 +151,53 @@
 
 
     /**
-     * Sets the Syntax Value Provider Relations.
+     * Sets the Syntax Value Editor Relations.
      *
-     * @param syntaxValueProviderRelations
-     *      an array containing the Syntax Value Provider Relations to set
+     * @param syntaxValueEditorRelations
+     *      an array containing the Syntax Value Editor Relations to set
      */
-    public void setSyntaxValueProviderRelations( SyntaxValueProviderRelation[] syntaxValueProviderRelations )
+    public void setSyntaxValueEditorRelations( SyntaxValueEditorRelation[] syntaxValueEditorRelations )
     {
-        store( BrowserCommonConstants.PREFERENCE_SYNTAX_VALUEPROVIDER_RELATIONS, syntaxValueProviderRelations );
+        store( BrowserCommonConstants.PREFERENCE_SYNTAX_VALUEPEDITOR_RELATIONS, syntaxValueEditorRelations );
         syntaxValueEditorCache = null;
     }
 
 
     /**
-     * Gets an array containing all the Syntax Value Provider Relations
+     * Gets an array containing all the Syntax Value Editor Relations
      *
      * @return
-     *      an array containing all the Syntax Value Provider Relations
+     *      an array containing all the Syntax Value Editor Relations
      */
-    public SyntaxValueProviderRelation[] getSyntaxValueProviderRelations()
+    public SyntaxValueEditorRelation[] getSyntaxValueEditorRelations()
     {
-        SyntaxValueProviderRelation[] svpr = ( SyntaxValueProviderRelation[] ) load( BrowserCommonConstants.PREFERENCE_SYNTAX_VALUEPROVIDER_RELATIONS );
-        return svpr;
+        SyntaxValueEditorRelation[] sver = ( SyntaxValueEditorRelation[] ) load( BrowserCommonConstants.PREFERENCE_SYNTAX_VALUEPEDITOR_RELATIONS );
+        return sver;
     }
 
 
     /**
-     * Gets an array containing all the default Syntax Value Provider Relations
+     * Gets an array containing all the default Syntax Value Editor Relations
      *
      * @return
-     *      an array containing all the default Syntax Value Provider Relations
+     *      an array containing all the default Syntax Value Editor Relations
      */
-    public SyntaxValueProviderRelation[] getDefaultSyntaxValueProviderRelations()
+    public SyntaxValueEditorRelation[] getDefaultSyntaxValueEditorRelations()
     {
-        SyntaxValueProviderRelation[] svpr = ( SyntaxValueProviderRelation[] ) loadDefault( BrowserCommonConstants.PREFERENCE_SYNTAX_VALUEPROVIDER_RELATIONS );
-        return svpr;
+        SyntaxValueEditorRelation[] sver = ( SyntaxValueEditorRelation[] ) loadDefault( BrowserCommonConstants.PREFERENCE_SYNTAX_VALUEPEDITOR_RELATIONS );
+        return sver;
     }
 
 
     /**
-     * Sets the default Syntax Value Provider Relations.
+     * Sets the default Syntax Value Editor Relations.
      *
-     * @param syntaxValueProviderRelations
-     *      an array containing the default Syntax Value Provider Relations to set
+     * @param syntaxValueEditorRelations
+     *      an array containing the default Syntax Value Editor Relations to set
      */
-    public void setDefaultSyntaxValueProviderRelations( SyntaxValueProviderRelation[] syntaxValueProviderRelations )
+    public void setDefaultSyntaxValueEditorRelations( SyntaxValueEditorRelation[] syntaxValueEditorRelations )
     {
-        storeDefault( BrowserCommonConstants.PREFERENCE_SYNTAX_VALUEPROVIDER_RELATIONS, syntaxValueProviderRelations );
+        storeDefault( BrowserCommonConstants.PREFERENCE_SYNTAX_VALUEPEDITOR_RELATIONS, syntaxValueEditorRelations );
     }
 
 

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributeDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributeDialog.java?rev=609212&r1=609211&r2=609212&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributeDialog.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributeDialog.java Sat Jan  5 12:42:20 2008
@@ -23,7 +23,6 @@
 
 import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.BinaryAttribute;
-
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.swt.events.ModifyEvent;
@@ -34,28 +33,47 @@
 import org.eclipse.swt.widgets.Shell;
 
 
+/**
+ * The AttributeDialog is used to enter/select an attribute type.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class AttributeDialog extends Dialog
 {
 
+    /** The initial attribute. */
     private BinaryAttribute currentAttribute;
 
+    /** The possible attribute types and OIDs. */
     private String[] attributeTypesAndOids;
 
+    /** The selected attribute. */
     private BinaryAttribute returnAttribute;
 
+    /** The combo. */
     private Combo typeOrOidCombo;
 
 
+    /**
+     * Creates a new instance of AttributeDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param currentAttribute the current attribute, null if none 
+     * @param attributeNamesAndOids the possible attribute names and OIDs
+     */
     public AttributeDialog( Shell parentShell, BinaryAttribute currentAttribute, String[] attributeNamesAndOids )
     {
         super( parentShell );
         this.currentAttribute = currentAttribute;
         this.attributeTypesAndOids = attributeNamesAndOids;
-
         this.returnAttribute = null;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected void configureShell( Shell newShell )
     {
         super.configureShell( newShell );
@@ -63,26 +81,31 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected void okPressed()
     {
-        this.returnAttribute = new BinaryAttribute( typeOrOidCombo.getText() );
+        returnAttribute = new BinaryAttribute( typeOrOidCombo.getText() );
         super.okPressed();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected Control createDialogArea( Composite parent )
     {
-
         Composite composite = ( Composite ) super.createDialogArea( parent );
 
         Composite c = BaseWidgetUtils.createColumnContainer( composite, 2, 1 );
         BaseWidgetUtils.createLabel( c, "Attribute Type or OID:", 1 );
-        this.typeOrOidCombo = BaseWidgetUtils.createCombo( c, this.attributeTypesAndOids, -1, 1 );
-        if ( this.currentAttribute != null )
+        typeOrOidCombo = BaseWidgetUtils.createCombo( c, attributeTypesAndOids, -1, 1 );
+        if ( currentAttribute != null )
         {
-            this.typeOrOidCombo.setText( currentAttribute.getAttributeNumericOidOrName() );
+            typeOrOidCombo.setText( currentAttribute.getAttributeNumericOidOrName() );
         }
-        this.typeOrOidCombo.addModifyListener( new ModifyListener()
+        typeOrOidCombo.addModifyListener( new ModifyListener()
         {
             public void modifyText( ModifyEvent e )
             {
@@ -96,10 +119,15 @@
 
     private void validate()
     {
-        super.getButton( IDialogConstants.OK_ID ).setEnabled( !"".equals( this.typeOrOidCombo.getText() ) );
+        getButton( IDialogConstants.OK_ID ).setEnabled( !"".equals( typeOrOidCombo.getText() ) );
     }
 
 
+    /**
+     * Gets the entered/selected attribute.
+     * 
+     * @return the attribute
+     */
     public BinaryAttribute getAttribute()
     {
         return returnAttribute;

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributeValueEditorDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributeValueEditorDialog.java?rev=609212&r1=609211&r2=609212&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributeValueEditorDialog.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributeValueEditorDialog.java Sat Jan  5 12:42:20 2008
@@ -21,12 +21,11 @@
 package org.apache.directory.studio.ldapbrowser.common.dialogs.preferences;
 
 
-import java.util.Iterator;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
 import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeValueProviderRelation;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeValueEditorRelation;
 import org.apache.directory.studio.valueeditors.ValueEditorManager.ValueEditorExtension;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
@@ -38,43 +37,66 @@
 import org.eclipse.swt.widgets.Shell;
 
 
+/**
+ * The AttributeValueEditorDialog is used to specify
+ * value editors for attributes.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class AttributeValueEditorDialog extends Dialog
 {
 
-    private AttributeValueProviderRelation relation;
+    /** The initial attribute to value editor relation. */
+    private AttributeValueEditorRelation relation;
 
-    private SortedMap<String, ValueEditorExtension> class2ValueEditorProxyMap;
+    /** Map with class name => value editor extension. */
+    private SortedMap<String, ValueEditorExtension> class2ValueEditorExtensionMap;
 
+    /** The attribute types and OIDs. */
     private String[] attributeTypesAndOids;
 
-    private SortedMap<String, String> vpName2classMap;
+    /** Map with value editor names => class name. */
+    private SortedMap<String, String> veName2classMap;
 
-    private AttributeValueProviderRelation returnRelation;
+    /** The selected attribute to value editor relation. */
+    private AttributeValueEditorRelation returnRelation;
 
+    /** The type or OID combo. */
     private Combo typeOrOidCombo;
 
+    /** The value editor combo. */
     private Combo valueEditorCombo;
 
 
-    public AttributeValueEditorDialog( Shell parentShell, AttributeValueProviderRelation relation,
-        SortedMap<String, ValueEditorExtension> class2ValueEditorProxyMap, String[] attributeTypesAndOids )
+    /**
+     * Creates a new instance of AttributeValueEditorDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param relation the initial attribute to value editor relation
+     * @param class2ValueEditorExtensionMap Map with class name => value editor extension
+     * @param attributeTypesAndOids the attribute types and OIDs
+     */
+    public AttributeValueEditorDialog( Shell parentShell, AttributeValueEditorRelation relation,
+        SortedMap<String, ValueEditorExtension> class2ValueEditorExtensionMap, String[] attributeTypesAndOids )
     {
         super( parentShell );
         this.relation = relation;
-        this.class2ValueEditorProxyMap = class2ValueEditorProxyMap;
+        this.class2ValueEditorExtensionMap = class2ValueEditorExtensionMap;
         this.attributeTypesAndOids = attributeTypesAndOids;
-
         this.returnRelation = null;
 
-        this.vpName2classMap = new TreeMap<String, String>();
-        for ( Iterator<ValueEditorExtension> it = this.class2ValueEditorProxyMap.values().iterator(); it.hasNext(); )
+        this.veName2classMap = new TreeMap<String, String>();
+        for ( ValueEditorExtension vee : class2ValueEditorExtensionMap.values() )
         {
-            ValueEditorExtension vp = it.next();
-            vpName2classMap.put( vp.name, vp.className );
+            veName2classMap.put( vee.name, vee.className );
         }
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected void configureShell( Shell newShell )
     {
         super.configureShell( newShell );
@@ -82,27 +104,32 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected void okPressed()
     {
-        this.returnRelation = new AttributeValueProviderRelation( this.typeOrOidCombo.getText(), this.vpName2classMap
-            .get( this.valueEditorCombo.getText() ) );
+        returnRelation = new AttributeValueEditorRelation( typeOrOidCombo.getText(), veName2classMap
+            .get( valueEditorCombo.getText() ) );
         super.okPressed();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected Control createDialogArea( Composite parent )
     {
-
         Composite composite = ( Composite ) super.createDialogArea( parent );
 
         Composite c = BaseWidgetUtils.createColumnContainer( composite, 2, 1 );
         BaseWidgetUtils.createLabel( c, "Attribute Type or OID:", 1 );
-        this.typeOrOidCombo = BaseWidgetUtils.createCombo( c, this.attributeTypesAndOids, -1, 1 );
-        if ( this.relation != null && this.relation.getAttributeNumericOidOrType() != null )
+        typeOrOidCombo = BaseWidgetUtils.createCombo( c, attributeTypesAndOids, -1, 1 );
+        if ( relation != null && relation.getAttributeNumericOidOrType() != null )
         {
-            this.typeOrOidCombo.setText( this.relation.getAttributeNumericOidOrType() );
+            typeOrOidCombo.setText( relation.getAttributeNumericOidOrType() );
         }
-        this.typeOrOidCombo.addModifyListener( new ModifyListener()
+        typeOrOidCombo.addModifyListener( new ModifyListener()
         {
             public void modifyText( ModifyEvent e )
             {
@@ -111,15 +138,14 @@
         } );
 
         BaseWidgetUtils.createLabel( c, "Value Editor:", 1 );
-        this.valueEditorCombo = BaseWidgetUtils.createReadonlyCombo( c, vpName2classMap.keySet()
-            .toArray( new String[0] ), -1, 1 );
-        if ( this.relation != null && this.relation.getValueProviderClassname() != null
-            && this.class2ValueEditorProxyMap.containsKey( this.relation.getValueProviderClassname() ) )
+        valueEditorCombo = BaseWidgetUtils.createReadonlyCombo( c, veName2classMap.keySet().toArray( new String[0] ),
+            -1, 1 );
+        if ( relation != null && relation.getValueEditorClassName() != null
+            && class2ValueEditorExtensionMap.containsKey( relation.getValueEditorClassName() ) )
         {
-            this.valueEditorCombo.setText( ( this.class2ValueEditorProxyMap.get( this.relation
-                .getValueProviderClassname() ) ).name );
+            valueEditorCombo.setText( ( class2ValueEditorExtensionMap.get( relation.getValueEditorClassName() ) ).name );
         }
-        this.valueEditorCombo.addModifyListener( new ModifyListener()
+        valueEditorCombo.addModifyListener( new ModifyListener()
         {
             public void modifyText( ModifyEvent e )
             {
@@ -134,11 +160,16 @@
     private void validate()
     {
         super.getButton( IDialogConstants.OK_ID ).setEnabled(
-            !"".equals( this.valueEditorCombo.getText() ) && !"".equals( this.typeOrOidCombo.getText() ) );
+            !"".equals( valueEditorCombo.getText() ) && !"".equals( typeOrOidCombo.getText() ) );
     }
 
 
-    public AttributeValueProviderRelation getRelation()
+    /**
+     * Gets the selected attribute to value editor relation.
+     * 
+     * @return the selected attribute to value editor relation
+     */
+    public AttributeValueEditorRelation getRelation()
     {
         return returnRelation;
     }

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributesPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributesPreferencePage.java?rev=609212&r1=609211&r2=609212&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributesPreferencePage.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributesPreferencePage.java Sat Jan  5 12:42:20 2008
@@ -24,48 +24,32 @@
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
-import org.eclipse.jface.preference.ColorSelector;
-import org.eclipse.jface.preference.PreferenceConverter;
 import org.eclipse.jface.preference.PreferencePage;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.RGB;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPreferencePage;
 
 
+/**
+ * The AttributesPreferencePage contains general settings for attributes.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class AttributesPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
 {
 
-    private final String[] ATTRIBUTE_TYPES = new String[]
-        { "Objectclass attribute:", "Must attributes:", "May attributes:", "Operational attributes:" };
-
-    private final String[] ATTRIBUTE_FONT_CONSTANTS = new String[]
-        { BrowserCommonConstants.PREFERENCE_OBJECTCLASS_FONT, BrowserCommonConstants.PREFERENCE_MUSTATTRIBUTE_FONT,
-        BrowserCommonConstants.PREFERENCE_MAYATTRIBUTE_FONT, BrowserCommonConstants.PREFERENCE_OPERATIONALATTRIBUTE_FONT };
-
-    private final String[] ATTRIBUTE_COLOR_CONSTANTS = new String[]
-        { BrowserCommonConstants.PREFERENCE_OBJECTCLASS_COLOR, BrowserCommonConstants.PREFERENCE_MUSTATTRIBUTE_COLOR,
-        BrowserCommonConstants.PREFERENCE_MAYATTRIBUTE_COLOR, BrowserCommonConstants.PREFERENCE_OPERATIONALATTRIBUTE_COLOR };
-
-    private Label[] attributeTypeLabels = new Label[ATTRIBUTE_TYPES.length];
-
-    private ColorSelector[] attributeColorSelectors = new ColorSelector[ATTRIBUTE_TYPES.length];
-
-    private Button[] attributeBoldButtons = new Button[ATTRIBUTE_TYPES.length];
-
-    private Button[] attributeItalicButtons = new Button[ATTRIBUTE_TYPES.length];
-
     private Button showRawValuesButton;
 
 
+    /**
+     * Creates a new instance of AttributesPreferencePage.
+     */
     public AttributesPreferencePage()
     {
         super( "Attributes" );
@@ -74,14 +58,19 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void init( IWorkbench workbench )
     {
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected Control createContents( Composite parent )
     {
-
         Composite composite = new Composite( parent, SWT.NONE );
         GridLayout layout = new GridLayout( 1, false );
         layout.marginWidth = 0;
@@ -95,28 +84,7 @@
 
         BaseWidgetUtils.createSpacer( composite, 1 );
         BaseWidgetUtils.createSpacer( composite, 1 );
-        Group colorsAndFontsGroup = BaseWidgetUtils.createGroup( composite, "Attribute Colors and Fonts", 1 );
-        colorsAndFontsGroup.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-        Composite colorsAndFontsComposite = BaseWidgetUtils.createColumnContainer( colorsAndFontsGroup, 4, 1 );
-        for ( int i = 0; i < ATTRIBUTE_TYPES.length; i++ )
-        {
-            final int index = i;
-
-            attributeTypeLabels[i] = BaseWidgetUtils.createLabel( colorsAndFontsComposite, ATTRIBUTE_TYPES[i], 1 );
-            attributeTypeLabels[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-            attributeColorSelectors[i] = new ColorSelector( colorsAndFontsComposite );
-            attributeBoldButtons[i] = BaseWidgetUtils.createCheckbox( colorsAndFontsComposite, "Bold", 1 );
-            attributeItalicButtons[i] = BaseWidgetUtils.createCheckbox( colorsAndFontsComposite, "Italic", 1 );
-
-            FontData[] fontDatas = PreferenceConverter.getFontDataArray( BrowserCommonActivator.getDefault()
-                .getPreferenceStore(), ATTRIBUTE_FONT_CONSTANTS[i] );
-            RGB rgb = PreferenceConverter.getColor( BrowserCommonActivator.getDefault().getPreferenceStore(),
-                ATTRIBUTE_COLOR_CONSTANTS[i] );
-            setColorsAndFonts( index, fontDatas, rgb );
-        }
 
-        BaseWidgetUtils.createSpacer( composite, 1 );
-        BaseWidgetUtils.createSpacer( composite, 1 );
         showRawValuesButton = BaseWidgetUtils.createCheckbox( composite, "Show raw values", 1 );
         showRawValuesButton.setSelection( getPreferenceStore().getBoolean(
             BrowserCommonConstants.PREFERENCE_SHOW_RAW_VALUES ) );
@@ -126,91 +94,24 @@
     }
 
 
-    private void setColorsAndFonts( int index, FontData[] fontDatas, RGB rgb )
-    {
-        boolean bold = isBold( fontDatas );
-        boolean italic = isItalic( fontDatas );
-        attributeColorSelectors[index].setColorValue( rgb );
-        attributeBoldButtons[index].setSelection( bold );
-        attributeItalicButtons[index].setSelection( italic );
-    }
-
-
-    private void setFontData( FontData[] fontDatas, Button boldButton, Button italicButton )
-    {
-        for ( int j = 0; j < fontDatas.length; j++ )
-        {
-            int style = SWT.NORMAL;
-            if ( boldButton.getSelection() )
-                style |= SWT.BOLD;
-            if ( italicButton.getSelection() )
-                style |= SWT.ITALIC;
-            fontDatas[j].setStyle( style );
-        }
-    }
-
-
-    private boolean isBold( FontData[] fontDatas )
-    {
-        boolean bold = false;
-        for ( int j = 0; j < fontDatas.length; j++ )
-        {
-            if ( ( fontDatas[j].getStyle() & SWT.BOLD ) != SWT.NORMAL )
-                bold = true;
-        }
-        return bold;
-    }
-
-
-    private boolean isItalic( FontData[] fontDatas )
-    {
-        boolean italic = false;
-        for ( int j = 0; j < fontDatas.length; j++ )
-        {
-            if ( ( fontDatas[j].getStyle() & SWT.ITALIC ) != SWT.NORMAL )
-                italic = true;
-        }
-        return italic;
-    }
-
-
+    /**
+     * {@inheritDoc}
+     */
     public boolean performOk()
     {
-
-        for ( int i = 0; i < ATTRIBUTE_TYPES.length; i++ )
-        {
-            FontData[] fontDatas = PreferenceConverter.getFontDataArray( BrowserCommonActivator.getDefault()
-                .getPreferenceStore(), ATTRIBUTE_FONT_CONSTANTS[i] );
-            setFontData( fontDatas, this.attributeBoldButtons[i], this.attributeItalicButtons[i] );
-            RGB rgb = attributeColorSelectors[i].getColorValue();
-            PreferenceConverter.setValue( BrowserCommonActivator.getDefault().getPreferenceStore(),
-                ATTRIBUTE_FONT_CONSTANTS[i], fontDatas );
-            PreferenceConverter.setValue( BrowserCommonActivator.getDefault().getPreferenceStore(),
-                ATTRIBUTE_COLOR_CONSTANTS[i], rgb );
-        }
-
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_SHOW_RAW_VALUES,
-            this.showRawValuesButton.getSelection() );
-
+            showRawValuesButton.getSelection() );
         return true;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected void performDefaults()
     {
-
-        for ( int i = 0; i < ATTRIBUTE_TYPES.length; i++ )
-        {
-            FontData[] fontDatas = PreferenceConverter.getDefaultFontDataArray( BrowserCommonActivator.getDefault()
-                .getPreferenceStore(), ATTRIBUTE_FONT_CONSTANTS[i] );
-            RGB rgb = PreferenceConverter.getDefaultColor( BrowserCommonActivator.getDefault().getPreferenceStore(),
-                ATTRIBUTE_COLOR_CONSTANTS[i] );
-            setColorsAndFonts( i, fontDatas, rgb );
-        }
-
         showRawValuesButton.setSelection( getPreferenceStore().getDefaultBoolean(
             BrowserCommonConstants.PREFERENCE_SHOW_RAW_VALUES ) );
-
         super.performDefaults();
     }
 

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BinaryAttributesAndSyntaxesPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BinaryAttributesAndSyntaxesPreferencePage.java?rev=609212&r1=609211&r2=609212&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BinaryAttributesAndSyntaxesPreferencePage.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BinaryAttributesAndSyntaxesPreferencePage.java Sat Jan  5 12:42:20 2008
@@ -28,15 +28,14 @@
 import java.util.TreeMap;
 
 import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
-import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
 import org.apache.directory.studio.ldapbrowser.core.BrowserConnectionManager;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeTypeDescription;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.BinaryAttribute;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.BinarySyntax;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.LdapSyntaxDescription;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
-
 import org.eclipse.jface.preference.PreferencePage;
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.DoubleClickEvent;
@@ -59,116 +58,137 @@
 import org.eclipse.ui.IWorkbenchPreferencePage;
 
 
+/**
+ * The BinaryAttributesAndSyntaxesPreferencePage is used to specify
+ * binary attributes and syntaxes.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class BinaryAttributesAndSyntaxesPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
 {
 
-    private SortedMap attributeOid2AtdMap;
+    /** Map with attribute OID => attribute type description */
+    private SortedMap<String, AttributeTypeDescription> attributeOid2AtdMap;
 
-    private SortedMap attributeNames2AtdMap;
+    /** Map with attribute name => attribute type description */
+    private SortedMap<String, AttributeTypeDescription> attributeNames2AtdMap;
 
+    /** The attribute names and OIDs. */
     private String[] attributeNamesAndOids;
 
-    private SortedMap syntaxOid2LsdMap;
+    /** Map with syntax OID => syntax description */
+    private SortedMap<String, LdapSyntaxDescription> syntaxOid2LsdMap;
 
-    private SortedMap syntaxDesc2LsdMap;
+    /** Map with syntax DESC => syntax description */
+    private SortedMap<String, LdapSyntaxDescription> syntaxDesc2LsdMap;
 
+    /** The syntax OIDs. */
     private String[] syntaxOids;
 
-    private List attributeList;
+    /** The attribute list. */
+    private List<BinaryAttribute> attributeList;
 
+    /** The attribute viewer. */
     private TableViewer attributeViewer;
 
+    /** The attribute add button. */
     private Button attributeAddButton;
 
+    /** The attribute edit button. */
     private Button attributeEditButton;
 
+    /** The attribute remove button. */
     private Button attributeRemoveButton;
 
-    private List syntaxList;
+    /** The syntax list. */
+    private List<BinarySyntax> syntaxList;
 
+    /** The syntax viewer. */
     private TableViewer syntaxViewer;
 
+    /** The syntax add button. */
     private Button syntaxAddButton;
 
+    /** The syntax edit button. */
     private Button syntaxEditButton;
 
+    /** The syntax remove button. */
     private Button syntaxRemoveButton;
 
 
+    /**
+     * Creates a new instance of BinaryAttributesAndSyntaxesPreferencePage.
+     */
     public BinaryAttributesAndSyntaxesPreferencePage()
     {
-        super();
-        super.setDescription( "Specify attributes to handle as binary:" );
+        super( "Binary Attributes" );
+        super.setDescription( "Specify attributes and syntaxes to handle as binary:" );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void init( IWorkbench workbench )
     {
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected Control createContents( Composite parent )
     {
-
         Composite composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
         composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
 
         // init available attribute types
-        this.attributeNames2AtdMap = new TreeMap();
-        this.attributeOid2AtdMap = new TreeMap();
+        attributeNames2AtdMap = new TreeMap<String, AttributeTypeDescription>();
+        attributeOid2AtdMap = new TreeMap<String, AttributeTypeDescription>();
         BrowserConnectionManager cm = BrowserCorePlugin.getDefault().getConnectionManager();
         IBrowserConnection[] connections = cm.getBrowserConnections();
-        for ( int i = 0; i < connections.length; i++ )
+        for ( IBrowserConnection browserConnection : connections )
         {
-            Schema schema = connections[i].getSchema();
-            if ( schema != null )
-            {
-                createAttributeMaps( schema );
-            }
+            Schema schema = browserConnection.getSchema();
+            createAttributeMaps( schema );
         }
         createAttributeMaps( Schema.DEFAULT_SCHEMA );
-        this.attributeNamesAndOids = new String[this.attributeNames2AtdMap.size() + this.attributeOid2AtdMap.size()];
-        System.arraycopy( this.attributeNames2AtdMap.keySet().toArray(), 0, this.attributeNamesAndOids, 0,
-            this.attributeNames2AtdMap.size() );
-        System.arraycopy( this.attributeOid2AtdMap.keySet().toArray(), 0, this.attributeNamesAndOids,
-            this.attributeNames2AtdMap.size(), this.attributeOid2AtdMap.size() );
+        attributeNamesAndOids = new String[attributeNames2AtdMap.size() + attributeOid2AtdMap.size()];
+        System.arraycopy( attributeNames2AtdMap.keySet().toArray(), 0, attributeNamesAndOids, 0, attributeNames2AtdMap
+            .size() );
+        System.arraycopy( attributeOid2AtdMap.keySet().toArray(), 0, attributeNamesAndOids, attributeNames2AtdMap
+            .size(), attributeOid2AtdMap.size() );
 
         // init available syntaxes
-        this.syntaxOid2LsdMap = new TreeMap();
-        this.syntaxDesc2LsdMap = new TreeMap();
-        for ( int i = 0; i < connections.length; i++ )
+        syntaxOid2LsdMap = new TreeMap<String, LdapSyntaxDescription>();
+        syntaxDesc2LsdMap = new TreeMap<String, LdapSyntaxDescription>();
+        for ( IBrowserConnection browserConnection : connections )
         {
-            Schema schema = connections[i].getSchema();
-            if ( schema != null )
-            {
-                createSyntaxMaps( schema );
-            }
+            Schema schema = browserConnection.getSchema();
+            createSyntaxMaps( schema );
         }
         createSyntaxMaps( Schema.DEFAULT_SCHEMA );
-        this.syntaxOids = new String[this.syntaxOid2LsdMap.size()];
-        System
-            .arraycopy( this.syntaxOid2LsdMap.keySet().toArray(), 0, this.syntaxOids, 0, this.syntaxOid2LsdMap.size() );
+        syntaxOids = new String[syntaxOid2LsdMap.size()];
+        System.arraycopy( syntaxOid2LsdMap.keySet().toArray(), 0, syntaxOids, 0, syntaxOid2LsdMap.size() );
 
         // create attribute contents
         BaseWidgetUtils.createSpacer( composite, 1 );
         BaseWidgetUtils.createSpacer( composite, 1 );
         createAttributeContents( composite );
-        attributeList = new ArrayList( Arrays.asList( BrowserCorePlugin.getDefault().getCorePreferences()
-            .getBinaryAttributes() ) );
-        attributeViewer.setInput( this.attributeList );
+        attributeList = new ArrayList<BinaryAttribute>( Arrays.asList( BrowserCorePlugin.getDefault()
+            .getCorePreferences().getBinaryAttributes() ) );
+        attributeViewer.setInput( attributeList );
         attributeViewer.getTable().getColumn( 0 ).pack();
-        // attributeViewer.getTable().getColumn(1).pack();
-        attributeViewer.getTable().pack();
 
         // create syntax contents
         BaseWidgetUtils.createSpacer( composite, 1 );
         BaseWidgetUtils.createSpacer( composite, 1 );
         createSyntaxContents( composite );
-        syntaxList = new ArrayList( Arrays.asList( BrowserCorePlugin.getDefault().getCorePreferences()
+        syntaxList = new ArrayList<BinarySyntax>( Arrays.asList( BrowserCorePlugin.getDefault().getCorePreferences()
             .getBinarySyntaxes() ) );
-        syntaxViewer.setInput( this.syntaxList );
+        syntaxViewer.setInput( syntaxList );
         syntaxViewer.getTable().getColumn( 0 ).pack();
-        // syntaxViewer.getTable().getColumn(1).pack();
         syntaxViewer.getTable().pack();
 
         return composite;
@@ -178,17 +198,15 @@
     private void createAttributeMaps( Schema schema )
     {
         AttributeTypeDescription[] atds = schema.getAttributeTypeDescriptions();
-        for ( int i = 0; i < atds.length; i++ )
+        for ( AttributeTypeDescription atd : atds )
         {
+            attributeOid2AtdMap.put( atd.getNumericOID(), atd );
 
-            attributeOid2AtdMap.put( atds[i].getNumericOID(), atds[i] );
-
-            String[] names = atds[i].getNames();
-            for ( int j = 0; j < names.length; j++ )
+            String[] names = atd.getNames();
+            for ( String name : names )
             {
-                attributeNames2AtdMap.put( names[j], atds[i] );
+                attributeNames2AtdMap.put( name, atd );
             }
-
         }
     }
 
@@ -196,23 +214,20 @@
     private void createSyntaxMaps( Schema schema )
     {
         LdapSyntaxDescription[] lsds = schema.getLdapSyntaxDescriptions();
-        for ( int i = 0; i < lsds.length; i++ )
+        for ( LdapSyntaxDescription lsd : lsds )
         {
+            syntaxOid2LsdMap.put( lsd.getNumericOID(), lsd );
 
-            syntaxOid2LsdMap.put( lsds[i].getNumericOID(), lsds[i] );
-
-            if ( lsds[i].getDesc() != null )
+            if ( lsd.getDesc() != null )
             {
-                syntaxDesc2LsdMap.put( lsds[i].getDesc(), lsds[i] );
+                syntaxDesc2LsdMap.put( lsd.getDesc(), lsd );
             }
-
         }
     }
 
 
     private void createAttributeContents( Composite parent )
     {
-
         BaseWidgetUtils.createLabel( parent, "Binary Attributes", 1 );
 
         Composite composite = BaseWidgetUtils.createColumnContainer( parent, 2, 1 );
@@ -275,16 +290,11 @@
                 removeAttribute();
             }
         } );
-
-        // c1.pack();
-        // c2.pack();
-        // table.pack();
     }
 
 
     private void createSyntaxContents( Composite parent )
     {
-
         BaseWidgetUtils.createLabel( parent, "Binary Syntaxes", 1 );
 
         Composite composite = BaseWidgetUtils.createColumnContainer( parent, 2, 1 );
@@ -347,109 +357,110 @@
                 removeSyntax();
             }
         } );
-
-        // c1.pack();
-        // c2.pack();
-        // table.pack();
     }
 
 
-    protected void addAttribute()
+    private void addAttribute()
     {
-        AttributeDialog dialog = new AttributeDialog( getShell(), null, this.attributeNamesAndOids );
+        AttributeDialog dialog = new AttributeDialog( getShell(), null, attributeNamesAndOids );
         if ( dialog.open() == AttributeValueEditorDialog.OK )
         {
-            this.attributeList.add( dialog.getAttribute() );
-            this.attributeViewer.refresh();
+            attributeList.add( dialog.getAttribute() );
+            attributeViewer.refresh();
         }
     }
 
 
-    protected void removeAttribute()
+    private void removeAttribute()
     {
-        Object o = ( ( StructuredSelection ) this.attributeViewer.getSelection() ).getFirstElement();
-        this.attributeList.remove( o );
-        this.attributeViewer.refresh();
+        Object o = ( ( StructuredSelection ) attributeViewer.getSelection() ).getFirstElement();
+        attributeList.remove( o );
+        attributeViewer.refresh();
     }
 
 
-    protected void editAttribute()
+    private void editAttribute()
     {
-        StructuredSelection sel = ( StructuredSelection ) this.attributeViewer.getSelection();
+        StructuredSelection sel = ( StructuredSelection ) attributeViewer.getSelection();
         if ( !sel.isEmpty() )
         {
             BinaryAttribute attribute = ( BinaryAttribute ) sel.getFirstElement();
-            AttributeDialog dialog = new AttributeDialog( getShell(), attribute, this.attributeNamesAndOids );
+            AttributeDialog dialog = new AttributeDialog( getShell(), attribute, attributeNamesAndOids );
             if ( dialog.open() == AttributeValueEditorDialog.OK )
             {
-                int index = this.attributeList.indexOf( attribute );
-                this.attributeList.set( index, dialog.getAttribute() );
-                this.attributeViewer.refresh();
+                int index = attributeList.indexOf( attribute );
+                attributeList.set( index, dialog.getAttribute() );
+                attributeViewer.refresh();
             }
         }
     }
 
 
-    protected void addSyntax()
+    private void addSyntax()
     {
-        SyntaxDialog dialog = new SyntaxDialog( getShell(), null, this.syntaxOids );
+        SyntaxDialog dialog = new SyntaxDialog( getShell(), null, syntaxOids );
         if ( dialog.open() == SyntaxValueEditorDialog.OK )
         {
-            this.syntaxList.add( dialog.getSyntax() );
-            this.syntaxViewer.refresh();
+            syntaxList.add( dialog.getSyntax() );
+            syntaxViewer.refresh();
         }
     }
 
 
-    protected void removeSyntax()
+    private void removeSyntax()
     {
-        Object o = ( ( StructuredSelection ) this.syntaxViewer.getSelection() ).getFirstElement();
-        this.syntaxList.remove( o );
-        this.syntaxViewer.refresh();
+        Object o = ( ( StructuredSelection ) syntaxViewer.getSelection() ).getFirstElement();
+        syntaxList.remove( o );
+        syntaxViewer.refresh();
     }
 
 
-    protected void editSyntax()
+    private void editSyntax()
     {
-        StructuredSelection sel = ( StructuredSelection ) this.syntaxViewer.getSelection();
+        StructuredSelection sel = ( StructuredSelection ) syntaxViewer.getSelection();
         if ( !sel.isEmpty() )
         {
             BinarySyntax syntax = ( BinarySyntax ) sel.getFirstElement();
-            SyntaxDialog dialog = new SyntaxDialog( getShell(), syntax, this.syntaxOids );
+            SyntaxDialog dialog = new SyntaxDialog( getShell(), syntax, syntaxOids );
             if ( dialog.open() == SyntaxValueEditorDialog.OK )
             {
-                int index = this.syntaxList.indexOf( syntax );
-                this.syntaxList.set( index, dialog.getSyntax() );
-                this.syntaxViewer.refresh();
+                int index = syntaxList.indexOf( syntax );
+                syntaxList.set( index, dialog.getSyntax() );
+                syntaxViewer.refresh();
             }
         }
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean performOk()
     {
-        BinaryAttribute[] attributes = ( BinaryAttribute[] ) this.attributeList
-            .toArray( new BinaryAttribute[this.attributeList.size()] );
+        BinaryAttribute[] attributes = attributeList.toArray( new BinaryAttribute[attributeList.size()] );
         BrowserCorePlugin.getDefault().getCorePreferences().setBinaryAttributes( attributes );
 
-        BinarySyntax[] syntaxes = ( BinarySyntax[] ) this.syntaxList.toArray( new BinarySyntax[this.syntaxList.size()] );
+        BinarySyntax[] syntaxes = syntaxList.toArray( new BinarySyntax[syntaxList.size()] );
         BrowserCorePlugin.getDefault().getCorePreferences().setBinarySyntaxes( syntaxes );
 
         return true;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected void performDefaults()
     {
-        this.attributeList.clear();
-        this.attributeList.addAll( Arrays.asList( BrowserCorePlugin.getDefault().getCorePreferences()
+        attributeList.clear();
+        attributeList.addAll( Arrays.asList( BrowserCorePlugin.getDefault().getCorePreferences()
             .getDefaultBinaryAttributes() ) );
-        this.attributeViewer.refresh();
+        attributeViewer.refresh();
 
-        this.syntaxList.clear();
-        this.syntaxList.addAll( Arrays.asList( BrowserCorePlugin.getDefault().getCorePreferences()
+        syntaxList.clear();
+        syntaxList.addAll( Arrays.asList( BrowserCorePlugin.getDefault().getCorePreferences()
             .getDefaultBinarySyntaxes() ) );
-        this.syntaxViewer.refresh();
+        syntaxViewer.refresh();
 
         super.performDefaults();
     }
@@ -474,11 +485,11 @@
                             AttributeTypeDescription atd = ( AttributeTypeDescription ) attributeNames2AtdMap
                                 .get( attribute.getAttributeNumericOidOrName() );
                             String s = atd.getNumericOID();
-                            for ( int i = 0; i < atd.getNames().length; i++ )
+                            for ( String attributeName : atd.getNames() )
                             {
-                                if ( !attribute.getAttributeNumericOidOrName().equals( atd.getNames()[i] ) )
+                                if ( !attribute.getAttributeNumericOidOrName().equals( attributeName ) )
                                 {
-                                    s += ", " + atd.getNames()[i];
+                                    s += ", " + attributeName;
                                 }
                             }
                             return s;

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BrowserPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BrowserPreferencePage.java?rev=609212&r1=609211&r2=609212&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BrowserPreferencePage.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BrowserPreferencePage.java Sat Jan  5 12:42:20 2008
@@ -44,6 +44,12 @@
 import org.eclipse.ui.IWorkbenchPreferencePage;
 
 
+/**
+ * The BrowserPreferencePage contains general settings for the browser view.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class BrowserPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
 {
 
@@ -78,22 +84,30 @@
     private Button fetchSubentriesButton;
 
 
+    /**
+     * Creates a new instance of BrowserPreferencePage.
+     */
     public BrowserPreferencePage()
     {
-        super();
+        super( "Browser" );
         super.setPreferenceStore( BrowserCommonActivator.getDefault().getPreferenceStore() );
         super.setDescription( "General settings for the LDAP browser view:" );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void init( IWorkbench workbench )
     {
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected Control createContents( Composite parent )
     {
-
         Composite composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
 
         BaseWidgetUtils.createSpacer( composite, 1 );
@@ -171,8 +185,8 @@
                 updateEnabled();
             }
         } );
-        searchResultAbbreviateMaxLengthText = BaseWidgetUtils
-            .createText( searchResultAbbreviateComposite, getPreferenceStore().getString(
+        searchResultAbbreviateMaxLengthText = BaseWidgetUtils.createText( searchResultAbbreviateComposite,
+            getPreferenceStore().getString(
                 BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_ABBREVIATE_MAX_LENGTH ), 3, 1 );
         searchResultAbbreviateMaxLengthText.setEnabled( searchResultAbbreviateButton.getSelection() );
         searchResultAbbreviateMaxLengthText.addVerifyListener( new VerifyListener()
@@ -257,50 +271,52 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean performOk()
     {
-
         Preferences coreStore = BrowserCorePlugin.getDefault().getPluginPreferences();
-        coreStore.setValue( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN, this.checkForChildrenButton
-            .getSelection() );
-        coreStore
-            .setValue( BrowserCoreConstants.PREFERENCE_FETCH_SUBENTRIES, this.fetchSubentriesButton.getSelection() );
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN, checkForChildrenButton.getSelection() );
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FETCH_SUBENTRIES, fetchSubentriesButton.getSelection() );
         BrowserCorePlugin.getDefault().savePluginPreferences();
 
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_BROWSER_EXPAND_BASE_ENTRIES,
-            this.expandBaseEntriesButton.getSelection() );
+            expandBaseEntriesButton.getSelection() );
 
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_BROWSER_ENABLE_FOLDING,
-            this.enableFoldingButton.getSelection() );
+            enableFoldingButton.getSelection() );
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_BROWSER_FOLDING_SIZE,
-            this.foldingSizeText.getText().trim() );
+            foldingSizeText.getText().trim() );
 
         getPreferenceStore().setValue(
             BrowserCommonConstants.PREFERENCE_BROWSER_ENTRY_LABEL,
-            this.entryLabelCombo.getSelectionIndex() == 2 ? BrowserCommonConstants.SHOW_RDN_VALUE : this.entryLabelCombo
+            entryLabelCombo.getSelectionIndex() == 2 ? BrowserCommonConstants.SHOW_RDN_VALUE : entryLabelCombo
                 .getSelectionIndex() == 1 ? BrowserCommonConstants.SHOW_RDN : BrowserCommonConstants.SHOW_DN );
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_BROWSER_ENTRY_ABBREVIATE,
-            this.entryAbbreviateButton.getSelection() );
+            entryAbbreviateButton.getSelection() );
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_BROWSER_ENTRY_ABBREVIATE_MAX_LENGTH,
-            this.entryAbbreviateMaxLengthText.getText().trim() );
+            entryAbbreviateMaxLengthText.getText().trim() );
 
         getPreferenceStore().setValue(
             BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_LABEL,
-            this.searchResultLabelCombo.getSelectionIndex() == 2 ? BrowserCommonConstants.SHOW_RDN_VALUE
-                : this.searchResultLabelCombo.getSelectionIndex() == 1 ? BrowserCommonConstants.SHOW_RDN
+            searchResultLabelCombo.getSelectionIndex() == 2 ? BrowserCommonConstants.SHOW_RDN_VALUE
+                : searchResultLabelCombo.getSelectionIndex() == 1 ? BrowserCommonConstants.SHOW_RDN
                     : BrowserCommonConstants.SHOW_DN );
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_ABBREVIATE,
-            this.searchResultAbbreviateButton.getSelection() );
+            searchResultAbbreviateButton.getSelection() );
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_ABBREVIATE_MAX_LENGTH,
-            this.searchResultAbbreviateMaxLengthText.getText().trim() );
+            searchResultAbbreviateMaxLengthText.getText().trim() );
 
         return true;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected void performDefaults()
     {
-
         entryLabelCombo
             .select( getPreferenceStore().getDefaultInt( BrowserCommonConstants.PREFERENCE_BROWSER_ENTRY_LABEL ) == BrowserCommonConstants.SHOW_RDN_VALUE ? 2
                 : getPreferenceStore().getDefaultInt( BrowserCommonConstants.PREFERENCE_BROWSER_ENTRY_LABEL ) == BrowserCommonConstants.SHOW_RDN ? 1

Added: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ColorsAndFontsPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ColorsAndFontsPreferencePage.java?rev=609212&view=auto
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ColorsAndFontsPreferencePage.java (added)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ColorsAndFontsPreferencePage.java Sat Jan  5 12:42:20 2008
@@ -0,0 +1,360 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.ldapbrowser.common.dialogs.preferences;
+
+
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
+import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
+import org.eclipse.jface.preference.ColorSelector;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+
+/**
+ * The ColorsAndFontsPreferencePage contains color and font settings.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ColorsAndFontsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
+{
+
+    private final String[] ERROR_TYPES = new String[]
+        { "Warnings:", "Errors:" };
+
+    private final String[] ERROR_FONT_CONSTANTS = new String[]
+        { BrowserCommonConstants.PREFERENCE_WARNING_FONT, BrowserCommonConstants.PREFERENCE_ERROR_FONT };
+
+    private final String[] ERROR_COLOR_CONSTANTS = new String[]
+        { BrowserCommonConstants.PREFERENCE_WARNING_COLOR, BrowserCommonConstants.PREFERENCE_ERROR_COLOR };
+
+    private Label[] errorTypeLabels = new Label[ERROR_TYPES.length];
+
+    private ColorSelector[] errorColorSelectors = new ColorSelector[ERROR_TYPES.length];
+
+    private Button[] errorBoldButtons = new Button[ERROR_TYPES.length];
+
+    private Button[] errorItalicButtons = new Button[ERROR_TYPES.length];
+
+    private Label quickfilterTypeLabel;
+
+    private ColorSelector quickfilterForegroundColorSelector;;
+
+    private ColorSelector quickfilterBackgroundColorSelector;;
+
+    private Button quickfilterBoldButton;
+
+    private Button quickfilterItalicButton;
+
+    private final String[] ATTRIBUTE_TYPES = new String[]
+        { "Objectclass attribute:", "Must attributes:", "May attributes:", "Operational attributes:" };
+
+    private final String[] ATTRIBUTE_FONT_CONSTANTS = new String[]
+        { BrowserCommonConstants.PREFERENCE_OBJECTCLASS_FONT, BrowserCommonConstants.PREFERENCE_MUSTATTRIBUTE_FONT,
+            BrowserCommonConstants.PREFERENCE_MAYATTRIBUTE_FONT,
+            BrowserCommonConstants.PREFERENCE_OPERATIONALATTRIBUTE_FONT };
+
+    private final String[] ATTRIBUTE_COLOR_CONSTANTS = new String[]
+        { BrowserCommonConstants.PREFERENCE_OBJECTCLASS_COLOR, BrowserCommonConstants.PREFERENCE_MUSTATTRIBUTE_COLOR,
+            BrowserCommonConstants.PREFERENCE_MAYATTRIBUTE_COLOR,
+            BrowserCommonConstants.PREFERENCE_OPERATIONALATTRIBUTE_COLOR };
+
+    private Label[] attributeTypeLabels = new Label[ATTRIBUTE_TYPES.length];
+
+    private ColorSelector[] attributeColorSelectors = new ColorSelector[ATTRIBUTE_TYPES.length];
+
+    private Button[] attributeBoldButtons = new Button[ATTRIBUTE_TYPES.length];
+
+    private Button[] attributeItalicButtons = new Button[ATTRIBUTE_TYPES.length];
+
+
+    /**
+     * Creates a new instance of ColorsAndFontsPreferencePage.
+     */
+    public ColorsAndFontsPreferencePage()
+    {
+        super( "Colors and Fonts" );
+        super.setPreferenceStore( BrowserCommonActivator.getDefault().getPreferenceStore() );
+        super.setDescription( "Color and Font settings for the LDAP browser:" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void init( IWorkbench workbench )
+    {
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected Control createContents( Composite parent )
+    {
+        Composite composite = new Composite( parent, SWT.NONE );
+        GridLayout layout = new GridLayout( 1, false );
+        layout.marginWidth = 0;
+        layout.marginHeight = 0;
+        layout.marginLeft = 0;
+        layout.marginRight = 0;
+        layout.marginTop = 0;
+        layout.marginBottom = 0;
+        composite.setLayout( layout );
+        composite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+
+        // warning and error
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        Group errorGroup = BaseWidgetUtils.createGroup( composite, "Warning and Error Colors and Fonts", 1 );
+        errorGroup.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        Composite errorComposite = BaseWidgetUtils.createColumnContainer( errorGroup, 4, 1 );
+        for ( int i = 0; i < ERROR_TYPES.length; i++ )
+        {
+            errorTypeLabels[i] = BaseWidgetUtils.createLabel( errorComposite, ERROR_TYPES[i], 1 );
+            errorTypeLabels[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+            errorColorSelectors[i] = new ColorSelector( errorComposite );
+            errorBoldButtons[i] = BaseWidgetUtils.createCheckbox( errorComposite, "Bold", 1 );
+            errorItalicButtons[i] = BaseWidgetUtils.createCheckbox( errorComposite, "Italic", 1 );
+
+            FontData[] fontDatas = PreferenceConverter.getFontDataArray( BrowserCommonActivator.getDefault()
+                .getPreferenceStore(), ERROR_FONT_CONSTANTS[i] );
+            RGB rgb = PreferenceConverter.getColor( BrowserCommonActivator.getDefault().getPreferenceStore(),
+                ERROR_COLOR_CONSTANTS[i] );
+            setErrors( i, fontDatas, rgb );
+        }
+
+        // quick filter
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        Group otherGroup = BaseWidgetUtils.createGroup( composite, "Quick Filter Colors and Fonts", 1 );
+        otherGroup.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        Composite otherComposite = BaseWidgetUtils.createColumnContainer( otherGroup, 4, 1 );
+        quickfilterTypeLabel = BaseWidgetUtils.createLabel( otherComposite, "Quick Filter", 1 );
+        quickfilterTypeLabel.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        quickfilterForegroundColorSelector = new ColorSelector( otherComposite );
+        quickfilterBoldButton = BaseWidgetUtils.createCheckbox( otherComposite, "Bold", 1 );
+        quickfilterItalicButton = BaseWidgetUtils.createCheckbox( otherComposite, "Italic", 1 );
+        Label quickfilterBgLabel = BaseWidgetUtils.createLabel( otherComposite, "Quick Filter Background", 1 );
+        quickfilterBgLabel.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        quickfilterBackgroundColorSelector = new ColorSelector( otherComposite );
+        FontData[] qfFontDatas = PreferenceConverter.getFontDataArray( BrowserCommonActivator.getDefault()
+            .getPreferenceStore(), BrowserCommonConstants.PREFERENCE_QUICKFILTER_FONT );
+        RGB qfBgRgb = PreferenceConverter.getColor( BrowserCommonActivator.getDefault().getPreferenceStore(),
+            BrowserCommonConstants.PREFERENCE_QUICKFILTER_BACKGROUND_COLOR );
+        RGB qfFgRgb = PreferenceConverter.getColor( BrowserCommonActivator.getDefault().getPreferenceStore(),
+            BrowserCommonConstants.PREFERENCE_QUICKFILTER_FOREGROUND_COLOR );
+        setQuickfilter( qfFontDatas, qfFgRgb, qfBgRgb );
+
+        // attribute
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        Group colorsAndFontsGroup = BaseWidgetUtils.createGroup( composite, "Attribute Colors and Fonts", 1 );
+        colorsAndFontsGroup.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        Composite colorsAndFontsComposite = BaseWidgetUtils.createColumnContainer( colorsAndFontsGroup, 4, 1 );
+        for ( int i = 0; i < ATTRIBUTE_TYPES.length; i++ )
+        {
+            attributeTypeLabels[i] = BaseWidgetUtils.createLabel( colorsAndFontsComposite, ATTRIBUTE_TYPES[i], 1 );
+            attributeTypeLabels[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+            attributeColorSelectors[i] = new ColorSelector( colorsAndFontsComposite );
+            attributeBoldButtons[i] = BaseWidgetUtils.createCheckbox( colorsAndFontsComposite, "Bold", 1 );
+            attributeItalicButtons[i] = BaseWidgetUtils.createCheckbox( colorsAndFontsComposite, "Italic", 1 );
+
+            FontData[] fontDatas = PreferenceConverter.getFontDataArray( BrowserCommonActivator.getDefault()
+                .getPreferenceStore(), ATTRIBUTE_FONT_CONSTANTS[i] );
+            RGB rgb = PreferenceConverter.getColor( BrowserCommonActivator.getDefault().getPreferenceStore(),
+                ATTRIBUTE_COLOR_CONSTANTS[i] );
+            setColorsAndFonts( i, fontDatas, rgb );
+        }
+
+        applyDialogFont( composite );
+        return composite;
+    }
+
+
+    private void setErrors( int index, FontData[] fontDatas, RGB rgb )
+    {
+        boolean bold = isBold( fontDatas );
+        boolean italic = isItalic( fontDatas );
+        errorColorSelectors[index].setColorValue( rgb );
+        errorBoldButtons[index].setSelection( bold );
+        errorItalicButtons[index].setSelection( italic );
+    }
+
+
+    private void setQuickfilter( FontData[] fontDatas, RGB fgRgb, RGB bgRgb )
+    {
+        boolean bold = isBold( fontDatas );
+        boolean italic = isItalic( fontDatas );
+        quickfilterBackgroundColorSelector.setColorValue( bgRgb );
+        quickfilterForegroundColorSelector.setColorValue( fgRgb );
+        quickfilterBoldButton.setSelection( bold );
+        quickfilterItalicButton.setSelection( italic );
+    }
+
+
+    private void setColorsAndFonts( int index, FontData[] fontDatas, RGB rgb )
+    {
+        boolean bold = isBold( fontDatas );
+        boolean italic = isItalic( fontDatas );
+        attributeColorSelectors[index].setColorValue( rgb );
+        attributeBoldButtons[index].setSelection( bold );
+        attributeItalicButtons[index].setSelection( italic );
+    }
+
+
+    private void setFontData( FontData[] fontDatas, Button boldButton, Button italicButton )
+    {
+        for ( FontData fontData : fontDatas )
+        {
+            int style = SWT.NORMAL;
+            if ( boldButton.getSelection() )
+            {
+                style |= SWT.BOLD;
+            }
+            if ( italicButton.getSelection() )
+            {
+                style |= SWT.ITALIC;
+            }
+            fontData.setStyle( style );
+        }
+    }
+
+
+    private boolean isBold( FontData[] fontDatas )
+    {
+        boolean bold = false;
+        for ( FontData fontData : fontDatas )
+        {
+            if ( ( fontData.getStyle() & SWT.BOLD ) != SWT.NORMAL )
+            {
+                bold = true;
+            }
+        }
+        return bold;
+    }
+
+
+    private boolean isItalic( FontData[] fontDatas )
+    {
+        boolean italic = false;
+        for ( FontData fontData : fontDatas )
+        {
+            if ( ( fontData.getStyle() & SWT.ITALIC ) != SWT.NORMAL )
+            {
+                italic = true;
+            }
+        }
+        return italic;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean performOk()
+    {
+        for ( int i = 0; i < ERROR_TYPES.length; i++ )
+        {
+            FontData[] fontDatas = PreferenceConverter.getFontDataArray( BrowserCommonActivator.getDefault()
+                .getPreferenceStore(), ERROR_FONT_CONSTANTS[i] );
+            setFontData( fontDatas, errorBoldButtons[i], errorBoldButtons[i] );
+            RGB rgb = errorColorSelectors[i].getColorValue();
+            PreferenceConverter.setValue( BrowserCommonActivator.getDefault().getPreferenceStore(),
+                ERROR_FONT_CONSTANTS[i], fontDatas );
+            PreferenceConverter.setValue( BrowserCommonActivator.getDefault().getPreferenceStore(),
+                ERROR_COLOR_CONSTANTS[i], rgb );
+        }
+
+        FontData[] qfFontDatas = PreferenceConverter.getFontDataArray( BrowserCommonActivator.getDefault()
+            .getPreferenceStore(), BrowserCommonConstants.PREFERENCE_QUICKFILTER_FONT );
+        setFontData( qfFontDatas, quickfilterBoldButton, quickfilterItalicButton );
+        RGB qfBgRgb = quickfilterBackgroundColorSelector.getColorValue();
+        RGB qfFgRgb = quickfilterForegroundColorSelector.getColorValue();
+        PreferenceConverter.setValue( BrowserCommonActivator.getDefault().getPreferenceStore(),
+            BrowserCommonConstants.PREFERENCE_QUICKFILTER_FONT, qfFontDatas );
+        PreferenceConverter.setValue( BrowserCommonActivator.getDefault().getPreferenceStore(),
+            BrowserCommonConstants.PREFERENCE_QUICKFILTER_BACKGROUND_COLOR, qfBgRgb );
+        PreferenceConverter.setValue( BrowserCommonActivator.getDefault().getPreferenceStore(),
+            BrowserCommonConstants.PREFERENCE_QUICKFILTER_FOREGROUND_COLOR, qfFgRgb );
+
+        for ( int i = 0; i < ATTRIBUTE_TYPES.length; i++ )
+        {
+            FontData[] fontDatas = PreferenceConverter.getFontDataArray( BrowserCommonActivator.getDefault()
+                .getPreferenceStore(), ATTRIBUTE_FONT_CONSTANTS[i] );
+            setFontData( fontDatas, attributeBoldButtons[i], attributeItalicButtons[i] );
+            RGB rgb = attributeColorSelectors[i].getColorValue();
+            PreferenceConverter.setValue( BrowserCommonActivator.getDefault().getPreferenceStore(),
+                ATTRIBUTE_FONT_CONSTANTS[i], fontDatas );
+            PreferenceConverter.setValue( BrowserCommonActivator.getDefault().getPreferenceStore(),
+                ATTRIBUTE_COLOR_CONSTANTS[i], rgb );
+        }
+        return true;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void performDefaults()
+    {
+        for ( int i = 0; i < ERROR_TYPES.length; i++ )
+        {
+            FontData[] fontDatas = PreferenceConverter.getDefaultFontDataArray( BrowserCommonActivator.getDefault()
+                .getPreferenceStore(), ERROR_FONT_CONSTANTS[i] );
+            RGB rgb = PreferenceConverter.getDefaultColor( BrowserCommonActivator.getDefault().getPreferenceStore(),
+                ERROR_COLOR_CONSTANTS[i] );
+            setErrors( i, fontDatas, rgb );
+        }
+
+        FontData[] qfFontDatas = PreferenceConverter.getDefaultFontDataArray( BrowserCommonActivator.getDefault()
+            .getPreferenceStore(), BrowserCommonConstants.PREFERENCE_QUICKFILTER_FONT );
+        RGB qfBgRgb = PreferenceConverter.getDefaultColor( BrowserCommonActivator.getDefault().getPreferenceStore(),
+            BrowserCommonConstants.PREFERENCE_QUICKFILTER_BACKGROUND_COLOR );
+        RGB qfFgRgb = PreferenceConverter.getDefaultColor( BrowserCommonActivator.getDefault().getPreferenceStore(),
+            BrowserCommonConstants.PREFERENCE_QUICKFILTER_FOREGROUND_COLOR );
+        setQuickfilter( qfFontDatas, qfFgRgb, qfBgRgb );
+
+        for ( int i = 0; i < ATTRIBUTE_TYPES.length; i++ )
+        {
+            FontData[] fontDatas = PreferenceConverter.getDefaultFontDataArray( BrowserCommonActivator.getDefault()
+                .getPreferenceStore(), ATTRIBUTE_FONT_CONSTANTS[i] );
+            RGB rgb = PreferenceConverter.getDefaultColor( BrowserCommonActivator.getDefault().getPreferenceStore(),
+                ATTRIBUTE_COLOR_CONSTANTS[i] );
+            setColorsAndFonts( i, fontDatas, rgb );
+        }
+        super.performDefaults();
+    }
+
+}

Propchange: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ColorsAndFontsPreferencePage.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message