directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r592079 [6/17] - in /directory/sandbox/felixk/studio-ldapbrowser-common: ./ META-INF/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/studio/ ...
Date Mon, 05 Nov 2007 16:48:54 GMT
Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BrowserPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BrowserPreferencePage.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BrowserPreferencePage.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BrowserPreferencePage.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,350 @@
+/*
+ *  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.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+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.swt.widgets.Text;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+
+public class BrowserPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
+{
+
+    private static final String DN = "DN";
+
+    private static final String RDN = "RDN";
+
+    private static final String RDN_VALUE = "RDN value";
+
+    private Combo entryLabelCombo;
+
+    private Button entryAbbreviateButton;
+
+    private Text entryAbbreviateMaxLengthText;
+
+    private Combo searchResultLabelCombo;
+
+    private Button searchResultAbbreviateButton;
+
+    private Text searchResultAbbreviateMaxLengthText;
+
+    private Button enableFoldingButton;
+
+    private Label foldingSizeLabel;
+
+    private Text foldingSizeText;
+
+    private Button expandBaseEntriesButton;;
+
+    private Button checkForChildrenButton;
+
+    private Button showAliasAndReferralObjectsButton;
+
+    private Button fetchSubentriesButton;
+
+
+    public BrowserPreferencePage()
+    {
+        super();
+        super.setPreferenceStore( BrowserCommonActivator.getDefault().getPreferenceStore() );
+        super.setDescription( "General settings for the LDAP browser view:" );
+    }
+
+
+    public void init( IWorkbench workbench )
+    {
+    }
+
+
+    protected Control createContents( Composite parent )
+    {
+
+        Composite composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
+
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        Group entryLabelGroup = BaseWidgetUtils.createGroup( BaseWidgetUtils.createColumnContainer( composite, 1, 1 ),
+            "Entry label", 1 );
+
+        Composite entryLabelComposite = BaseWidgetUtils.createColumnContainer( entryLabelGroup, 3, 1 );
+        BaseWidgetUtils.createLabel( entryLabelComposite, "Use ", 1 );
+        entryLabelCombo = BaseWidgetUtils.createCombo( entryLabelComposite, new String[]
+            { DN, RDN, RDN_VALUE }, 0, 1 );
+        entryLabelCombo.setLayoutData( new GridData() );
+        entryLabelCombo
+            .select( getPreferenceStore().getInt( BrowserCommonConstants.PREFERENCE_BROWSER_ENTRY_LABEL ) == BrowserCommonConstants.SHOW_RDN_VALUE ? 2
+                : getPreferenceStore().getInt( BrowserCommonConstants.PREFERENCE_BROWSER_ENTRY_LABEL ) == BrowserCommonConstants.SHOW_RDN ? 1
+                    : 0 );
+        BaseWidgetUtils.createLabel( entryLabelComposite, " as entry label", 1 );
+
+        Composite entryAbbreviateComposite = BaseWidgetUtils.createColumnContainer( entryLabelGroup, 3, 1 );
+        entryAbbreviateButton = BaseWidgetUtils.createCheckbox( entryAbbreviateComposite, "Limit label length to ", 1 );
+        entryAbbreviateButton.setSelection( getPreferenceStore().getBoolean(
+            BrowserCommonConstants.PREFERENCE_BROWSER_ENTRY_ABBREVIATE ) );
+        entryAbbreviateButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                updateEnabled();
+            }
+        } );
+        entryAbbreviateMaxLengthText = BaseWidgetUtils.createText( entryAbbreviateComposite, getPreferenceStore()
+            .getString( BrowserCommonConstants.PREFERENCE_BROWSER_ENTRY_ABBREVIATE_MAX_LENGTH ), 3, 1 );
+        entryAbbreviateMaxLengthText.setEnabled( entryAbbreviateButton.getSelection() );
+        entryAbbreviateMaxLengthText.addVerifyListener( new VerifyListener()
+        {
+            public void verifyText( VerifyEvent e )
+            {
+                if ( !e.text.matches( "[0-9]*" ) )
+                {
+                    e.doit = false;
+                }
+                if ( "".equals( entryAbbreviateMaxLengthText.getText() ) && e.text.matches( "[0]" ) )
+                {
+                    e.doit = false;
+                }
+            }
+        } );
+        BaseWidgetUtils.createLabel( entryAbbreviateComposite, " characters", 1 );
+
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        Group searchResultLabelGroup = BaseWidgetUtils.createGroup( BaseWidgetUtils.createColumnContainer( composite,
+            1, 1 ), "Search result label", 1 );
+
+        Composite searchResultLabelComposite = BaseWidgetUtils.createColumnContainer( searchResultLabelGroup, 3, 1 );
+        BaseWidgetUtils.createLabel( searchResultLabelComposite, "Use ", 1 );
+        searchResultLabelCombo = BaseWidgetUtils.createCombo( searchResultLabelComposite, new String[]
+            { DN, RDN, RDN_VALUE }, 0, 1 );
+        searchResultLabelCombo.setLayoutData( new GridData() );
+        searchResultLabelCombo
+            .select( getPreferenceStore().getInt( BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_LABEL ) == BrowserCommonConstants.SHOW_RDN_VALUE ? 2
+                : getPreferenceStore().getInt( BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_LABEL ) == BrowserCommonConstants.SHOW_RDN ? 1
+                    : 0 );
+        BaseWidgetUtils.createLabel( searchResultLabelComposite, " as search result label", 1 );
+
+        Composite searchResultAbbreviateComposite = BaseWidgetUtils
+            .createColumnContainer( searchResultLabelGroup, 3, 1 );
+        searchResultAbbreviateButton = BaseWidgetUtils.createCheckbox( searchResultAbbreviateComposite,
+            "Limit label length to ", 1 );
+        searchResultAbbreviateButton.setSelection( getPreferenceStore().getBoolean(
+            BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_ABBREVIATE ) );
+        searchResultAbbreviateButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                updateEnabled();
+            }
+        } );
+        searchResultAbbreviateMaxLengthText = BaseWidgetUtils
+            .createText( searchResultAbbreviateComposite, getPreferenceStore().getString(
+                BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_ABBREVIATE_MAX_LENGTH ), 3, 1 );
+        searchResultAbbreviateMaxLengthText.setEnabled( searchResultAbbreviateButton.getSelection() );
+        searchResultAbbreviateMaxLengthText.addVerifyListener( new VerifyListener()
+        {
+            public void verifyText( VerifyEvent e )
+            {
+                if ( !e.text.matches( "[0-9]*" ) )
+                {
+                    e.doit = false;
+                }
+                if ( "".equals( searchResultAbbreviateMaxLengthText.getText() ) && e.text.matches( "[0]" ) )
+                {
+                    e.doit = false;
+                }
+            }
+        } );
+        BaseWidgetUtils.createLabel( searchResultAbbreviateComposite, " characters", 1 );
+
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        Group foldingGroup = BaseWidgetUtils.createGroup( BaseWidgetUtils.createColumnContainer( composite, 1, 1 ),
+            "Folding", 1 );
+        Composite pagingGroupComposite = BaseWidgetUtils.createColumnContainer( foldingGroup, 2, 1 );
+        enableFoldingButton = BaseWidgetUtils.createCheckbox( pagingGroupComposite, "Enable folding", 2 );
+        enableFoldingButton.setSelection( getPreferenceStore().getBoolean(
+            BrowserCommonConstants.PREFERENCE_BROWSER_ENABLE_FOLDING ) );
+        enableFoldingButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                updateEnabled();
+            }
+        } );
+        foldingSizeLabel = BaseWidgetUtils.createLabel( pagingGroupComposite, "Folding size: ", 1 );
+        foldingSizeLabel.setEnabled( enableFoldingButton.getSelection() );
+        foldingSizeText = BaseWidgetUtils.createText( pagingGroupComposite, getPreferenceStore().getString(
+            BrowserCommonConstants.PREFERENCE_BROWSER_FOLDING_SIZE ), 4, 1 );
+        foldingSizeText.setEnabled( enableFoldingButton.getSelection() );
+        foldingSizeText.addVerifyListener( new VerifyListener()
+        {
+            public void verifyText( VerifyEvent e )
+            {
+                if ( !e.text.matches( "[0-9]*" ) )
+                {
+                    e.doit = false;
+                }
+                if ( "".equals( foldingSizeText.getText() ) && e.text.matches( "[0]" ) )
+                {
+                    e.doit = false;
+                }
+            }
+        } );
+
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        expandBaseEntriesButton = BaseWidgetUtils.createCheckbox( composite,
+            "Expand base entries when opening connection", 1 );
+        expandBaseEntriesButton.setSelection( getPreferenceStore().getBoolean(
+            BrowserCommonConstants.PREFERENCE_BROWSER_EXPAND_BASE_ENTRIES ) );
+        Preferences coreStore = BrowserCorePlugin.getDefault().getPluginPreferences();
+        checkForChildrenButton = BaseWidgetUtils.createCheckbox( composite, "Check for children", 1 );
+        checkForChildrenButton
+            .setSelection( coreStore.getBoolean( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN ) );
+        showAliasAndReferralObjectsButton = BaseWidgetUtils.createCheckbox( composite,
+            "Show alias and referral objects", 1 );
+        showAliasAndReferralObjectsButton.setSelection( coreStore
+            .getBoolean( BrowserCoreConstants.PREFERENCE_SHOW_ALIAS_AND_REFERRAL_OBJECTS ) );
+        fetchSubentriesButton = BaseWidgetUtils.createCheckbox( composite,
+            "Fetch subentries (requires additional search request)", 1 );
+        fetchSubentriesButton.setSelection( coreStore.getBoolean( BrowserCoreConstants.PREFERENCE_FETCH_SUBENTRIES ) );
+
+        updateEnabled();
+
+        applyDialogFont( composite );
+
+        return composite;
+    }
+
+
+    private void updateEnabled()
+    {
+        entryAbbreviateMaxLengthText.setEnabled( entryAbbreviateButton.getSelection() );
+        searchResultAbbreviateMaxLengthText.setEnabled( searchResultAbbreviateButton.getSelection() );
+        foldingSizeText.setEnabled( enableFoldingButton.getSelection() );
+        foldingSizeLabel.setEnabled( enableFoldingButton.getSelection() );
+    }
+
+
+    public boolean performOk()
+    {
+
+        Preferences coreStore = BrowserCorePlugin.getDefault().getPluginPreferences();
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN, this.checkForChildrenButton
+            .getSelection() );
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_SHOW_ALIAS_AND_REFERRAL_OBJECTS,
+            this.showAliasAndReferralObjectsButton.getSelection() );
+        coreStore
+            .setValue( BrowserCoreConstants.PREFERENCE_FETCH_SUBENTRIES, this.fetchSubentriesButton.getSelection() );
+        BrowserCorePlugin.getDefault().savePluginPreferences();
+
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_BROWSER_EXPAND_BASE_ENTRIES,
+            this.expandBaseEntriesButton.getSelection() );
+
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_BROWSER_ENABLE_FOLDING,
+            this.enableFoldingButton.getSelection() );
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_BROWSER_FOLDING_SIZE,
+            this.foldingSizeText.getText().trim() );
+
+        getPreferenceStore().setValue(
+            BrowserCommonConstants.PREFERENCE_BROWSER_ENTRY_LABEL,
+            this.entryLabelCombo.getSelectionIndex() == 2 ? BrowserCommonConstants.SHOW_RDN_VALUE : this.entryLabelCombo
+                .getSelectionIndex() == 1 ? BrowserCommonConstants.SHOW_RDN : BrowserCommonConstants.SHOW_DN );
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_BROWSER_ENTRY_ABBREVIATE,
+            this.entryAbbreviateButton.getSelection() );
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_BROWSER_ENTRY_ABBREVIATE_MAX_LENGTH,
+            this.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
+                    : BrowserCommonConstants.SHOW_DN );
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_ABBREVIATE,
+            this.searchResultAbbreviateButton.getSelection() );
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_ABBREVIATE_MAX_LENGTH,
+            this.searchResultAbbreviateMaxLengthText.getText().trim() );
+
+        return true;
+    }
+
+
+    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
+                    : 0 );
+        entryAbbreviateButton.setSelection( getPreferenceStore().getDefaultBoolean(
+            BrowserCommonConstants.PREFERENCE_BROWSER_ENTRY_ABBREVIATE ) );
+        entryAbbreviateMaxLengthText.setText( getPreferenceStore().getDefaultString(
+            BrowserCommonConstants.PREFERENCE_BROWSER_ENTRY_ABBREVIATE_MAX_LENGTH ) );
+
+        searchResultLabelCombo
+            .select( getPreferenceStore().getDefaultInt( BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_LABEL ) == BrowserCommonConstants.SHOW_RDN_VALUE ? 2
+                : getPreferenceStore().getDefaultInt( BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_LABEL ) == BrowserCommonConstants.SHOW_RDN ? 1
+                    : 0 );
+        searchResultAbbreviateButton.setSelection( getPreferenceStore().getDefaultBoolean(
+            BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_ABBREVIATE ) );
+        searchResultAbbreviateMaxLengthText.setText( getPreferenceStore().getDefaultString(
+            BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_ABBREVIATE_MAX_LENGTH ) );
+
+        enableFoldingButton.setSelection( getPreferenceStore().getDefaultBoolean(
+            BrowserCommonConstants.PREFERENCE_BROWSER_ENABLE_FOLDING ) );
+        foldingSizeText.setText( getPreferenceStore().getDefaultString(
+            BrowserCommonConstants.PREFERENCE_BROWSER_FOLDING_SIZE ) );
+
+        expandBaseEntriesButton.setSelection( getPreferenceStore().getDefaultBoolean(
+            BrowserCommonConstants.PREFERENCE_BROWSER_EXPAND_BASE_ENTRIES ) );
+        Preferences coreStore = BrowserCorePlugin.getDefault().getPluginPreferences();
+        checkForChildrenButton.setSelection( coreStore
+            .getDefaultBoolean( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN ) );
+        showAliasAndReferralObjectsButton.setSelection( coreStore
+            .getDefaultBoolean( BrowserCoreConstants.PREFERENCE_SHOW_ALIAS_AND_REFERRAL_OBJECTS ) );
+        fetchSubentriesButton.setSelection( coreStore
+            .getDefaultBoolean( BrowserCoreConstants.PREFERENCE_FETCH_SUBENTRIES ) );
+
+        updateEnabled();
+
+        super.performDefaults();
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/BrowserPreferencePage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/EntryEditorPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/EntryEditorPreferencePage.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/EntryEditorPreferencePage.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/EntryEditorPreferencePage.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,194 @@
+/*
+ *  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.PreferencePage;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+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.swt.widgets.Text;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+
+public class EntryEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
+{
+
+    private Button showObjectClassAttributeButton;
+
+    private Button showMustAttributesButton;
+
+    private Button showMayAttributesButton;
+
+    private Button showOperationalAttributesButton;
+
+    private Button enableFoldingButton;
+
+    private Label foldingThresholdLabel;
+
+    private Text foldingThresholdText;
+
+
+    public EntryEditorPreferencePage()
+    {
+        super();
+        super.setPreferenceStore( BrowserCommonActivator.getDefault().getPreferenceStore() );
+        super.setDescription( "General settings for the LDAP entry editor:" );
+    }
+
+
+    public void init( IWorkbench workbench )
+    {
+    }
+
+
+    protected Control createContents( Composite parent )
+    {
+
+        Composite composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
+
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        Group visibleAttributesGroup = BaseWidgetUtils.createGroup( BaseWidgetUtils.createColumnContainer( composite,
+            1, 1 ), "Visible Attributes", 1 );
+        Composite visibleAttributesComposite = BaseWidgetUtils.createColumnContainer( visibleAttributesGroup, 1, 1 );
+        showObjectClassAttributeButton = BaseWidgetUtils.createCheckbox( visibleAttributesComposite,
+            "Show objectClass attribute", 1 );
+        showObjectClassAttributeButton.setSelection( getPreferenceStore().getBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OBJECTCLASS_ATTRIBUTES ) );
+        showMustAttributesButton = BaseWidgetUtils.createCheckbox( visibleAttributesComposite, "Show must attributes",
+            1 );
+        showMustAttributesButton.setSelection( getPreferenceStore().getBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_MUST_ATTRIBUTES ) );
+        showMayAttributesButton = BaseWidgetUtils.createCheckbox( visibleAttributesComposite, "Show may attributes", 1 );
+        showMayAttributesButton.setSelection( getPreferenceStore().getBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_MAY_ATTRIBUTES ) );
+        showOperationalAttributesButton = BaseWidgetUtils.createCheckbox( visibleAttributesComposite,
+            "Show operational attributes", 1 );
+        showOperationalAttributesButton.setSelection( getPreferenceStore().getBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES ) );
+
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        String foldingTooltip = "If an attribute has more than the specified number of values it will be folded to one line. You may expand and collapse the values.";
+        Group foldingGroup = BaseWidgetUtils.createGroup( BaseWidgetUtils.createColumnContainer( composite, 1, 1 ),
+            "Folding", 1 );
+        Composite pagingGroupComposite = BaseWidgetUtils.createColumnContainer( foldingGroup, 2, 1 );
+        enableFoldingButton = BaseWidgetUtils.createCheckbox( pagingGroupComposite, "Enable folding", 2 );
+        enableFoldingButton.setToolTipText( foldingTooltip );
+        enableFoldingButton.setSelection( getPreferenceStore().getBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_ENABLE_FOLDING ) );
+        enableFoldingButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                updateEnabled();
+            }
+        } );
+        foldingThresholdLabel = BaseWidgetUtils.createLabel( pagingGroupComposite, "Folding threshold: ", 1 );
+        foldingThresholdLabel.setToolTipText( foldingTooltip );
+        foldingThresholdLabel.setEnabled( enableFoldingButton.getSelection() );
+        foldingThresholdText = BaseWidgetUtils.createText( pagingGroupComposite, getPreferenceStore().getString(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_FOLDING_THRESHOLD ), 4, 1 );
+        foldingThresholdText.setToolTipText( foldingTooltip );
+        foldingThresholdText.setEnabled( enableFoldingButton.getSelection() );
+        foldingThresholdText.addVerifyListener( new VerifyListener()
+        {
+            public void verifyText( VerifyEvent e )
+            {
+                if ( !e.text.matches( "[0-9]*" ) )
+                {
+                    e.doit = false;
+                }
+                if ( "".equals( foldingThresholdText.getText() ) && e.text.matches( "[0]" ) )
+                {
+                    e.doit = false;
+                }
+            }
+        } );
+
+        updateEnabled();
+
+        applyDialogFont( composite );
+
+        return composite;
+    }
+
+
+    private void updateEnabled()
+    {
+        foldingThresholdText.setEnabled( enableFoldingButton.getSelection() );
+        foldingThresholdLabel.setEnabled( enableFoldingButton.getSelection() );
+    }
+
+
+    public boolean performOk()
+    {
+
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OBJECTCLASS_ATTRIBUTES,
+            this.showObjectClassAttributeButton.getSelection() );
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_MUST_ATTRIBUTES,
+            this.showMustAttributesButton.getSelection() );
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_MAY_ATTRIBUTES,
+            this.showMayAttributesButton.getSelection() );
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES,
+            this.showOperationalAttributesButton.getSelection() );
+
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_ENABLE_FOLDING,
+            this.enableFoldingButton.getSelection() );
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_FOLDING_THRESHOLD,
+            this.foldingThresholdText.getText() );
+
+        return true;
+    }
+
+
+    protected void performDefaults()
+    {
+
+        this.showObjectClassAttributeButton.setSelection( getPreferenceStore().getDefaultBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OBJECTCLASS_ATTRIBUTES ) );
+        this.showMustAttributesButton.setSelection( getPreferenceStore().getDefaultBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_MUST_ATTRIBUTES ) );
+        this.showMayAttributesButton.setSelection( getPreferenceStore().getDefaultBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_MAY_ATTRIBUTES ) );
+        this.showOperationalAttributesButton.setSelection( getPreferenceStore().getDefaultBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES ) );
+
+        this.foldingThresholdText.setText( getPreferenceStore().getDefaultString(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_FOLDING_THRESHOLD ) );
+
+        updateEnabled();
+
+        super.performDefaults();
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/EntryEditorPreferencePage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/MainPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/MainPreferencePage.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/MainPreferencePage.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/MainPreferencePage.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,250 @@
+/*
+ *  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.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;
+
+
+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;
+
+
+    public MainPreferencePage()
+    {
+        super( "LDAP" );
+        super.setPreferenceStore( BrowserCommonActivator.getDefault().getPreferenceStore() );
+        super.setDescription( "General settings for the LDAP plugin:" );
+    }
+
+
+    public void init( IWorkbench workbench )
+    {
+    }
+
+
+    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;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/MainPreferencePage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxDialog.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxDialog.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxDialog.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,108 @@
+/*
+ *  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.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;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+
+public class SyntaxDialog extends Dialog
+{
+
+    private BinarySyntax currentSyntax;
+
+    private String[] syntaxOids;
+
+    private BinarySyntax returnSyntax;
+
+    private Combo oidCombo;
+
+
+    public SyntaxDialog( Shell parentShell, BinarySyntax currentSyntax, String[] syntaxOids )
+    {
+        super( parentShell );
+        this.currentSyntax = currentSyntax;
+        this.syntaxOids = syntaxOids;
+
+        this.returnSyntax = null;
+    }
+
+
+    protected void configureShell( Shell newShell )
+    {
+        super.configureShell( newShell );
+        newShell.setText( "Select Syntax OID" );
+    }
+
+
+    protected void okPressed()
+    {
+        this.returnSyntax = new BinarySyntax( oidCombo.getText() );
+        super.okPressed();
+    }
+
+
+    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 )
+        {
+            this.oidCombo.setText( currentSyntax.getSyntaxNumericOid() );
+        }
+        this.oidCombo.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                validate();
+            }
+        } );
+
+        return composite;
+    }
+
+
+    private void validate()
+    {
+        super.getButton( IDialogConstants.OK_ID ).setEnabled( !"".equals( this.oidCombo.getText() ) );
+    }
+
+
+    public BinarySyntax getSyntax()
+    {
+        return returnSyntax;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxDialog.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxValueEditorDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxValueEditorDialog.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxValueEditorDialog.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxValueEditorDialog.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,147 @@
+/*
+ *  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 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.valueeditors.ValueEditorManager.ValueEditorExtension;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+
+public class SyntaxValueEditorDialog extends Dialog
+{
+
+    private SyntaxValueProviderRelation relation;
+
+    private SortedMap<String, ValueEditorExtension> class2ValueEditorProxyMap;
+
+    private String[] syntaxOids;
+
+    private SortedMap<String, String> vpName2classMap;
+
+    private SyntaxValueProviderRelation returnRelation;
+
+    private Combo oidCombo;
+
+    private Combo valueEditorCombo;
+
+
+    public SyntaxValueEditorDialog( Shell parentShell, SyntaxValueProviderRelation relation,
+        SortedMap<String, ValueEditorExtension> class2ValueEditorProxyMap, String[] syntaxOids )
+    {
+        super( parentShell );
+        this.relation = relation;
+        this.class2ValueEditorProxyMap = class2ValueEditorProxyMap;
+        this.syntaxOids = syntaxOids;
+
+        this.returnRelation = null;
+
+        this.vpName2classMap = new TreeMap<String, String>();
+        for ( Iterator<ValueEditorExtension> it = this.class2ValueEditorProxyMap.values().iterator(); it.hasNext(); )
+        {
+            ValueEditorExtension vp = it.next();
+            vpName2classMap.put( vp.name, vp.className );
+        }
+    }
+
+
+    protected void configureShell( Shell newShell )
+    {
+        super.configureShell( newShell );
+        newShell.setText( "Attribute Value Editor" );
+    }
+
+
+    protected void okPressed()
+    {
+        this.returnRelation = new SyntaxValueProviderRelation( this.oidCombo.getText(), ( String ) this.vpName2classMap
+            .get( this.valueEditorCombo.getText() ) );
+        super.okPressed();
+    }
+
+
+    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 )
+        {
+            this.oidCombo.setText( this.relation.getSyntaxOID() );
+        }
+        this.oidCombo.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                validate();
+            }
+        } );
+
+        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() ) )
+        {
+            this.valueEditorCombo.setText( ( this.class2ValueEditorProxyMap.get( this.relation
+                .getValueProviderClassname() ) ).name );
+        }
+        this.valueEditorCombo.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                validate();
+            }
+        } );
+
+        return composite;
+    }
+
+
+    private void validate()
+    {
+        super.getButton( IDialogConstants.OK_ID ).setEnabled(
+            !"".equals( this.valueEditorCombo.getText() ) && !"".equals( this.oidCombo.getText() ) );
+    }
+
+
+    public SyntaxValueProviderRelation getRelation()
+    {
+        return returnRelation;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/SyntaxValueEditorDialog.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/TextFormatsPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/TextFormatsPreferencePage.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/TextFormatsPreferencePage.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/TextFormatsPreferencePage.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,486 @@
+/*
+ *  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.apache.directory.studio.ldapbrowser.common.widgets.BinaryEncodingInput;
+import org.apache.directory.studio.ldapbrowser.common.widgets.FileEncodingInput;
+import org.apache.directory.studio.ldapbrowser.common.widgets.LineSeparatorInput;
+import org.apache.directory.studio.ldapbrowser.common.widgets.OptionsInput;
+import org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyEvent;
+import org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyListener;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+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.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+
+public class TextFormatsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage,
+    WidgetModifyListener, ModifyListener
+{
+
+    public static final String LDIF_TAB = "LDIF";
+
+    public static final String CSV_TAB = "CSV";
+
+    public static final String XLS_TAB = "XLS";
+
+    public static final String TABLE_TAB = "TABLE";
+
+    private Preferences coreStore = BrowserCorePlugin.getDefault().getPluginPreferences();
+
+    private TabFolder tabFolder;
+
+    private TabItem ldifTab;
+
+    private TabItem tableTab;
+
+    private TabItem csvTab;
+
+    private TabItem xlsTab;
+
+    private Text ldifLineLengthText;
+
+    private Button ldifSpaceAfterColonButton;
+
+    private LineSeparatorInput ldifLineSeparator;
+
+    // private Button ldifSpaceBetweenRDNsButton;
+
+    private OptionsInput tableAttributeDelimiterWidget;
+
+    private OptionsInput tableValueDelimiterWidget;
+
+    private OptionsInput tableQuoteWidget;
+
+    private LineSeparatorInput tableLineSeparator;
+
+    private BinaryEncodingInput tableBinaryEncodingWidget;
+
+    private OptionsInput csvAttributeDelimiterWidget;
+
+    private OptionsInput csvValueDelimiterWidget;
+
+    private OptionsInput csvQuoteWidget;
+
+    private LineSeparatorInput csvLineSeparator;
+
+    private BinaryEncodingInput csvBinaryEncodingWidget;
+
+    private FileEncodingInput csvEncodingWidget;
+
+    private OptionsInput xlsValueDelimiterWidget;
+
+    private OptionsInput xlsBinaryEncodingWidget;
+
+
+    public TextFormatsPreferencePage()
+    {
+        super();
+        super.setPreferenceStore( BrowserCommonActivator.getDefault().getPreferenceStore() );
+        super.setDescription( "Settings for text formats" );
+    }
+
+
+    public void init( IWorkbench workbench )
+    {
+    }
+
+
+    public void applyData( Object data )
+    {
+        if ( data != null && tabFolder != null )
+        {
+            if ( LDIF_TAB.equals( data ) )
+            {
+                tabFolder.setSelection( 0 );
+            }
+            else if ( TABLE_TAB.equals( data ) )
+            {
+                tabFolder.setSelection( 1 );
+            }
+            else if ( CSV_TAB.equals( data ) )
+            {
+                tabFolder.setSelection( 2 );
+            }
+            else if ( XLS_TAB.equals( data ) )
+            {
+                tabFolder.setSelection( 3 );
+            }
+        }
+    }
+
+
+    protected Control createContents( Composite parent )
+    {
+        BaseWidgetUtils.createSpacer( parent, 1 );
+        tabFolder = new TabFolder( parent, SWT.TOP );
+
+        createLdifTab();
+        createTableTab();
+        createCsvTab();
+        createXlsTab();
+
+        updateEnabled();
+        validate();
+
+        applyDialogFont( tabFolder );
+
+        return tabFolder;
+    }
+
+
+    private void createTableTab()
+    {
+
+        tableTab = new TabItem( tabFolder, SWT.NONE );
+        tableTab.setText( "CSV Copy" );
+
+        Composite tableComposite = new Composite( tabFolder, SWT.NONE );
+        tableComposite.setLayout( new GridLayout( 1, false ) );
+        Composite tableInnerComposite = BaseWidgetUtils.createColumnContainer( tableComposite, 3, 1 );
+
+        BaseWidgetUtils.createLabel( tableInnerComposite, "Select CSV copy format options:", 3 );
+        BaseWidgetUtils.createSpacer( tableInnerComposite, 3 );
+
+        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 );
+        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 );
+        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 );
+        tableQuoteWidget.createWidget( tableInnerComposite );
+        tableQuoteWidget.addWidgetModifyListener( this );
+
+        tableLineSeparator = new LineSeparatorInput( getPreferenceStore().getString(
+            BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_LINESEPARATOR ), false );
+        tableLineSeparator.createWidget( tableInnerComposite );
+        tableLineSeparator.addWidgetModifyListener( this );
+
+        tableBinaryEncodingWidget = new BinaryEncodingInput( getPreferenceStore().getString(
+            BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_BINARYENCODING ), false );
+        tableBinaryEncodingWidget.createWidget( tableInnerComposite );
+        tableBinaryEncodingWidget.addWidgetModifyListener( this );
+
+        Composite copyTableHintComposite = BaseWidgetUtils.createColumnContainer( tableInnerComposite, 3, 3 );
+        BaseWidgetUtils.createWrappedLabeledText( copyTableHintComposite,
+            "Hint: The default settings are suitable to paste the copied data into Excel or OpenOffice.", 1 );
+
+        tableTab.setControl( tableComposite );
+    }
+
+
+    private void createCsvTab()
+    {
+
+        csvTab = new TabItem( tabFolder, SWT.NONE );
+        csvTab.setText( "CSV Export" );
+
+        Composite csvComposite = new Composite( tabFolder, SWT.NONE );
+        csvComposite.setLayout( new GridLayout( 1, false ) );
+        Composite csvInnerComposite = BaseWidgetUtils.createColumnContainer( csvComposite, 3, 1 );
+
+        BaseWidgetUtils.createLabel( csvInnerComposite, "Select CSV export file format options:", 3 );
+        BaseWidgetUtils.createSpacer( csvInnerComposite, 3 );
+
+        csvAttributeDelimiterWidget = new OptionsInput( "Attribute Delimiter", "Comma (,)", ",", new String[]
+            { "Comma (,)", "Semikolon (;)", "Tabulator (\\t)" }, new String[]
+            { ",", ";", "\t" }, coreStore.getString( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_ATTRIBUTEDELIMITER ),
+            false, true );
+        csvAttributeDelimiterWidget.createWidget( csvInnerComposite );
+        csvAttributeDelimiterWidget.addWidgetModifyListener( this );
+
+        csvValueDelimiterWidget = new OptionsInput( "Value Delimiter", "Pipe (|)", "|", new String[]
+            { "Pipe (|)", "Comma (,)", "Semikolon (;)", "Newline (\\n)" }, new String[]
+            { "|", ",", ";", "\n" }, coreStore.getString( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_VALUEDELIMITER ),
+            false, true );
+        csvValueDelimiterWidget.createWidget( csvInnerComposite );
+        csvValueDelimiterWidget.addWidgetModifyListener( this );
+
+        csvQuoteWidget = new OptionsInput( "Quote Character", "Double Quote (\")", "\"", new String[]
+            { "Double Quote (\")", "Single Quote (')" }, new String[]
+            { "\"", "'" }, coreStore.getString( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_QUOTECHARACTER ), false,
+            true );
+        csvQuoteWidget.createWidget( csvInnerComposite );
+        csvQuoteWidget.addWidgetModifyListener( this );
+
+        csvLineSeparator = new LineSeparatorInput( coreStore
+            .getString( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_LINESEPARATOR ), false );
+        csvLineSeparator.createWidget( csvInnerComposite );
+        csvLineSeparator.addWidgetModifyListener( this );
+
+        csvBinaryEncodingWidget = new BinaryEncodingInput( coreStore
+            .getString( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_BINARYENCODING ), false );
+        csvBinaryEncodingWidget.createWidget( csvInnerComposite );
+        csvBinaryEncodingWidget.addWidgetModifyListener( this );
+
+        csvEncodingWidget = new FileEncodingInput( coreStore
+            .getString( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_ENCODING ), false );
+        csvEncodingWidget.createWidget( csvInnerComposite );
+        csvEncodingWidget.addWidgetModifyListener( this );
+
+        csvTab.setControl( csvComposite );
+    }
+
+
+    private void createXlsTab()
+    {
+
+        xlsTab = new TabItem( tabFolder, SWT.NONE );
+        xlsTab.setText( "Excel Export" );
+
+        Composite xlsComposite = new Composite( tabFolder, SWT.NONE );
+        xlsComposite.setLayout( new GridLayout( 1, false ) );
+        Composite xlsInnerComposite = BaseWidgetUtils.createColumnContainer( xlsComposite, 3, 1 );
+
+        BaseWidgetUtils.createWrappedLabeledText( xlsInnerComposite, "Select Excel export file format options:", 3 );
+        BaseWidgetUtils.createSpacer( xlsInnerComposite, 3 );
+
+        xlsValueDelimiterWidget = new OptionsInput( "Value Delimiter", "Pipe (|)", "|", new String[]
+            { "Pipe (|)", "Comma (,)", "Semikolon (;)", "Newline (\\n)" }, new String[]
+            { "|", ",", ";", "\n" }, coreStore.getString( BrowserCoreConstants.PREFERENCE_FORMAT_XLS_VALUEDELIMITER ),
+            false, true );
+        xlsValueDelimiterWidget.createWidget( xlsInnerComposite );
+        xlsValueDelimiterWidget.addWidgetModifyListener( this );
+
+        xlsBinaryEncodingWidget = new BinaryEncodingInput( coreStore
+            .getString( BrowserCoreConstants.PREFERENCE_FORMAT_XLS_BINARYENCODING ), false );
+        xlsBinaryEncodingWidget.createWidget( xlsInnerComposite );
+        xlsBinaryEncodingWidget.addWidgetModifyListener( this );
+
+        xlsTab.setControl( xlsComposite );
+    }
+
+
+    private void createLdifTab()
+    {
+
+        ldifTab = new TabItem( tabFolder, SWT.NONE );
+        ldifTab.setText( "LDIF" );
+
+        Composite ldifComposite = new Composite( tabFolder, SWT.NONE );
+        ldifComposite.setLayout( new GridLayout( 1, false ) );
+        Composite ldifInnerComposite = BaseWidgetUtils.createColumnContainer( ldifComposite, 1, 1 );
+
+        BaseWidgetUtils.createLabel( ldifInnerComposite, "Select LDIF format options:", 1 );
+        BaseWidgetUtils.createSpacer( ldifInnerComposite, 1 );
+
+        ldifLineSeparator = new LineSeparatorInput( coreStore
+            .getString( BrowserCoreConstants.PREFERENCE_LDIF_LINE_SEPARATOR ), true );
+        ldifLineSeparator.createWidget( ldifInnerComposite );
+        ldifLineSeparator.addWidgetModifyListener( this );
+
+        BaseWidgetUtils.createSpacer( ldifInnerComposite, 1 );
+
+        Composite lineLengthComposite = BaseWidgetUtils.createColumnContainer( ldifInnerComposite, 3, 1 );
+        BaseWidgetUtils.createLabel( lineLengthComposite, "Line length:", 1 );
+        ldifLineLengthText = BaseWidgetUtils.createText( lineLengthComposite, "", 3, 1 );
+        ldifLineLengthText.setText( coreStore.getString( BrowserCoreConstants.PREFERENCE_LDIF_LINE_WIDTH ) );
+        ldifLineLengthText.addVerifyListener( new VerifyListener()
+        {
+            public void verifyText( VerifyEvent e )
+            {
+                if ( !e.text.matches( "[0-9]*" ) )
+                {
+                    e.doit = false;
+                }
+                if ( "".equals( ldifLineLengthText.getText() ) && e.text.matches( "[0]" ) )
+                {
+                    e.doit = false;
+                }
+            }
+        } );
+        ldifLineLengthText.addModifyListener( this );
+        BaseWidgetUtils.createLabel( lineLengthComposite, "characters", 1 );
+
+        ldifSpaceAfterColonButton = BaseWidgetUtils.createCheckbox( ldifInnerComposite, "Space after colon", 1 );
+        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()
+    {
+
+    }
+
+
+    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
+            .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
+            .getRawValue() );
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_LINESEPARATOR, this.csvLineSeparator
+            .getRawValue() );
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_BINARYENCODING, this.csvBinaryEncodingWidget
+            .getRawValue() );
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_ENCODING, this.csvEncodingWidget.getRawValue() );
+
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_ATTRIBUTEDELIMITER,
+            this.tableAttributeDelimiterWidget.getRawValue() );
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_VALUEDELIMITER,
+            this.tableValueDelimiterWidget.getRawValue() );
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_QUOTECHARACTER,
+            this.tableQuoteWidget.getRawValue() );
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_LINESEPARATOR,
+            this.tableLineSeparator.getRawValue() );
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_BINARYENCODING,
+            this.tableBinaryEncodingWidget.getRawValue() );
+
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_XLS_VALUEDELIMITER, this.xlsValueDelimiterWidget
+            .getRawValue() );
+        coreStore.setValue( BrowserCoreConstants.PREFERENCE_FORMAT_XLS_BINARYENCODING, this.xlsBinaryEncodingWidget
+            .getRawValue() );
+
+        updateEnabled();
+        validate();
+
+        return true;
+    }
+
+
+    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
+            .getDefaultBoolean( BrowserCoreConstants.PREFERENCE_LDIF_SPACE_AFTER_COLON ) );
+        // this.ldifSpaceBetweenRDNsButton.setSelection(coreStore.getDefaultBoolean(BrowserCoreConstants.PREFERENCE_LDIF_SPACE_BETWEEN_RDNS));
+
+        this.csvAttributeDelimiterWidget.setRawValue( coreStore
+            .getDefaultString( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_ATTRIBUTEDELIMITER ) );
+        this.csvValueDelimiterWidget.setRawValue( coreStore
+            .getDefaultString( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_VALUEDELIMITER ) );
+        this.csvQuoteWidget.setRawValue( coreStore
+            .getDefaultString( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_QUOTECHARACTER ) );
+        this.csvLineSeparator.setRawValue( coreStore
+            .getDefaultString( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_LINESEPARATOR ) );
+        this.csvBinaryEncodingWidget.setRawValue( coreStore
+            .getDefaultString( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_BINARYENCODING ) );
+        this.csvEncodingWidget.setRawValue( coreStore
+            .getDefaultString( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_ENCODING ) );
+
+        this.tableAttributeDelimiterWidget.setRawValue( getPreferenceStore().getDefaultString(
+            BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_ATTRIBUTEDELIMITER ) );
+        this.tableValueDelimiterWidget.setRawValue( getPreferenceStore().getDefaultString(
+            BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_VALUEDELIMITER ) );
+        this.tableQuoteWidget.setRawValue( getPreferenceStore().getDefaultString(
+            BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_QUOTECHARACTER ) );
+        this.tableLineSeparator.setRawValue( getPreferenceStore().getDefaultString(
+            BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_LINESEPARATOR ) );
+        this.tableBinaryEncodingWidget.setRawValue( getPreferenceStore().getDefaultString(
+            BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_BINARYENCODING ) );
+
+        this.xlsValueDelimiterWidget.setRawValue( coreStore
+            .getDefaultString( BrowserCoreConstants.PREFERENCE_FORMAT_XLS_VALUEDELIMITER ) );
+        this.xlsBinaryEncodingWidget.setRawValue( coreStore
+            .getDefaultString( BrowserCoreConstants.PREFERENCE_FORMAT_XLS_BINARYENCODING ) );
+
+        updateEnabled();
+        validate();
+
+        super.performDefaults();
+    }
+
+
+    public void widgetModified( WidgetModifyEvent event )
+    {
+        updateEnabled();
+        validate();
+    }
+
+
+    public void modifyText( ModifyEvent e )
+    {
+        updateEnabled();
+        validate();
+    }
+
+
+    protected void validate()
+    {
+        setValid( !"".equals( csvAttributeDelimiterWidget.getRawValue() )
+            && !"".equals( csvValueDelimiterWidget.getRawValue() ) && !"".equals( csvQuoteWidget.getRawValue() )
+            && !"".equals( csvLineSeparator.getRawValue() ) && !"".equals( csvBinaryEncodingWidget.getRawValue() )
+            && !"".equals( csvEncodingWidget.getRawValue() ) &&
+
+            !"".equals( tableAttributeDelimiterWidget.getRawValue() )
+            && !"".equals( tableValueDelimiterWidget.getRawValue() ) && !"".equals( tableQuoteWidget.getRawValue() )
+            && !"".equals( tableLineSeparator.getRawValue() ) && !"".equals( tableBinaryEncodingWidget.getRawValue() )
+            &&
+
+            !"".equals( xlsValueDelimiterWidget.getRawValue() ) && !"".equals( xlsBinaryEncodingWidget.getRawValue() )
+            &&
+
+            !"".equals( ldifLineLengthText.getText() ) && !"".equals( ldifLineSeparator.getRawValue() ) );
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/TextFormatsPreferencePage.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message