directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r609212 [2/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
Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/EntryEditorPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/EntryEditorPreferencePage.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/EntryEditorPreferencePage.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/EntryEditorPreferencePage.java Sat Jan  5 12:42:20 2008
@@ -39,6 +39,12 @@
 import org.eclipse.ui.IWorkbenchPreferencePage;
 
 
+/**
+ * The EntryEditorPreferencePage contains general settings for the entry editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class EntryEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
 {
 
@@ -57,22 +63,30 @@
     private Text foldingThresholdText;
 
 
+    /**
+     * Creates a new instance of EntryEditorPreferencePage.
+     */
     public EntryEditorPreferencePage()
     {
-        super();
+        super( "Entry Editor" );
         super.setPreferenceStore( BrowserCommonActivator.getDefault().getPreferenceStore() );
         super.setDescription( "General settings for the LDAP entry editor:" );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void init( IWorkbench workbench )
     {
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected Control createContents( Composite parent )
     {
-
         Composite composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
 
         BaseWidgetUtils.createSpacer( composite, 1 );
@@ -150,40 +164,44 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean performOk()
     {
-
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OBJECTCLASS_ATTRIBUTES,
-            this.showObjectClassAttributeButton.getSelection() );
+            showObjectClassAttributeButton.getSelection() );
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_MUST_ATTRIBUTES,
-            this.showMustAttributesButton.getSelection() );
+            showMustAttributesButton.getSelection() );
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_MAY_ATTRIBUTES,
-            this.showMayAttributesButton.getSelection() );
+            showMayAttributesButton.getSelection() );
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES,
-            this.showOperationalAttributesButton.getSelection() );
+            showOperationalAttributesButton.getSelection() );
 
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_ENABLE_FOLDING,
-            this.enableFoldingButton.getSelection() );
+            enableFoldingButton.getSelection() );
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_FOLDING_THRESHOLD,
-            this.foldingThresholdText.getText() );
+            foldingThresholdText.getText() );
 
         return true;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected void performDefaults()
     {
-
-        this.showObjectClassAttributeButton.setSelection( getPreferenceStore().getDefaultBoolean(
+        showObjectClassAttributeButton.setSelection( getPreferenceStore().getDefaultBoolean(
             BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OBJECTCLASS_ATTRIBUTES ) );
-        this.showMustAttributesButton.setSelection( getPreferenceStore().getDefaultBoolean(
+        showMustAttributesButton.setSelection( getPreferenceStore().getDefaultBoolean(
             BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_MUST_ATTRIBUTES ) );
-        this.showMayAttributesButton.setSelection( getPreferenceStore().getDefaultBoolean(
+        showMayAttributesButton.setSelection( getPreferenceStore().getDefaultBoolean(
             BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_MAY_ATTRIBUTES ) );
-        this.showOperationalAttributesButton.setSelection( getPreferenceStore().getDefaultBoolean(
+        showOperationalAttributesButton.setSelection( getPreferenceStore().getDefaultBoolean(
             BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES ) );
 
-        this.foldingThresholdText.setText( getPreferenceStore().getDefaultString(
+        foldingThresholdText.setText( getPreferenceStore().getDefaultString(
             BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_FOLDING_THRESHOLD ) );
 
         updateEnabled();

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/MainPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/MainPreferencePage.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/MainPreferencePage.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/MainPreferencePage.java Sat Jan  5 12:42:20 2008
@@ -22,229 +22,64 @@
 
 
 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.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 main preference page contains general settings for the LDAP browser.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class MainPreferencePage 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;
-
-
+    /**
+     * 
+     * Creates a new instance of MainPreferencePage.
+     */
     public MainPreferencePage()
     {
         super( "LDAP" );
         super.setPreferenceStore( BrowserCommonActivator.getDefault().getPreferenceStore() );
-        super.setDescription( "General settings for the LDAP plugin:" );
+        super.setDescription( "General settings for the LDAP browser:" );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
+
     public void init( IWorkbench workbench )
     {
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected Control createContents( Composite parent )
     {
-
         Composite composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
 
-        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++ )
-        {
-            final int index = 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( index, fontDatas, rgb );
-        }
-
-        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 );
-
         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 );
-    }
-
-
     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 );
-
         super.performDefaults();
     }
 
 
     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, this.errorBoldButtons[i], this.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, this.quickfilterBoldButton, this.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 );
-
         return true;
-    }
-
-
-    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;
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxDialog.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/SyntaxDialog.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxDialog.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.BinarySyntax;
-
 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 SyntaxDialog is used to enter/select a syntax OID.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class SyntaxDialog extends Dialog
 {
 
+    /** The initial syntax. */
     private BinarySyntax currentSyntax;
 
+    /** The possible syntax OIDs. */
     private String[] syntaxOids;
 
+    /** The selected syntax. */
     private BinarySyntax returnSyntax;
 
+    /** The combo. */
     private Combo oidCombo;
 
 
+    /**
+     * Creates a new instance of SyntaxDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param currentSyntax the current syntax, null if none
+     * @param syntaxOids the possible syntax OIDs
+     */
     public SyntaxDialog( Shell parentShell, BinarySyntax currentSyntax, String[] syntaxOids )
     {
         super( parentShell );
         this.currentSyntax = currentSyntax;
         this.syntaxOids = syntaxOids;
-
         this.returnSyntax = null;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected void configureShell( Shell newShell )
     {
         super.configureShell( newShell );
@@ -63,26 +81,31 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected void okPressed()
     {
-        this.returnSyntax = new BinarySyntax( oidCombo.getText() );
+        returnSyntax = new BinarySyntax( oidCombo.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.oidCombo = BaseWidgetUtils.createCombo( c, this.syntaxOids, -1, 1 );
-        if ( this.currentSyntax != null )
+        BaseWidgetUtils.createLabel( c, "Syntax OID:", 1 );
+        oidCombo = BaseWidgetUtils.createCombo( c, syntaxOids, -1, 1 );
+        if ( currentSyntax != null )
         {
-            this.oidCombo.setText( currentSyntax.getSyntaxNumericOid() );
+            oidCombo.setText( currentSyntax.getSyntaxNumericOid() );
         }
-        this.oidCombo.addModifyListener( new ModifyListener()
+        oidCombo.addModifyListener( new ModifyListener()
         {
             public void modifyText( ModifyEvent e )
             {
@@ -96,10 +119,15 @@
 
     private void validate()
     {
-        super.getButton( IDialogConstants.OK_ID ).setEnabled( !"".equals( this.oidCombo.getText() ) );
+        getButton( IDialogConstants.OK_ID ).setEnabled( !"".equals( oidCombo.getText() ) );
     }
 
 
+    /**
+     * Gets the entered/selected syntax.
+     * 
+     * @return the syntax
+     */
     public BinarySyntax getSyntax()
     {
         return returnSyntax;

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxValueEditorDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxValueEditorDialog.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/SyntaxValueEditorDialog.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxValueEditorDialog.java Sat Jan  5 12:42:20 2008
@@ -21,14 +21,12 @@
 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.SyntaxValueProviderRelation;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.SyntaxValueEditorRelation;
 import org.apache.directory.studio.valueeditors.ValueEditorManager.ValueEditorExtension;
-
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.swt.events.ModifyEvent;
@@ -39,43 +37,66 @@
 import org.eclipse.swt.widgets.Shell;
 
 
+/**
+ * The SyntaxValueEditorDialog is used to specify
+ * value editors for syntaxes.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class SyntaxValueEditorDialog extends Dialog
 {
 
-    private SyntaxValueProviderRelation relation;
+    /** The initial syntax to value editor relation. */
+    private SyntaxValueEditorRelation relation;
 
-    private SortedMap<String, ValueEditorExtension> class2ValueEditorProxyMap;
+    /** Map with class name => value editor extension. */
+    private SortedMap<String, ValueEditorExtension> class2ValueEditorExtensionMap;
 
+    /** The syntax OIDs. */
     private String[] syntaxOids;
 
-    private SortedMap<String, String> vpName2classMap;
+    /** Map with value editor names => class name. */
+    private SortedMap<String, String> veName2classMap;
 
-    private SyntaxValueProviderRelation returnRelation;
+    /** The selected syntax to value editor relation. */
+    private SyntaxValueEditorRelation returnRelation;
 
+    /** The OID combo. */
     private Combo oidCombo;
 
+    /** The value editor combo. */
     private Combo valueEditorCombo;
 
 
-    public SyntaxValueEditorDialog( Shell parentShell, SyntaxValueProviderRelation relation,
-        SortedMap<String, ValueEditorExtension> class2ValueEditorProxyMap, String[] syntaxOids )
+    /**
+     * Creates a new instance of SyntaxValueEditorDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param relation the initial syntax to value editor relation
+     * @param class2ValueEditorExtensionMap Map with class name => value editor extension
+     * @param syntaxOids the syntax OIDs
+     */
+    public SyntaxValueEditorDialog( Shell parentShell, SyntaxValueEditorRelation relation,
+        SortedMap<String, ValueEditorExtension> class2ValueEditorExtensionMap, String[] syntaxOids )
     {
         super( parentShell );
         this.relation = relation;
-        this.class2ValueEditorProxyMap = class2ValueEditorProxyMap;
+        this.class2ValueEditorExtensionMap = class2ValueEditorExtensionMap;
         this.syntaxOids = syntaxOids;
-
         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 );
@@ -83,27 +104,32 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected void okPressed()
     {
-        this.returnRelation = new SyntaxValueProviderRelation( this.oidCombo.getText(), ( String ) this.vpName2classMap
-            .get( this.valueEditorCombo.getText() ) );
+        returnRelation = new SyntaxValueEditorRelation( oidCombo.getText(), ( String ) 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, "Syntax OID:", 1 );
-        this.oidCombo = BaseWidgetUtils.createCombo( c, this.syntaxOids, -1, 1 );
-        if ( this.relation != null && this.relation.getSyntaxOID() != null )
+        oidCombo = BaseWidgetUtils.createCombo( c, syntaxOids, -1, 1 );
+        if ( relation != null && relation.getSyntaxOID() != null )
         {
-            this.oidCombo.setText( this.relation.getSyntaxOID() );
+            oidCombo.setText( relation.getSyntaxOID() );
         }
-        this.oidCombo.addModifyListener( new ModifyListener()
+        oidCombo.addModifyListener( new ModifyListener()
         {
             public void modifyText( ModifyEvent e )
             {
@@ -112,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 )
             {
@@ -135,11 +160,16 @@
     private void validate()
     {
         super.getButton( IDialogConstants.OK_ID ).setEnabled(
-            !"".equals( this.valueEditorCombo.getText() ) && !"".equals( this.oidCombo.getText() ) );
+            !"".equals( valueEditorCombo.getText() ) && !"".equals( oidCombo.getText() ) );
     }
 
 
-    public SyntaxValueProviderRelation getRelation()
+    /**
+     * Gets the selected syntax to value editor relation.
+     * 
+     * @return the selected syntax to value editor relation
+     */
+    public SyntaxValueEditorRelation getRelation()
     {
         return returnRelation;
     }

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/TextFormatsPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/TextFormatsPreferencePage.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/TextFormatsPreferencePage.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/TextFormatsPreferencePage.java Sat Jan  5 12:42:20 2008
@@ -50,16 +50,27 @@
 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 TextFormatsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage,
     WidgetModifyListener, ModifyListener
 {
 
+    /** The constant used to preselect the 'LDIF' tab */
     public static final String LDIF_TAB = "LDIF";
 
+    /** The constant used to preselect the 'CSV Export' tab */
     public static final String CSV_TAB = "CSV";
 
+    /** The constant used to preselect the 'Excel Export' tab */
     public static final String XLS_TAB = "XLS";
 
+    /** The constant used to preselect the 'CSV Copy' tab */
     public static final String TABLE_TAB = "TABLE";
 
     private Preferences coreStore = BrowserCorePlugin.getDefault().getPluginPreferences();
@@ -80,8 +91,6 @@
 
     private LineSeparatorInput ldifLineSeparator;
 
-    // private Button ldifSpaceBetweenRDNsButton;
-
     private OptionsInput tableAttributeDelimiterWidget;
 
     private OptionsInput tableValueDelimiterWidget;
@@ -109,19 +118,28 @@
     private OptionsInput xlsBinaryEncodingWidget;
 
 
+    /**
+     * Creates a new instance of TextFormatsPreferencePage.
+     */
     public TextFormatsPreferencePage()
     {
-        super();
+        super( "Text Formats" );
         super.setPreferenceStore( BrowserCommonActivator.getDefault().getPreferenceStore() );
         super.setDescription( "Settings for text formats" );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void init( IWorkbench workbench )
     {
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void applyData( Object data )
     {
         if ( data != null && tabFolder != null )
@@ -146,6 +164,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected Control createContents( Composite parent )
     {
         BaseWidgetUtils.createSpacer( parent, 1 );
@@ -156,7 +177,6 @@
         createCsvTab();
         createXlsTab();
 
-        updateEnabled();
         validate();
 
         applyDialogFont( tabFolder );
@@ -167,7 +187,6 @@
 
     private void createTableTab()
     {
-
         tableTab = new TabItem( tabFolder, SWT.NONE );
         tableTab.setText( "CSV Copy" );
 
@@ -181,21 +200,21 @@
         tableAttributeDelimiterWidget = new OptionsInput( "Attribute Delimiter", "Tabulator (\\t)", "\t", new String[]
             { "Tabulator (\\t)", "Comma (,)", "Semikolon (;)" }, new String[]
             { "\t", ",", ";" }, getPreferenceStore().getString(
-                BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_ATTRIBUTEDELIMITER ), false, true );
+            BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_ATTRIBUTEDELIMITER ), false, true );
         tableAttributeDelimiterWidget.createWidget( tableInnerComposite );
         tableAttributeDelimiterWidget.addWidgetModifyListener( this );
 
         tableValueDelimiterWidget = new OptionsInput( "Value Delimiter", "Pipe (|)", "|", new String[]
             { "Pipe (|)", "Comma (,)", "Semikolon (;)", "Newline (\\n)" }, new String[]
             { "|", ",", ";", "\n" }, getPreferenceStore().getString(
-                BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_VALUEDELIMITER ), false, true );
+            BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_VALUEDELIMITER ), false, true );
         tableValueDelimiterWidget.createWidget( tableInnerComposite );
         tableValueDelimiterWidget.addWidgetModifyListener( this );
 
         tableQuoteWidget = new OptionsInput( "Quote Character", "Double Quote (\")", "\"", new String[]
             { "Double Quote (\")", "Single Quote (')" }, new String[]
-            { "\"", "'" }, getPreferenceStore().getString( BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_QUOTECHARACTER ),
-            false, true );
+            { "\"", "'" }, getPreferenceStore().getString(
+            BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_QUOTECHARACTER ), false, true );
         tableQuoteWidget.createWidget( tableInnerComposite );
         tableQuoteWidget.addWidgetModifyListener( this );
 
@@ -219,7 +238,6 @@
 
     private void createCsvTab()
     {
-
         csvTab = new TabItem( tabFolder, SWT.NONE );
         csvTab.setText( "CSV Export" );
 
@@ -272,7 +290,6 @@
 
     private void createXlsTab()
     {
-
         xlsTab = new TabItem( tabFolder, SWT.NONE );
         xlsTab.setText( "Excel Export" );
 
@@ -301,7 +318,6 @@
 
     private void createLdifTab()
     {
-
         ldifTab = new TabItem( tabFolder, SWT.NONE );
         ldifTab.setText( "LDIF" );
 
@@ -344,107 +360,93 @@
         ldifSpaceAfterColonButton.setSelection( coreStore
             .getBoolean( BrowserCoreConstants.PREFERENCE_LDIF_SPACE_AFTER_COLON ) );
 
-        // ldifSpaceBetweenRDNsButton =
-        // BaseWidgetUtils.createCheckbox(ldifComposite, "Space between RDNs",
-        // 1);
-        // ldifSpaceBetweenRDNsButton.setSelection(coreStore.getBoolean(BrowserCoreConstants.PREFERENCE_LDIF_SPACE_BETWEEN_RDNS));
-
         ldifTab.setControl( ldifComposite );
     }
 
 
-    private void updateEnabled()
-    {
-
-    }
-
-
+    /**
+     * {@inheritDoc}
+     */
     public boolean performOk()
     {
-
-        coreStore.setValue( BrowserCoreConstants.PREFERENCE_LDIF_LINE_WIDTH, this.ldifLineLengthText.getText() );
-        coreStore.setValue( BrowserCoreConstants.PREFERENCE_LDIF_LINE_SEPARATOR, this.ldifLineSeparator.getRawValue() );
-        coreStore.setValue( BrowserCoreConstants.PREFERENCE_LDIF_SPACE_AFTER_COLON, this.ldifSpaceAfterColonButton
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_LDIF_LINE_WIDTH, ldifLineLengthText.getText() );
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_LDIF_LINE_SEPARATOR, ldifLineSeparator.getRawValue() );
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_LDIF_SPACE_AFTER_COLON, ldifSpaceAfterColonButton
             .getSelection() );
-        // coreStore.setValue(BrowserCoreConstants.PREFERENCE_LDIF_SPACE_BETWEEN_RDNS,
-        // this.ldifSpaceBetweenRDNsButton.getSelection());
         BrowserCorePlugin.getDefault().savePluginPreferences();
 
-        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_ATTRIBUTEDELIMITER,
-            this.csvAttributeDelimiterWidget.getRawValue() );
-        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_VALUEDELIMITER, this.csvValueDelimiterWidget
-            .getRawValue() );
-        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_QUOTECHARACTER, this.csvQuoteWidget
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_ATTRIBUTEDELIMITER, csvAttributeDelimiterWidget
             .getRawValue() );
-        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_LINESEPARATOR, this.csvLineSeparator
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_VALUEDELIMITER, csvValueDelimiterWidget
             .getRawValue() );
-        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_BINARYENCODING, this.csvBinaryEncodingWidget
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_QUOTECHARACTER, csvQuoteWidget.getRawValue() );
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_LINESEPARATOR, csvLineSeparator.getRawValue() );
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_BINARYENCODING, csvBinaryEncodingWidget
             .getRawValue() );
-        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_ENCODING, this.csvEncodingWidget.getRawValue() );
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_ENCODING, csvEncodingWidget.getRawValue() );
 
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_ATTRIBUTEDELIMITER,
-            this.tableAttributeDelimiterWidget.getRawValue() );
+            tableAttributeDelimiterWidget.getRawValue() );
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_VALUEDELIMITER,
-            this.tableValueDelimiterWidget.getRawValue() );
+            tableValueDelimiterWidget.getRawValue() );
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_QUOTECHARACTER,
-            this.tableQuoteWidget.getRawValue() );
+            tableQuoteWidget.getRawValue() );
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_LINESEPARATOR,
-            this.tableLineSeparator.getRawValue() );
+            tableLineSeparator.getRawValue() );
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_BINARYENCODING,
-            this.tableBinaryEncodingWidget.getRawValue() );
+            tableBinaryEncodingWidget.getRawValue() );
 
-        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_XLS_VALUEDELIMITER, this.xlsValueDelimiterWidget
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_XLS_VALUEDELIMITER, xlsValueDelimiterWidget
             .getRawValue() );
-        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_XLS_BINARYENCODING, this.xlsBinaryEncodingWidget
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_XLS_BINARYENCODING, xlsBinaryEncodingWidget
             .getRawValue() );
 
-        updateEnabled();
         validate();
 
         return true;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected void performDefaults()
     {
-
-        this.ldifLineLengthText.setText( coreStore.getDefaultString( BrowserCoreConstants.PREFERENCE_LDIF_LINE_WIDTH ) );
-        this.ldifLineSeparator.setRawValue( coreStore
-            .getDefaultString( BrowserCoreConstants.PREFERENCE_LDIF_LINE_SEPARATOR ) );
-        this.ldifSpaceAfterColonButton.setSelection( coreStore
+        ldifLineLengthText.setText( coreStore.getDefaultString( BrowserCoreConstants.PREFERENCE_LDIF_LINE_WIDTH ) );
+        ldifLineSeparator
+            .setRawValue( coreStore.getDefaultString( BrowserCoreConstants.PREFERENCE_LDIF_LINE_SEPARATOR ) );
+        ldifSpaceAfterColonButton.setSelection( coreStore
             .getDefaultBoolean( BrowserCoreConstants.PREFERENCE_LDIF_SPACE_AFTER_COLON ) );
-        // this.ldifSpaceBetweenRDNsButton.setSelection(coreStore.getDefaultBoolean(BrowserCoreConstants.PREFERENCE_LDIF_SPACE_BETWEEN_RDNS));
 
-        this.csvAttributeDelimiterWidget.setRawValue( coreStore
+        csvAttributeDelimiterWidget.setRawValue( coreStore
             .getDefaultString( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_ATTRIBUTEDELIMITER ) );
-        this.csvValueDelimiterWidget.setRawValue( coreStore
+        csvValueDelimiterWidget.setRawValue( coreStore
             .getDefaultString( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_VALUEDELIMITER ) );
-        this.csvQuoteWidget.setRawValue( coreStore
+        csvQuoteWidget.setRawValue( coreStore
             .getDefaultString( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_QUOTECHARACTER ) );
-        this.csvLineSeparator.setRawValue( coreStore
+        csvLineSeparator.setRawValue( coreStore
             .getDefaultString( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_LINESEPARATOR ) );
-        this.csvBinaryEncodingWidget.setRawValue( coreStore
+        csvBinaryEncodingWidget.setRawValue( coreStore
             .getDefaultString( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_BINARYENCODING ) );
-        this.csvEncodingWidget.setRawValue( coreStore
-            .getDefaultString( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_ENCODING ) );
+        csvEncodingWidget
+            .setRawValue( coreStore.getDefaultString( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_ENCODING ) );
 
-        this.tableAttributeDelimiterWidget.setRawValue( getPreferenceStore().getDefaultString(
+        tableAttributeDelimiterWidget.setRawValue( getPreferenceStore().getDefaultString(
             BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_ATTRIBUTEDELIMITER ) );
-        this.tableValueDelimiterWidget.setRawValue( getPreferenceStore().getDefaultString(
+        tableValueDelimiterWidget.setRawValue( getPreferenceStore().getDefaultString(
             BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_VALUEDELIMITER ) );
-        this.tableQuoteWidget.setRawValue( getPreferenceStore().getDefaultString(
+        tableQuoteWidget.setRawValue( getPreferenceStore().getDefaultString(
             BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_QUOTECHARACTER ) );
-        this.tableLineSeparator.setRawValue( getPreferenceStore().getDefaultString(
+        tableLineSeparator.setRawValue( getPreferenceStore().getDefaultString(
             BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_LINESEPARATOR ) );
-        this.tableBinaryEncodingWidget.setRawValue( getPreferenceStore().getDefaultString(
+        tableBinaryEncodingWidget.setRawValue( getPreferenceStore().getDefaultString(
             BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_BINARYENCODING ) );
 
-        this.xlsValueDelimiterWidget.setRawValue( coreStore
+        xlsValueDelimiterWidget.setRawValue( coreStore
             .getDefaultString( BrowserCoreConstants.PREFERENCE_FORMAT_XLS_VALUEDELIMITER ) );
-        this.xlsBinaryEncodingWidget.setRawValue( coreStore
+        xlsBinaryEncodingWidget.setRawValue( coreStore
             .getDefaultString( BrowserCoreConstants.PREFERENCE_FORMAT_XLS_BINARYENCODING ) );
 
-        updateEnabled();
         validate();
 
         super.performDefaults();
@@ -453,14 +455,12 @@
 
     public void widgetModified( WidgetModifyEvent event )
     {
-        updateEnabled();
         validate();
     }
 
 
     public void modifyText( ModifyEvent e )
     {
-        updateEnabled();
         validate();
     }
 

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ValueEditorsPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ValueEditorsPreferencePage.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/ValueEditorsPreferencePage.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ValueEditorsPreferencePage.java Sat Jan  5 12:42:20 2008
@@ -30,14 +30,14 @@
 
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
 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.AttributeValueProviderRelation;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeValueEditorRelation;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.LdapSyntaxDescription;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.SyntaxValueProviderRelation;
+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.jface.preference.PreferencePage;
@@ -62,130 +62,152 @@
 import org.eclipse.ui.IWorkbenchPreferencePage;
 
 
+/**
+ * The ValueEditorsPreferencePage is used to specify
+ * value editors for attributes and syntaxes.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class ValueEditorsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
 {
 
-    private SortedMap<String, ValueEditorExtension> class2ValueEditorProxyMap;
+    private SortedMap<String, ValueEditorExtension> class2ValueEditorExtensionMap;
 
-    private SortedMap attributeOid2AtdMap;
+    /** Map with attribute OID => attribute type description */
+    private SortedMap<String, AttributeTypeDescription> attributeOid2AtdMap;
 
-    private SortedMap attributeTypes2AtdMap;
+    /** Map with attribute name => attribute type description */
+    private SortedMap<String, AttributeTypeDescription> attributeNames2AtdMap;
 
+    /** The attribute names and OIDs. */
     private String[] attributeTypesAndOids;
 
-    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 DESCs and OIDs. */
     private String[] syntaxDescsAndOids;
 
-    private List attributeList;
+    /** The attribute list. */
+    private List<AttributeValueEditorRelation> 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<SyntaxValueEditorRelation> 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 ValueEditorsPreferencePage.
+     */
     public ValueEditorsPreferencePage()
     {
-        super();
+        super( "Value Editors" );
         super.setDescription( "Specify value editors:" );
     }
 
 
+    /**
+     * {@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 value providers
-        this.class2ValueEditorProxyMap = new TreeMap<String, ValueEditorExtension>();
+        class2ValueEditorExtensionMap = new TreeMap<String, ValueEditorExtension>();
         Composite dummyComposite = new Composite( composite, SWT.NONE );
         dummyComposite.setLayoutData( new GridData( 1, 1 ) );
-        
-        Collection<ValueEditorExtension> valueEditorProxys = ValueEditorManager.getValueEditorProxys();
-        for ( ValueEditorExtension proxy : valueEditorProxys )
+
+        Collection<ValueEditorExtension> valueEditorExtensions = ValueEditorManager.getValueEditorExtensions();
+        for ( ValueEditorExtension vee : valueEditorExtensions )
         {
-            this.class2ValueEditorProxyMap.put( proxy.className, proxy );
+            class2ValueEditorExtensionMap.put( vee.className, vee );
         }
 
         // init available attribute types
-        this.attributeTypes2AtdMap = 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.attributeTypesAndOids = new String[this.attributeTypes2AtdMap.size() + this.attributeOid2AtdMap.size()];
-        System.arraycopy( this.attributeTypes2AtdMap.keySet().toArray(), 0, this.attributeTypesAndOids, 0,
-            this.attributeTypes2AtdMap.size() );
-        System.arraycopy( this.attributeOid2AtdMap.keySet().toArray(), 0, this.attributeTypesAndOids,
-            this.attributeTypes2AtdMap.size(), this.attributeOid2AtdMap.size() );
+        attributeTypesAndOids = new String[attributeNames2AtdMap.size() + attributeOid2AtdMap.size()];
+        System.arraycopy( attributeNames2AtdMap.keySet().toArray(), 0, attributeTypesAndOids, 0, attributeNames2AtdMap
+            .size() );
+        System.arraycopy( attributeOid2AtdMap.keySet().toArray(), 0, attributeTypesAndOids, 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.syntaxDescsAndOids = new String[this.syntaxOid2LsdMap.size()];
-        System.arraycopy( this.syntaxOid2LsdMap.keySet().toArray(), 0, this.syntaxDescsAndOids, 0,
-            this.syntaxOid2LsdMap.size() );
+        syntaxDescsAndOids = new String[syntaxOid2LsdMap.size()];
+        System.arraycopy( syntaxOid2LsdMap.keySet().toArray(), 0, syntaxDescsAndOids, 0, syntaxOid2LsdMap.size() );
 
         // create attribute contents
         // BaseWidgetUtils.createSpacer(composite, 1);
         BaseWidgetUtils.createSpacer( composite, 1 );
-        this.createAttributeContents( composite );
-        this.attributeList = new ArrayList( Arrays.asList( BrowserCommonActivator.getDefault().getValueEditorsPreferences()
-            .getAttributeValueProviderRelations() ) );
-        attributeViewer.setInput( this.attributeList );
+        createAttributeContents( composite );
+        attributeList = new ArrayList<AttributeValueEditorRelation>( Arrays.asList( BrowserCommonActivator.getDefault()
+            .getValueEditorsPreferences().getAttributeValueEditorRelations() ) );
+        attributeViewer.setInput( attributeList );
         attributeViewer.getTable().getColumn( 0 ).pack();
-        // attributeViewer.getTable().getColumn(1).pack();
         attributeViewer.getTable().getColumn( 2 ).pack();
         attributeViewer.getTable().pack();
 
         // create syntax contents
         BaseWidgetUtils.createSpacer( composite, 1 );
         BaseWidgetUtils.createSpacer( composite, 1 );
-        this.createSyntaxContents( composite );
-        this.syntaxList = new ArrayList( Arrays.asList( BrowserCommonActivator.getDefault().getValueEditorsPreferences()
-            .getSyntaxValueProviderRelations() ) );
-        syntaxViewer.setInput( this.syntaxList );
+        createSyntaxContents( composite );
+        syntaxList = new ArrayList<SyntaxValueEditorRelation>( Arrays.asList( BrowserCommonActivator.getDefault()
+            .getValueEditorsPreferences().getSyntaxValueEditorRelations() ) );
+        syntaxViewer.setInput( syntaxList );
         syntaxViewer.getTable().getColumn( 0 ).pack();
-        // syntaxViewer.getTable().getColumn(1).pack();
         syntaxViewer.getTable().getColumn( 2 ).pack();
         syntaxViewer.getTable().pack();
 
@@ -196,17 +218,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 )
             {
-                attributeTypes2AtdMap.put( names[j], atds[i] );
+                attributeNames2AtdMap.put( name, atd );
             }
-
         }
     }
 
@@ -214,23 +234,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, "Value Editors by Attribute Types", 1 );
 
         Composite composite = BaseWidgetUtils.createColumnContainer( parent, 2, 1 );
@@ -296,16 +313,11 @@
                 removeAttribute();
             }
         } );
-
-        // c1.pack();
-        // c2.pack();
-        // table.pack();
     }
 
 
     private void createSyntaxContents( Composite parent )
     {
-
         BaseWidgetUtils.createLabel( parent, "Value Editors by Syntax", 1 );
 
         Composite composite = BaseWidgetUtils.createColumnContainer( parent, 2, 1 );
@@ -371,114 +383,116 @@
                 removeSyntax();
             }
         } );
-
-        // c1.pack();
-        // c2.pack();
-        // table.pack();
     }
 
 
-    protected void addAttribute()
+    private void addAttribute()
     {
         AttributeValueEditorDialog dialog = new AttributeValueEditorDialog( getShell(), null,
-            this.class2ValueEditorProxyMap, this.attributeTypesAndOids );
+            class2ValueEditorExtensionMap, attributeTypesAndOids );
         if ( dialog.open() == AttributeValueEditorDialog.OK )
         {
-            this.attributeList.add( dialog.getRelation() );
-            this.attributeViewer.refresh();
+            attributeList.add( dialog.getRelation() );
+            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() )
         {
-            AttributeValueProviderRelation relation = ( AttributeValueProviderRelation ) sel.getFirstElement();
+            AttributeValueEditorRelation relation = ( AttributeValueEditorRelation ) sel.getFirstElement();
             AttributeValueEditorDialog dialog = new AttributeValueEditorDialog( getShell(), relation,
-                this.class2ValueEditorProxyMap, this.attributeTypesAndOids );
+                class2ValueEditorExtensionMap, attributeTypesAndOids );
             if ( dialog.open() == AttributeValueEditorDialog.OK )
             {
-                int index = this.attributeList.indexOf( relation );
-                this.attributeList.set( index, dialog.getRelation() );
-                this.attributeViewer.refresh();
+                int index = attributeList.indexOf( relation );
+                attributeList.set( index, dialog.getRelation() );
+                attributeViewer.refresh();
             }
         }
     }
 
 
-    protected void addSyntax()
+    private void addSyntax()
     {
-        SyntaxValueEditorDialog dialog = new SyntaxValueEditorDialog( getShell(), null,
-            this.class2ValueEditorProxyMap, this.syntaxDescsAndOids );
+        SyntaxValueEditorDialog dialog = new SyntaxValueEditorDialog( getShell(), null, class2ValueEditorExtensionMap,
+            syntaxDescsAndOids );
         if ( dialog.open() == SyntaxValueEditorDialog.OK )
         {
-            this.syntaxList.add( dialog.getRelation() );
-            this.syntaxViewer.refresh();
+            syntaxList.add( dialog.getRelation() );
+            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() )
         {
-            SyntaxValueProviderRelation relation = ( SyntaxValueProviderRelation ) sel.getFirstElement();
+            SyntaxValueEditorRelation relation = ( SyntaxValueEditorRelation ) sel.getFirstElement();
             SyntaxValueEditorDialog dialog = new SyntaxValueEditorDialog( getShell(), relation,
-                this.class2ValueEditorProxyMap, this.syntaxDescsAndOids );
+                class2ValueEditorExtensionMap, syntaxDescsAndOids );
             if ( dialog.open() == SyntaxValueEditorDialog.OK )
             {
-                int index = this.syntaxList.indexOf( relation );
-                this.syntaxList.set( index, dialog.getRelation() );
-                this.syntaxViewer.refresh();
+                int index = syntaxList.indexOf( relation );
+                syntaxList.set( index, dialog.getRelation() );
+                syntaxViewer.refresh();
             }
         }
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean performOk()
     {
-        AttributeValueProviderRelation[] aRelations = ( AttributeValueProviderRelation[] ) this.attributeList
-            .toArray( new AttributeValueProviderRelation[this.attributeList.size()] );
-        BrowserCommonActivator.getDefault().getValueEditorsPreferences().setAttributeValueProviderRelations( aRelations );
-
-        SyntaxValueProviderRelation[] sRelations = ( SyntaxValueProviderRelation[] ) this.syntaxList
-            .toArray( new SyntaxValueProviderRelation[this.syntaxList.size()] );
-        BrowserCommonActivator.getDefault().getValueEditorsPreferences().setSyntaxValueProviderRelations( sRelations );
+        AttributeValueEditorRelation[] aRelations = attributeList
+            .toArray( new AttributeValueEditorRelation[attributeList.size()] );
+        BrowserCommonActivator.getDefault().getValueEditorsPreferences()
+            .setAttributeValueEditorRelations( aRelations );
+
+        SyntaxValueEditorRelation[] sRelations = syntaxList.toArray( new SyntaxValueEditorRelation[syntaxList.size()] );
+        BrowserCommonActivator.getDefault().getValueEditorsPreferences().setSyntaxValueEditorRelations( sRelations );
 
         return true;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected void performDefaults()
     {
-        this.attributeList.clear();
-        this.attributeList.addAll( Arrays.asList( BrowserCommonActivator.getDefault().getValueEditorsPreferences()
-            .getDefaultAttributeValueProviderRelations() ) );
-        this.attributeViewer.refresh();
-
-        this.syntaxList.clear();
-        this.syntaxList.addAll( Arrays.asList( BrowserCommonActivator.getDefault().getValueEditorsPreferences()
-            .getDefaultSyntaxValueProviderRelations() ) );
-        this.syntaxViewer.refresh();
+        attributeList.clear();
+        attributeList.addAll( Arrays.asList( BrowserCommonActivator.getDefault().getValueEditorsPreferences()
+            .getDefaultAttributeValueEditorRelations() ) );
+        attributeViewer.refresh();
+
+        syntaxList.clear();
+        syntaxList.addAll( Arrays.asList( BrowserCommonActivator.getDefault().getValueEditorsPreferences()
+            .getDefaultSyntaxValueEditorRelations() ) );
+        syntaxViewer.refresh();
 
         super.performDefaults();
     }
@@ -487,9 +501,9 @@
     {
         public String getColumnText( Object obj, int index )
         {
-            if ( obj instanceof AttributeValueProviderRelation )
+            if ( obj instanceof AttributeValueEditorRelation )
             {
-                AttributeValueProviderRelation relation = ( AttributeValueProviderRelation ) obj;
+                AttributeValueEditorRelation relation = ( AttributeValueEditorRelation ) obj;
                 if ( index == 0 )
                 {
                     return relation.getAttributeNumericOidOrType();
@@ -498,16 +512,16 @@
                 {
                     if ( relation.getAttributeNumericOidOrType() != null )
                     {
-                        if ( attributeTypes2AtdMap.containsKey( relation.getAttributeNumericOidOrType() ) )
+                        if ( attributeNames2AtdMap.containsKey( relation.getAttributeNumericOidOrType() ) )
                         {
-                            AttributeTypeDescription atd = ( AttributeTypeDescription ) attributeTypes2AtdMap
+                            AttributeTypeDescription atd = ( AttributeTypeDescription ) attributeNames2AtdMap
                                 .get( relation.getAttributeNumericOidOrType() );
                             String s = atd.getNumericOID();
-                            for ( int i = 0; i < atd.getNames().length; i++ )
+                            for ( String name : atd.getNames() )
                             {
-                                if ( !relation.getAttributeNumericOidOrType().equals( atd.getNames()[i] ) )
+                                if ( !relation.getAttributeNumericOidOrType().equals( name ) )
                                 {
-                                    s += ", " + atd.getNames()[i];
+                                    s += ", " + name;
                                 }
                             }
                             return s;
@@ -522,8 +536,8 @@
                 }
                 else if ( index == 2 )
                 {
-                    ValueEditorExtension vp = class2ValueEditorProxyMap.get( relation.getValueProviderClassname() );
-                    return vp != null ? vp.name : null;
+                    ValueEditorExtension vee = class2ValueEditorExtensionMap.get( relation.getValueEditorClassName() );
+                    return vee != null ? vee.name : null;
                 }
             }
             return null;
@@ -532,13 +546,13 @@
 
         public Image getColumnImage( Object obj, int index )
         {
-            if ( obj instanceof AttributeValueProviderRelation )
+            if ( obj instanceof AttributeValueEditorRelation )
             {
-                AttributeValueProviderRelation relation = ( AttributeValueProviderRelation ) obj;
+                AttributeValueEditorRelation relation = ( AttributeValueEditorRelation ) obj;
                 if ( index == 2 )
                 {
-                    ValueEditorExtension vp = class2ValueEditorProxyMap.get( relation.getValueProviderClassname() );
-                    return vp != null ? vp.icon.createImage() : null;
+                    ValueEditorExtension vee = class2ValueEditorExtensionMap.get( relation.getValueEditorClassName() );
+                    return vee != null ? vee.icon.createImage() : null;
                 }
             }
 
@@ -550,9 +564,9 @@
     {
         public String getColumnText( Object obj, int index )
         {
-            if ( obj instanceof SyntaxValueProviderRelation )
+            if ( obj instanceof SyntaxValueEditorRelation )
             {
-                SyntaxValueProviderRelation relation = ( SyntaxValueProviderRelation ) obj;
+                SyntaxValueEditorRelation relation = ( SyntaxValueEditorRelation ) obj;
                 if ( index == 0 )
                 {
                     return relation.getSyntaxOID();
@@ -571,8 +585,8 @@
                 }
                 else if ( index == 2 )
                 {
-                    ValueEditorExtension vp = class2ValueEditorProxyMap.get( relation.getValueProviderClassname() );
-                    return vp != null ? vp.name : null;
+                    ValueEditorExtension vee = class2ValueEditorExtensionMap.get( relation.getValueEditorClassName() );
+                    return vee != null ? vee.name : null;
                 }
             }
             return null;
@@ -581,13 +595,13 @@
 
         public Image getColumnImage( Object obj, int index )
         {
-            if ( obj instanceof SyntaxValueProviderRelation )
+            if ( obj instanceof SyntaxValueEditorRelation )
             {
-                SyntaxValueProviderRelation relation = ( SyntaxValueProviderRelation ) obj;
+                SyntaxValueEditorRelation relation = ( SyntaxValueEditorRelation ) obj;
                 if ( index == 2 )
                 {
-                    ValueEditorExtension vp = class2ValueEditorProxyMap.get( relation.getValueProviderClassname() );
-                    return vp != null ? vp.icon.createImage() : null;
+                    ValueEditorExtension vee = class2ValueEditorExtensionMap.get( relation.getValueEditorClassName() );
+                    return vee != null ? vee.icon.createImage() : null;
                 }
             }
 

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java?rev=609212&r1=609211&r2=609212&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java Sat Jan  5 12:42:20 2008
@@ -194,7 +194,7 @@
 
         // check attribute preferences
         AttributeTypeDescription atd = schema.getAttributeTypeDescription( attributeType );
-        Map attributeValueEditorMap = BrowserCommonActivator.getDefault().getValueEditorsPreferences()
+        Map<String, String> attributeValueEditorMap = BrowserCommonActivator.getDefault().getValueEditorsPreferences()
             .getAttributeValueEditorMap();
         if ( atd.getNumericOID() != null && attributeValueEditorMap.containsKey( atd.getNumericOID().toLowerCase() ) )
         {
@@ -202,18 +202,17 @@
                 .toLowerCase() ) );
         }
         String[] names = atd.getNames();
-        for ( int i = 0; i < names.length; i++ )
+        for ( String name : names )
         {
-            if ( attributeValueEditorMap.containsKey( names[i].toLowerCase() ) )
+            if ( attributeValueEditorMap.containsKey( name.toLowerCase() ) )
             {
-                return ( IValueEditor ) this.class2ValueEditors.get( attributeValueEditorMap.get( names[i]
-                    .toLowerCase() ) );
+                return ( IValueEditor ) this.class2ValueEditors.get( attributeValueEditorMap.get( name.toLowerCase() ) );
             }
         }
 
         // check syntax preferences
         LdapSyntaxDescription lsd = atd.getSyntaxDescription();
-        Map syntaxValueEditorMap = BrowserCommonActivator.getDefault().getValueEditorsPreferences()
+        Map<String, String> syntaxValueEditorMap = BrowserCommonActivator.getDefault().getValueEditorsPreferences()
             .getSyntaxValueEditorMap();
         if ( lsd.getNumericOID() != null && syntaxValueEditorMap.containsKey( lsd.getNumericOID().toLowerCase() ) )
         {
@@ -646,22 +645,22 @@
     {
         Collection<IValueEditor> valueEditors = new ArrayList<IValueEditor>();
 
-        Collection<ValueEditorExtension> valueEditorProxys = getValueEditorProxys();
-        for ( ValueEditorExtension proxy : valueEditorProxys )
+        Collection<ValueEditorExtension> valueEditorExtensions = getValueEditorExtensions();
+        for ( ValueEditorExtension vee : valueEditorExtensions )
         {
             try
             {
-                IValueEditor valueEditor = ( IValueEditor ) proxy.member.createExecutableExtension( "class" );
+                IValueEditor valueEditor = ( IValueEditor ) vee.member.createExecutableExtension( "class" );
                 valueEditor.create( parent );
-                valueEditor.setValueEditorName( proxy.name );
-                valueEditor.setValueEditorImageDescriptor( proxy.icon );
+                valueEditor.setValueEditorName( vee.name );
+                valueEditor.setValueEditorImageDescriptor( vee.icon );
                 valueEditors.add( valueEditor );
             }
             catch ( Exception e )
             {
                 BrowserCommonActivator.getDefault().getLog().log(
                     new Status( IStatus.ERROR, BrowserCommonActivator.PLUGIN_ID, 1, "Unable to create ValueEditor "
-                        + proxy.className, e ) );
+                        + vee.className, e ) );
             }
         }
 
@@ -670,13 +669,13 @@
 
 
     /**
-     * Returns all value editor proxies specified by value editor extensions.
+     * Returns all value editor extensions specified by value editor extensions.
      *
-     * @return the value editor proxies
+     * @return the value editor extensions
      */
-    public static Collection<ValueEditorExtension> getValueEditorProxys()
+    public static Collection<ValueEditorExtension> getValueEditorExtensions()
     {
-        Collection<ValueEditorExtension> valueEditorProxies = new ArrayList<ValueEditorExtension>();
+        Collection<ValueEditorExtension> valueEditorExtensions = new ArrayList<ValueEditorExtension>();
 
         IExtensionRegistry registry = Platform.getExtensionRegistry();
         IExtensionPoint extensionPoint = registry.getExtensionPoint( EXTENSION_POINT );
@@ -686,7 +685,7 @@
         for ( int m = 0; m < members.length; m++ )
         {
             ValueEditorExtension proxy = new ValueEditorExtension();
-            valueEditorProxies.add( proxy );
+            valueEditorExtensions.add( proxy );
 
             IConfigurationElement member = members[m];
             IExtension extension = member.getDeclaringExtension();
@@ -720,7 +719,7 @@
             }
         }
 
-        return valueEditorProxies;
+        return valueEditorExtensions;
     }
 
     /**

Copied: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/AttributeValueEditorRelation.java (from r609021, directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/AttributeValueProviderRelation.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/AttributeValueEditorRelation.java?p2=directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/AttributeValueEditorRelation.java&p1=directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/AttributeValueProviderRelation.java&r1=609021&r2=609212&rev=609212&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/AttributeValueProviderRelation.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/AttributeValueEditorRelation.java Sat Jan  5 12:42:20 2008
@@ -21,47 +21,85 @@
 package org.apache.directory.studio.ldapbrowser.core.model.schema;
 
 
-public class AttributeValueProviderRelation
+/**
+ * An AttributeValueEditorRelation is used to set the relation 
+ * from an attribute type to its value editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AttributeValueEditorRelation
 {
 
+    /** The attribute, either the numeric OID or type. */
     private String attributeNumericOidOrType;
 
-    private String valueProviderClassname;
+    /** The value editor class name. */
+    private String valueEditorClassName;
 
 
-    public AttributeValueProviderRelation()
+    /**
+     * Creates a new instance of AttributeValueEditorRelation.
+     */
+    public AttributeValueEditorRelation()
     {
     }
 
 
-    public AttributeValueProviderRelation( String attributeNumericOidOrName, String valueProviderClassname )
+    /**
+     * Creates a new instance of AttributeValueEditorRelation.
+     * 
+     * @param attributeNumericOidOrName the attribute numeric OID or name
+     * @param valueEditorClassName the value editor class name
+     */
+    public AttributeValueEditorRelation( String attributeNumericOidOrName, String valueEditorClassName )
     {
         this.attributeNumericOidOrType = attributeNumericOidOrName;
-        this.valueProviderClassname = valueProviderClassname;
+        this.valueEditorClassName = valueEditorClassName;
     }
 
 
+    /**
+     * Gets the attribute numeric OID or type.
+     * 
+     * @return the attribute numeric OID or type
+     */
     public String getAttributeNumericOidOrType()
     {
         return attributeNumericOidOrType;
     }
 
 
+    /**
+     * Sets the attribute numeric OID or type.
+     * 
+     * @param attributeNumericOidOrType the new attribute numeric OID or type
+     */
     public void setAttributeNumericOidOrType( String attributeNumericOidOrType )
     {
         this.attributeNumericOidOrType = attributeNumericOidOrType;
     }
 
 
-    public String getValueProviderClassname()
+    /**
+     * Gets the value editor class name.
+     * 
+     * @return the value editor class name
+     */
+    public String getValueEditorClassName()
     {
-        return valueProviderClassname;
+        return valueEditorClassName;
     }
 
 
-    public void setValueProviderClassname( String valueProviderClassname )
+    /**
+     * Sets the value editor class name.
+     * 
+     * @param valueEditorClassName the new value editor class name
+     */
+    public void setValueEditorClassName( String valueEditorClassName )
     {
-        this.valueProviderClassname = valueProviderClassname;
+        this.valueEditorClassName = valueEditorClassName;
     }
 
 }

Copied: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SyntaxValueEditorRelation.java (from r609021, directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SyntaxValueProviderRelation.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SyntaxValueEditorRelation.java?p2=directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SyntaxValueEditorRelation.java&p1=directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SyntaxValueProviderRelation.java&r1=609021&r2=609212&rev=609212&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SyntaxValueProviderRelation.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SyntaxValueEditorRelation.java Sat Jan  5 12:42:20 2008
@@ -21,47 +21,84 @@
 package org.apache.directory.studio.ldapbrowser.core.model.schema;
 
 
-public class SyntaxValueProviderRelation
+/**
+ * A SyntaxValueProviderRelation 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>
+ * @version $Rev$, $Date$
+ */
+public class SyntaxValueEditorRelation
 {
 
+    /** The syntax OID. */
     private String syntaxOID;
 
-    private String valueProviderClassname;
+    private String valueEditorClassName;
 
 
-    public SyntaxValueProviderRelation()
+    /**
+     * Creates a new instance of SyntaxValueEditorRelation.
+     */
+    public SyntaxValueEditorRelation()
     {
     }
 
 
-    public SyntaxValueProviderRelation( String syntaxOID, String valueProviderClassname )
+    /**
+     * Creates a new instance of SyntaxValueEditorRelation.
+     * 
+     * @param syntaxOID the syntax OID
+     * @param valueEditorClassName the value editor class name
+     */
+    public SyntaxValueEditorRelation( String syntaxOID, String valueEditorClassName )
     {
         this.syntaxOID = syntaxOID;
-        this.valueProviderClassname = valueProviderClassname;
+        this.valueEditorClassName = valueEditorClassName;
     }
 
 
+    /**
+     * Gets the syntax OID.
+     * 
+     * @return the syntax OID
+     */
     public String getSyntaxOID()
     {
         return syntaxOID;
     }
 
 
+    /**
+     * Sets the syntax OID.
+     * 
+     * @param syntaxOID the new syntax OID
+     */
     public void setSyntaxOID( String syntaxOID )
     {
         this.syntaxOID = syntaxOID;
     }
 
 
-    public String getValueProviderClassname()
+    /**
+     * Gets the value editor class name.
+     * 
+     * @return the value editor class name
+     */
+    public String getValueEditorClassName()
     {
-        return valueProviderClassname;
+        return valueEditorClassName;
     }
 
 
-    public void setValueProviderClassname( String valueProviderClassname )
+    /**
+     * Sets the value editor class name.
+     * 
+     * @param valueEditorClassName the new value editor class name
+     */
+    public void setValueEditorClassName( String valueEditorClassName )
     {
-        this.valueProviderClassname = valueProviderClassname;
+        this.valueEditorClassName = valueEditorClassName;
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/preferences/SearchResultEditorPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/preferences/SearchResultEditorPreferencePage.java?rev=609212&r1=609211&r2=609212&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/preferences/SearchResultEditorPreferencePage.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/preferences/SearchResultEditorPreferencePage.java Sat Jan  5 12:42:20 2008
@@ -22,8 +22,6 @@
 
 
 import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
-import org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyEvent;
-import org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyListener;
 import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
 import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
 import org.eclipse.jface.preference.PreferencePage;
@@ -34,31 +32,47 @@
 import org.eclipse.ui.IWorkbenchPreferencePage;
 
 
-public class SearchResultEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage,
-    WidgetModifyListener
+/**
+ * The search result editor preference page contains settings for the 
+ * search result editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SearchResultEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
 {
 
+    /** The show DN button. */
     private Button showDnButton;
 
+    /** The show links button. */
     private Button showLinksButton;
 
 
+    /**
+     * Creates a new instance of SearchResultEditorPreferencePage.
+     */
     public SearchResultEditorPreferencePage()
     {
-        super();
+        super( "Search Result Editor" );
         super.setPreferenceStore( BrowserUIPlugin.getDefault().getPreferenceStore() );
         super.setDescription( "General settings for the LDAP search result editor:" );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void init( IWorkbench workbench )
     {
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected Control createContents( Composite parent )
     {
-
         Composite composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
 
         BaseWidgetUtils.createSpacer( composite, 1 );
@@ -70,60 +84,34 @@
         showLinksButton.setSelection( getPreferenceStore().getBoolean(
             BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_LINKS ) );
 
-        updateEnabled();
-        validate();
-
         applyDialogFont( composite );
         return composite;
     }
 
 
-    private void updateEnabled()
-    {
-
-    }
-
-
+    /**
+     * {@inheritDoc}
+     */
     public boolean performOk()
     {
-
         getPreferenceStore().setValue( BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_DN,
-            this.showDnButton.getSelection() );
+            showDnButton.getSelection() );
         getPreferenceStore().setValue( BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_LINKS,
-            this.showLinksButton.getSelection() );
-
-        updateEnabled();
-        validate();
-
+            showLinksButton.getSelection() );
         return true;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected void performDefaults()
     {
-
-        this.showDnButton.setSelection( getPreferenceStore().getDefaultBoolean(
+        showDnButton.setSelection( getPreferenceStore().getDefaultBoolean(
             BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_DN ) );
-        this.showLinksButton.setSelection( getPreferenceStore().getDefaultBoolean(
+        showLinksButton.setSelection( getPreferenceStore().getDefaultBoolean(
             BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_LINKS ) );
-
-        updateEnabled();
-        validate();
-
         super.performDefaults();
-    }
-
-
-    public void widgetModified( WidgetModifyEvent event )
-    {
-        updateEnabled();
-        validate();
-    }
-
-
-    protected void validate()
-    {
-
     }
 
 }



Mime
View raw message