directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r691596 - in /directory/studio/trunk: ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/ ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/ ldapbrowser-common/s...
Date Wed, 03 Sep 2008 12:58:50 GMT
Author: seelmann
Date: Wed Sep  3 05:58:49 2008
New Revision: 691596

URL: http://svn.apache.org/viewvc?rev=691596&view=rev
Log:
Fix for DIRSTUDIO-116 (Expand all folded attributes by default)

Modified:
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/EntryEditorPreferencePage.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetContentProvider.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetPreferences.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java?rev=691596&r1=691595&r2=691596&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
Wed Sep  3 05:58:49 2008
@@ -89,6 +89,7 @@
     public static final String PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES = "entryeditorShowOperationalAttributes";
     public static final String PREFERENCE_ENTRYEDITOR_ENABLE_FOLDING = "entryeditorEnableFolding";
     public static final String PREFERENCE_ENTRYEDITOR_FOLDING_THRESHOLD = "entryeditorFoldingThreshold";
+    public static final String PREFERENCE_ENTRYEDITOR_AUTO_EXPAND_FOLDED_ATTRIBUTES = "entryeditorAutoExpandFoldedAttributes";
     public static final String PREFERENCE_ENTRYEDITOR_OBJECTCLASS_AND_MUST_ATTRIBUTES_FIRST
= "entryeditorObjectClassAndMustAttributesFirst";
     public static final String PREFERENCE_ENTRYEDITOR_OPERATIONAL_ATTRIBUTES_LAST = "entryeditorOperationalAttributesLast";
     public static final String PREFERENCE_ENTRYEDITOR_DEFAULT_SORT_BY = "entryeditorDefaultSortBy";

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java?rev=691596&r1=691595&r2=691596&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java
Wed Sep  3 05:58:49 2008
@@ -136,6 +136,7 @@
         // Entry Editor
         store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_ENABLE_FOLDING, true
);
         store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_FOLDING_THRESHOLD,
10 );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTO_EXPAND_FOLDED_ATTRIBUTES,
false );
         store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OBJECTCLASS_ATTRIBUTES,
true );
         store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_MUST_ATTRIBUTES,
true );
         store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_MAY_ATTRIBUTES,
true );

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/EntryEditorPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/EntryEditorPreferencePage.java?rev=691596&r1=691595&r2=691596&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/EntryEditorPreferencePage.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/EntryEditorPreferencePage.java
Wed Sep  3 05:58:49 2008
@@ -21,9 +21,9 @@
 package org.apache.directory.studio.ldapbrowser.common.dialogs.preferences;
 
 
+import org.apache.directory.studio.connection.ui.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
-import org.apache.directory.studio.connection.ui.widgets.BaseWidgetUtils;
 import org.eclipse.jface.preference.PreferencePage;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
@@ -62,6 +62,8 @@
 
     private Text foldingThresholdText;
 
+    private Button autoExpandFoldedAttributesButton;
+
 
     /**
      * Creates a new instance of EntryEditorPreferencePage.
@@ -115,8 +117,8 @@
         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 );
+        Composite pagingGroupComposite = BaseWidgetUtils.createColumnContainer( foldingGroup,
3, 1 );
+        enableFoldingButton = BaseWidgetUtils.createCheckbox( pagingGroupComposite, "Enable
folding", 3 );
         enableFoldingButton.setToolTipText( foldingTooltip );
         enableFoldingButton.setSelection( getPreferenceStore().getBoolean(
             BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_ENABLE_FOLDING ) );
@@ -127,6 +129,7 @@
                 updateEnabled();
             }
         } );
+        BaseWidgetUtils.createRadioIndent( pagingGroupComposite, 1 );
         foldingThresholdLabel = BaseWidgetUtils.createLabel( pagingGroupComposite, "Folding
threshold: ", 1 );
         foldingThresholdLabel.setToolTipText( foldingTooltip );
         foldingThresholdLabel.setEnabled( enableFoldingButton.getSelection() );
@@ -148,6 +151,12 @@
                 }
             }
         } );
+        BaseWidgetUtils.createRadioIndent( pagingGroupComposite, 1 );
+        autoExpandFoldedAttributesButton = BaseWidgetUtils.createCheckbox( pagingGroupComposite,
+            "Auto-expand folded attributes", 2 );
+        autoExpandFoldedAttributesButton.setEnabled( enableFoldingButton.getSelection() );
+        autoExpandFoldedAttributesButton.setSelection( getPreferenceStore().getBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTO_EXPAND_FOLDED_ATTRIBUTES )
);
 
         updateEnabled();
 
@@ -161,6 +170,7 @@
     {
         foldingThresholdText.setEnabled( enableFoldingButton.getSelection() );
         foldingThresholdLabel.setEnabled( enableFoldingButton.getSelection() );
+        autoExpandFoldedAttributesButton.setEnabled( enableFoldingButton.getSelection() );
     }
 
 
@@ -182,6 +192,8 @@
             enableFoldingButton.getSelection() );
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_FOLDING_THRESHOLD,
             foldingThresholdText.getText() );
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTO_EXPAND_FOLDED_ATTRIBUTES,
+            autoExpandFoldedAttributesButton.getSelection() );
 
         return true;
     }
@@ -201,8 +213,12 @@
         showOperationalAttributesButton.setSelection( getPreferenceStore().getDefaultBoolean(
             BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES ) );
 
+        enableFoldingButton.setSelection( getPreferenceStore().getDefaultBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_ENABLE_FOLDING ) );
         foldingThresholdText.setText( getPreferenceStore().getDefaultString(
             BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_FOLDING_THRESHOLD ) );
+        autoExpandFoldedAttributesButton.setSelection( getPreferenceStore().getDefaultBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTO_EXPAND_FOLDED_ATTRIBUTES )
);
 
         updateEnabled();
 

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetContentProvider.java?rev=691596&r1=691595&r2=691596&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetContentProvider.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetContentProvider.java
Wed Sep  3 05:58:49 2008
@@ -182,8 +182,8 @@
                 || ( attribute.getEntry() instanceof IRootDSE ) )
             {
                 IValue[] values = attribute.getValues();
-                if ( this.preferences == null || !this.preferences.isUseFolding()
-                    || ( values.length <= this.preferences.getFoldingThreshold() ) )
+                if ( preferences == null || !preferences.isUseFolding()
+                    || ( values.length <= preferences.getFoldingThreshold() ) )
                 {
                     for ( IValue value : values )
                     {

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetPreferences.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetPreferences.java?rev=691596&r1=691595&r2=691596&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetPreferences.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetPreferences.java
Wed Sep  3 05:58:49 2008
@@ -98,6 +98,18 @@
 
 
     /**
+     * Checks if is auto expand folded attributes.
+     * 
+     * @return true, if is auto expand folded attributes
+     */
+    public boolean isAutoExpandFoldedAttributes()
+    {
+        return BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTO_EXPAND_FOLDED_ATTRIBUTES );
+    }
+
+
+    /**
      * Checks if may attributes should be shown.
      * 
      * @return true, if may attributes should be shown

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java?rev=691596&r1=691595&r2=691596&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java
Wed Sep  3 05:58:49 2008
@@ -132,8 +132,7 @@
 
                 IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
                     IContextService.class );
-                contextActivation = contextService
-                    .activateContext( BrowserCommonConstants.CONTEXT_WINDOWS );
+                contextActivation = contextService.activateContext( BrowserCommonConstants.CONTEXT_WINDOWS
);
                 // org.eclipse.ui.contexts.dialogAndWindow
                 // org.eclipse.ui.contexts.window
                 // org.eclipse.ui.text_editor_context
@@ -238,6 +237,7 @@
         {
             viewer.setInput( entry );
             entryEditor.getActionGroup().setInput( entry );
+            expandFoldedAttributes();
         }
 
     }
@@ -251,12 +251,26 @@
     public void entryUpdated( EntryModificationEvent event )
     {
         super.entryUpdated( event );
+        expandFoldedAttributes();
 
-        EntryEditorOutlinePage outlinePage = ( EntryEditorOutlinePage ) entryEditor.getAdapter(
IContentOutlinePage.class );
+        EntryEditorOutlinePage outlinePage = ( EntryEditorOutlinePage ) entryEditor
+            .getAdapter( IContentOutlinePage.class );
         if ( outlinePage != null )
         {
             outlinePage.refresh();
         }
     }
 
+
+    /**
+     * Expands folded attributes if the appropriate preference is set.
+     */
+    private void expandFoldedAttributes()
+    {
+        if ( entryEditor.getConfiguration().getPreferences().isAutoExpandFoldedAttributes()
)
+        {
+            viewer.expandAll();
+        }
+    }
+
 }



Mime
View raw message