directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r821825 - 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-ui/src/m...
Date Mon, 05 Oct 2009 15:04:28 GMT
Author: seelmann
Date: Mon Oct  5 15:04:27 2009
New Revision: 821825

URL: http://svn.apache.org/viewvc?rev=821825&view=rev
Log:
Fix for DIRSTUDIO-554 (Add option to save tabular entry editor automatically or manually)

Added:
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/ToggleAutosaveAction.java
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/dialogs/preferences/messages.properties
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_de.properties
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_fr.properties
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditor.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabEntryEditor.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditor.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages.properties
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_de.properties
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_fr.properties

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=821825&r1=821824&r2=821825&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
Mon Oct  5 15:04:27 2009
@@ -88,6 +88,8 @@
     public static final String PREFERENCE_ENTRYEDITOR_SHOW_MUST_ATTRIBUTES = "entryeditorShowMustAttributes";
//$NON-NLS-1$
     public static final String PREFERENCE_ENTRYEDITOR_SHOW_OBJECTCLASS_ATTRIBUTES = "entryeditorShowObjectClassAttribute";
//$NON-NLS-1$
     public static final String PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES = "entryeditorShowOperationalAttributes";
//$NON-NLS-1$
+    public static final String PREFERENCE_ENTRYEDITOR_AUTOSAVE_SINGLE_TAB = "entryeditorAutoSaveSingleTab";
//$NON-NLS-1$
+    public static final String PREFERENCE_ENTRYEDITOR_AUTOSAVE_MULTI_TAB = "entryeditorAutoSaveMultiTab";
//$NON-NLS-1$
     public static final String PREFERENCE_ENTRYEDITOR_ENABLE_FOLDING = "entryeditorEnableFolding";
//$NON-NLS-1$
     public static final String PREFERENCE_ENTRYEDITOR_FOLDING_THRESHOLD = "entryeditorFoldingThreshold";
//$NON-NLS-1$
     public static final String PREFERENCE_ENTRYEDITOR_AUTO_EXPAND_FOLDED_ATTRIBUTES = "entryeditorAutoExpandFoldedAttributes";
//$NON-NLS-1$

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=821825&r1=821824&r2=821825&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
Mon Oct  5 15:04:27 2009
@@ -181,6 +181,8 @@
         store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_MUST_ATTRIBUTES,
true );
         store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_MAY_ATTRIBUTES,
true );
         store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES,
true );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTOSAVE_SINGLE_TAB,
true );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTOSAVE_MULTI_TAB,
false );
         store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_OBJECTCLASS_AND_MUST_ATTRIBUTES_FIRST,
true );
         store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_OPERATIONAL_ATTRIBUTES_LAST,
true );
         store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_DEFAULT_SORT_BY,

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=821825&r1=821824&r2=821825&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
Mon Oct  5 15:04:27 2009
@@ -56,6 +56,10 @@
 
     private Button showOperationalAttributesButton;
 
+    private Button autosaveSingleTabButton;
+
+    private Button autosaveMultiTabButton;
+
     private Button enableFoldingButton;
 
     private Label foldingThresholdLabel;
@@ -160,6 +164,20 @@
         autoExpandFoldedAttributesButton.setSelection( getPreferenceStore().getBoolean(
             BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTO_EXPAND_FOLDED_ATTRIBUTES )
);
 
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        BaseWidgetUtils.createSpacer( composite, 1 );
+        Group autosaveGroup = BaseWidgetUtils.createGroup( BaseWidgetUtils.createColumnContainer(
composite, 1, 1 ),
+            Messages.getString( "EntryEditorPreferencePage.Autosave" ), 1 ); //$NON-NLS-1$
+        Composite autosaveComposite = BaseWidgetUtils.createColumnContainer( autosaveGroup,
1, 1 );
+        autosaveSingleTabButton = BaseWidgetUtils.createCheckbox( autosaveComposite, Messages
+            .getString( "EntryEditorPreferencePage.AutosaveSingleTab" ), 1 ); //$NON-NLS-1$
+        autosaveSingleTabButton.setSelection( getPreferenceStore().getBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTOSAVE_SINGLE_TAB ) );
+        autosaveMultiTabButton = BaseWidgetUtils.createCheckbox( autosaveComposite, Messages
+            .getString( "EntryEditorPreferencePage.AutosaveMultiTab" ), 1 ); //$NON-NLS-1$
+        autosaveMultiTabButton.setSelection( getPreferenceStore().getBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTOSAVE_MULTI_TAB ) );
+
         updateEnabled();
 
         applyDialogFont( composite );
@@ -190,6 +208,11 @@
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES,
             showOperationalAttributesButton.getSelection() );
 
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTOSAVE_SINGLE_TAB,
+            autosaveSingleTabButton.getSelection() );
+        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTOSAVE_MULTI_TAB,
+            autosaveMultiTabButton.getSelection() );
+
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_ENABLE_FOLDING,
             enableFoldingButton.getSelection() );
         getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_FOLDING_THRESHOLD,
@@ -215,6 +238,11 @@
         showOperationalAttributesButton.setSelection( getPreferenceStore().getDefaultBoolean(
             BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES ) );
 
+        autosaveSingleTabButton.setSelection( getPreferenceStore().getDefaultBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTOSAVE_SINGLE_TAB ) );
+        autosaveMultiTabButton.setSelection( getPreferenceStore().getDefaultBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTOSAVE_MULTI_TAB ) );
+
         enableFoldingButton.setSelection( getPreferenceStore().getDefaultBoolean(
             BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_ENABLE_FOLDING ) );
         foldingThresholdText.setText( getPreferenceStore().getDefaultString(

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages.properties?rev=821825&r1=821824&r2=821825&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages.properties
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages.properties
Mon Oct  5 15:04:27 2009
@@ -58,9 +58,12 @@
 BrowserPreferencePage.UseAsSearchResultLabel1=Use 
 BrowserPreferencePage.UseAsSearchResultLabel2=\ as search result label
 EntryEditorPreferencePage.AutoExpandFoldedAttributes=Auto-expand folded attributes
-EntryEditorPreferencePage.EnableFolding=Enable folding
+EntryEditorPreferencePage.Autosave=Autosave modifications
+EntryEditorPreferencePage.AutosaveSingleTab=Autosave modifications in single-tab editor
+EntryEditorPreferencePage.AutosaveMultiTab=Autosave modifications in multi-tab editor
+EntryEditorPreferencePage.EnableFolding=Enable attribute folding
 EntryEditorPreferencePage.EntryEditor=Entry Editor
-EntryEditorPreferencePage.Folding=Folding
+EntryEditorPreferencePage.Folding=Attribute folding
 EntryEditorPreferencePage.FoldingThreshold=Folding threshold: 
 EntryEditorPreferencePage.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.
 EntryEditorPreferencePage.GeneralSettings=General settings for the LDAP entry editor:

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_de.properties?rev=821825&r1=821824&r2=821825&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_de.properties
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_de.properties
Mon Oct  5 15:04:27 2009
@@ -58,9 +58,12 @@
 BrowserPreferencePage.UseAsSearchResultLabel1=Benutze 
 BrowserPreferencePage.UseAsSearchResultLabel2=\ als Suchergebnisbeschriftung
 EntryEditorPreferencePage.AutoExpandFoldedAttributes=Gefaltete Attribute automatisch aufklappen
-EntryEditorPreferencePage.EnableFolding=Falten aktivieren
+EntryEditorPreferencePage.Autosave=Automatisch speichern
+EntryEditorPreferencePage.AutosaveSingleTab=\u00c4nderungen im Eintrags-Editor (einzelner
Reiter) automatisch speichern
+EntryEditorPreferencePage.AutosaveMultiTab=\u00c4nderungen im Eintrags-Editor (mehrere Reiter)
automatisch speichern
+EntryEditorPreferencePage.EnableFolding=Attributfaltung aktivieren
 EntryEditorPreferencePage.EntryEditor=Eintrags-Editor
-EntryEditorPreferencePage.Folding=Falten
+EntryEditorPreferencePage.Folding=Attributfaltung
 EntryEditorPreferencePage.FoldingThreshold=Faltgrenze: 
 EntryEditorPreferencePage.FoldingToolTip=Wenn ein Attribut mehr Werte als die angegebenen
Grenze hat, wird es gefaltet dargestellt. Die Werte k\u00F6nnen auf- und zugeklappt werden.
 EntryEditorPreferencePage.GeneralSettings=Allgemeine Einstellungen f\u00FCr den Eintrags-Editor

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_fr.properties?rev=821825&r1=821824&r2=821825&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_fr.properties
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_fr.properties
Mon Oct  5 15:04:27 2009
@@ -58,6 +58,9 @@
 BrowserPreferencePage.UseAsSearchResultLabel1=Utiliser le/la 
 BrowserPreferencePage.UseAsSearchResultLabel2=\ comme \u00E9tiquette de r\u00E9sultat de
recherche
 EntryEditorPreferencePage.AutoExpandFoldedAttributes=D\u00E9plier automatiquement les attributs
r\u00E9unis
+EntryEditorPreferencePage.Autosave=TODO:Autosave modifications
+EntryEditorPreferencePage.AutosaveSingleTab=TODO:Autosave modifications in single-tab editor
+EntryEditorPreferencePage.AutosaveMultiTab=TODO:Autosave modifications in multi-tab editor
 EntryEditorPreferencePage.EnableFolding=Activer la r\u00E9union
 EntryEditorPreferencePage.EntryEditor=Editeur d'entr\u00E9e
 EntryEditorPreferencePage.Folding=R\u00E9union

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java?rev=821825&r1=821824&r2=821825&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java
Mon Oct  5 15:04:27 2009
@@ -163,7 +163,7 @@
     {
         public void partActivated( IWorkbenchPartReference partRef )
         {
-            cleanupCopies( partRef );
+            cleanupCopies( partRef.getPage() );
 
             IEntryEditor editor = getEntryEditor( partRef );
             if ( editor != null )
@@ -222,13 +222,13 @@
 
         public void partClosed( IWorkbenchPartReference partRef )
         {
-            cleanupCopies( partRef );
+            cleanupCopies( partRef.getPage() );
         }
 
 
         public void partInputChanged( IWorkbenchPartReference partRef )
         {
-            cleanupCopies( partRef );
+            cleanupCopies( partRef.getPage() );
         }
 
 
@@ -833,6 +833,8 @@
 
     IEntry getSharedWorkingCopy( IEntry originalEntry, IEntryEditor editor )
     {
+        cleanupCopies( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
);
+
         EntryEditorUtils.ensureAttributesInitialized( originalEntry );
         if ( editor.isAutoSave() )
         {
@@ -968,12 +970,12 @@
     }
 
 
-    private void cleanupCopies( IWorkbenchPartReference partRef )
+    private void cleanupCopies( IWorkbenchPage page )
     {
         // cleanup unused copies (OSC + auto-save)
         Set<IEntry> oscEntries = new HashSet<IEntry>();
         Set<IEntry> autoSaveEntries = new HashSet<IEntry>();
-        IEditorReference[] editorReferences = partRef.getPage().getEditorReferences();
+        IEditorReference[] editorReferences = page.getEditorReferences();
         for ( IEditorReference ref : editorReferences )
         {
             IEntryEditor editor = getEntryEditor( ref );

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditor.java?rev=821825&r1=821824&r2=821825&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditor.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditor.java
Mon Oct  5 15:04:27 2009
@@ -24,6 +24,8 @@
 import org.apache.directory.studio.entryeditors.EntryEditorInput;
 import org.apache.directory.studio.entryeditors.EntryEditorUtils;
 import org.apache.directory.studio.entryeditors.IEntryEditor;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.EntryEditorWidget;
 import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
@@ -31,6 +33,7 @@
 import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
 import org.apache.directory.studio.ldapbrowser.ui.views.browser.BrowserView;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.util.IPropertyChangeListener;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridData;
@@ -77,6 +80,22 @@
     /** The outline page. */
     protected EntryEditorOutlinePage outlinePage;
 
+    IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener()
+    {
+        public void propertyChange( org.eclipse.jface.util.PropertyChangeEvent event )
+        {
+            // set the input again if the auto-save option has been changed
+            if ( event.getProperty() != null )
+            {
+                if ( event.getProperty().equals( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTOSAVE_SINGLE_TAB
)
+                    || event.getProperty().equals( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTOSAVE_MULTI_TAB
) )
+                {
+                    setInput( getEditorInput() );
+                }
+            }
+        }
+    };
+
 
     /**
      * {@inheritDoc}
@@ -85,6 +104,7 @@
     {
         setSite( site );
         setInput( input );
+        BrowserCommonActivator.getDefault().getPreferenceStore().addPropertyChangeListener(
propertyChangeListener );
     }
 
 
@@ -211,6 +231,8 @@
             configuration.dispose();
             configuration = null;
             getSite().setSelectionProvider( null );
+            BrowserCommonActivator.getDefault().getPreferenceStore().removePropertyChangeListener(
+                propertyChangeListener );
         }
 
         super.dispose();
@@ -388,7 +410,7 @@
         {
             // set input, remember old selection and set it afterwards
             ISelection selection = mainWidget.getViewer().getSelection();
-            universalListener.setInput( getEntryEditorInput().getSharedWorkingCopy( this
) );
+            universalListener.setInput( eei.getSharedWorkingCopy( this ) );
             mainWidget.getViewer().setSelection( selection );
         }
     }

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java?rev=821825&r1=821824&r2=821825&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java
Mon Oct  5 15:04:27 2009
@@ -68,6 +68,9 @@
     /** The show operational attributes action. */
     private ShowOperationalAttributesAction showOperationalAttributesAction;
 
+    /** The toggle auto save action */
+    private ToggleAutosaveAction toggleAutosaveAction;
+    
     /** The open entry value editor action. */
     private EntryEditorActionProxy openEntryValueEditorActionProxy;
 
@@ -176,6 +179,7 @@
                 .getValueEditorManager( viewer ).getEntryValueEditor(), this ) );
 
         showOperationalAttributesAction = new ShowOperationalAttributesAction();
+        toggleAutosaveAction = new ToggleAutosaveAction( entryEditor );
         openEntryEditorPreferencePage = new OpenEntryEditorPreferencePageAction();
         collapseAllAction = new CollapseAllAction( viewer );
         expandAllAction = new ExpandAllAction( viewer );
@@ -246,6 +250,7 @@
             openEntryValueEditorActionProxy = null;
             openEntryEditorPreferencePage = null;
             showOperationalAttributesAction = null;
+            toggleAutosaveAction = null;
             expandAllAction.dispose();
             expandAllAction = null;
             collapseAllAction.dispose();
@@ -288,6 +293,8 @@
         menuManager.add( showOperationalAttributesAction );
         menuManager.add( showDecoratedValuesAction );
         menuManager.add( new Separator() );
+        menuManager.add( toggleAutosaveAction );
+        menuManager.add( new Separator() );
         menuManager.add( openEntryEditorPreferencePage );
         menuManager.addMenuListener( new IMenuListener()
         {
@@ -297,6 +304,7 @@
                     .getBoolean( BrowserCommonConstants.PREFERENCE_SHOW_RAW_VALUES ) );
                 showOperationalAttributesAction.setChecked( BrowserCommonActivator.getDefault().getPreferenceStore()
                     .getBoolean( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES
) );
+                toggleAutosaveAction.updateSetChecked();
             }
         } );
         menuManager.update( true );

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabEntryEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabEntryEditor.java?rev=821825&r1=821824&r2=821825&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabEntryEditor.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabEntryEditor.java
Mon Oct  5 15:04:27 2009
@@ -21,6 +21,8 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.entry;
 
 
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
 
 
@@ -50,7 +52,8 @@
 
     public boolean isAutoSave()
     {
-        return false;
+        return BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTOSAVE_MULTI_TAB );
     }
 
 }

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditor.java?rev=821825&r1=821824&r2=821825&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditor.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditor.java
Mon Oct  5 15:04:27 2009
@@ -21,6 +21,8 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.entry;
 
 
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
 
 
@@ -46,7 +48,8 @@
 
     public boolean isAutoSave()
     {
-        return true;
+        return BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTOSAVE_SINGLE_TAB );
     }
 
 }

Added: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/ToggleAutosaveAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/ToggleAutosaveAction.java?rev=821825&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/ToggleAutosaveAction.java
(added)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/ToggleAutosaveAction.java
Mon Oct  5 15:04:27 2009
@@ -0,0 +1,79 @@
+/*
+ *  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.ui.editors.entry;
+
+
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
+import org.eclipse.jface.action.Action;
+
+
+/**
+ * This action is used to toggle the "auto-save" preference.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ToggleAutosaveAction extends Action
+{
+
+    private EntryEditor entryEditor;
+
+
+    /**
+     * Creates a new instance of ToggleAutosaveAction.
+     */
+    public ToggleAutosaveAction( EntryEditor entryEditor )
+    {
+        super( Messages.getString( "ToggleAutosaveAction.Autosave" ), AS_CHECK_BOX ); //$NON-NLS-1$
+        setToolTipText( getText() );
+        setEnabled( true );
+        this.entryEditor = entryEditor;
+    }
+
+
+    @Override
+    public void run()
+    {
+        BrowserCommonActivator.getDefault().getPreferenceStore().setValue( getConstant(),
super.isChecked() );
+    }
+
+
+    private String getConstant()
+    {
+        boolean multiTab = entryEditor.getEntryEditorInput().getExtension().isMultiWindow();
+        if ( multiTab )
+        {
+            return BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTOSAVE_MULTI_TAB;
+        }
+        else
+        {
+            return BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTOSAVE_SINGLE_TAB;
+        }
+    }
+
+
+    public void updateSetChecked()
+    {
+        setChecked( BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean(
getConstant() ) );
+    }
+
+}

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages.properties?rev=821825&r1=821824&r2=821825&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages.properties
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages.properties
Mon Oct  5 15:04:27 2009
@@ -15,6 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
+ToggleAutosaveAction.Autosave=Autosave
 EntryEditorActionGroup.Advanced=Advanced
 EntryEditorActionGroup.OpenSchemaBrowser=Open Schema Browser
 EntryEditorActionGroup.ShowIn=Show In

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_de.properties?rev=821825&r1=821824&r2=821825&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_de.properties
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_de.properties
Mon Oct  5 15:04:27 2009
@@ -15,6 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
+ToggleAutosaveAction.Autosave=Automatisch speichern
 EntryEditorActionGroup.Advanced=Erweitert
 EntryEditorActionGroup.OpenSchemaBrowser=\u00D6ffne Schema Browser
 EntryEditorActionGroup.ShowIn=Anzeigen in

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_fr.properties?rev=821825&r1=821824&r2=821825&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_fr.properties
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_fr.properties
Mon Oct  5 15:04:27 2009
@@ -15,6 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
+ToggleAutosaveAction.Autosave=TODO:Autosave
 EntryEditorActionGroup.Advanced=Avanc\u00E9
 EntryEditorActionGroup.OpenSchemaBrowser=Ouvrir le navigateur de sch\u00E9ma
 EntryEditorActionGroup.ShowIn=Afficher dans



Mime
View raw message