directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r524083 - in /directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas: ./ controller/ controller/actions/ model/
Date Fri, 30 Mar 2007 13:43:23 GMT
Author: pamarcelot
Date: Fri Mar 30 06:43:22 2007
New Revision: 524083

URL: http://svn.apache.org/viewvc?view=rev&rev=524083
Log:
Added a preferences entry for Open and Save File Dialog that saves the last path used.

Modified:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/PluginConstants.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PreferenceInitializer.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/ExportSchemaForADSAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenLocalFileAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/Schema.java

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/PluginConstants.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/PluginConstants.java?view=diff&rev=524083&r1=524082&r2=524083
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/PluginConstants.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/PluginConstants.java
Fri Mar 30 06:43:22 2007
@@ -221,6 +221,13 @@
     public static final String PREFS_SCHEMAS_EDITOR_COMPANY_OID = Activator.PLUGIN_ID
         + ".preferences.SchemasEditor.companyOID"; //$NON-NLS-1$
 
+    /** The preference ID for Open File Dialog path */
+    public static final String PREFS_OPEN_FILE_DIALOG = Activator.PLUGIN_ID + ".preferences.OpenFileDialog";
//$NON-NLS-1$
+
+    /** The preference ID for Save File Dialog path */
+    public static final String PREFS_SAVE_FILE_DIALOG = Activator.PLUGIN_ID + ".preferences.SaveFileDialog";
//$NON-NLS-1$
+    
+
     // Images - Actions
     public static final String IMG_CREATE_A_NEW_ATTRIBUTETYPE = "ressources/icons/attribute_type_new.gif";
//$NON-NLS-1$
     public static final String IMG_CREATE_A_NEW_OBJECTCLASS = "ressources/icons/object_class_new.gif";
//$NON-NLS-1$

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PreferenceInitializer.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PreferenceInitializer.java?view=diff&rev=524083&r1=524082&r2=524083
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PreferenceInitializer.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PreferenceInitializer.java
Fri Mar 30 06:43:22 2007
@@ -41,6 +41,10 @@
     {
         IPreferenceStore store = Activator.getDefault().getPreferenceStore();
 
+        // Open and Save File Dialogs
+        store.setDefault( PluginConstants.PREFS_OPEN_FILE_DIALOG, System.getProperty( "user.home"
) ); //$NON-NLS-1$
+        store.setDefault( PluginConstants.PREFS_SAVE_FILE_DIALOG, System.getProperty( "user.home"
) ); //$NON-NLS-1$
+
         // Schemas Editor Preference Page
         store.setDefault( PluginConstants.PREFS_SCHEMAS_EDITOR_SPECIFIC_CORE, false );
         store.setDefault( PluginConstants.PREFS_SCHEMAS_EDITOR_SPECIFIC_CORE_DIRECTORY, System

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/ExportSchemaForADSAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/ExportSchemaForADSAction.java?view=diff&rev=524083&r1=524082&r2=524083
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/ExportSchemaForADSAction.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/ExportSchemaForADSAction.java
Fri Mar 30 06:43:22 2007
@@ -97,7 +97,8 @@
                 FileDialog fd = new FileDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                     SWT.SAVE );
                 fd.setText( "Select a file" );
-                fd.setFilterPath( System.getProperty( "user.home" ) ); //$NON-NLS-1$
+                fd.setFilterPath( Activator.getDefault().getPreferenceStore().getString(
+                    PluginConstants.PREFS_SAVE_FILE_DIALOG ) );
                 fd.setFileName( schema.getName() + ".ldif" ); //$NON-NLS-1$
                 fd.setFilterExtensions( new String[]
                     { "*.ldif", "*.*" } ); //$NON-NLS-1$ //$NON-NLS-2$
@@ -300,6 +301,9 @@
                     // Export Successful
                     ViewUtils.displayInformationMessageBox( "Export Successful",
                         "The schema has been sucessfully exported." );
+
+                    Activator.getDefault().getPreferenceStore().putValue( PluginConstants.PREFS_SAVE_FILE_DIALOG,
+                        selectedFile.getParent() );
                 }
             }
         }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenLocalFileAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenLocalFileAction.java?view=diff&rev=524083&r1=524082&r2=524083
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenLocalFileAction.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenLocalFileAction.java
Fri Mar 30 06:43:22 2007
@@ -21,6 +21,8 @@
 package org.apache.directory.ldapstudio.schemas.controller.actions;
 
 
+import java.io.File;
+
 import org.apache.directory.ldapstudio.schemas.Activator;
 import org.apache.directory.ldapstudio.schemas.Messages;
 import org.apache.directory.ldapstudio.schemas.PluginConstants;
@@ -63,7 +65,8 @@
     {
         FileDialog fd = new FileDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
SWT.OPEN );
         fd.setText( Messages.getString( "OpenLocalFileAction.Open_a_schema_file" ) ); //$NON-NLS-1$
-        fd.setFilterPath( System.getProperty( "user.home" ) ); //$NON-NLS-1$
+        fd.setFilterPath( Activator.getDefault().getPreferenceStore()
+            .getString( PluginConstants.PREFS_OPEN_FILE_DIALOG ) );
         String[] filterExt =
             { "*.schema", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$
         fd.setFilterExtensions( filterExt );
@@ -80,6 +83,9 @@
             {
                 logger.debug( "Error when opening a schema file" ); //$NON-NLS-1$
             }
+
+            Activator.getDefault().getPreferenceStore().putValue( PluginConstants.PREFS_OPEN_FILE_DIALOG,
+                new File( selected ).getParent() );
         }
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/Schema.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/Schema.java?view=diff&rev=524083&r1=524082&r2=524083
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/Schema.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/Schema.java
Fri Mar 30 06:43:22 2007
@@ -32,7 +32,9 @@
 import java.util.Hashtable;
 import java.util.Set;
 
+import org.apache.directory.ldapstudio.schemas.Activator;
 import org.apache.directory.ldapstudio.schemas.Messages;
+import org.apache.directory.ldapstudio.schemas.PluginConstants;
 import org.apache.directory.ldapstudio.schemas.io.SchemaParser;
 import org.apache.directory.ldapstudio.schemas.io.SchemaWriter;
 import org.apache.directory.server.core.tools.schema.AttributeTypeLiteral;
@@ -575,7 +577,8 @@
         {
             FileDialog fd = new FileDialog( new Shell(), SWT.SAVE );
             fd.setText( Messages.getString( "Schema.Save_this_schema" ) + this.getName()
); //$NON-NLS-1$
-            fd.setFilterPath( System.getProperty( "user.home" ) ); //$NON-NLS-1$
+            fd.setFilterPath( Activator.getDefault().getPreferenceStore().getString(
+                PluginConstants.PREFS_SAVE_FILE_DIALOG ) );
             fd.setFileName( this.name + ".schema" ); //$NON-NLS-1$
             fd.setFilterExtensions( new String[]
                 { "*.schema", "*.*" } ); //$NON-NLS-1$ //$NON-NLS-2$
@@ -595,6 +598,8 @@
             //when we have been written, we are synchronised with the filesystem
             this.saved();
             notifyChanged( LDAPModelEvent.Reason.SchemaSaved, this, null );
+            Activator.getDefault().getPreferenceStore().putValue( PluginConstants.PREFS_SAVE_FILE_DIALOG,
+                new File( savePath ).getParent() );
         }
     }
 
@@ -619,7 +624,8 @@
 
         FileDialog fd = new FileDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
SWT.SAVE );
         fd.setText( Messages.getString( "Schema.Save_this_schema" ) + this.getName() ); //$NON-NLS-1$
-        fd.setFilterPath( System.getProperty( "user.home" ) ); //$NON-NLS-1$
+        fd.setFilterPath( Activator.getDefault().getPreferenceStore()
+            .getString( PluginConstants.PREFS_SAVE_FILE_DIALOG ) );
         fd.setFileName( this.name + ".schema" ); //$NON-NLS-1$
         fd.setFilterExtensions( new String[]
             { "*.schema", "*.*" } ); //$NON-NLS-1$ //$NON-NLS-2$
@@ -634,7 +640,6 @@
             //if it's a bad url (no .schema, bad path) newName will be null
             if ( newName != null )
             {
-
                 if ( SchemaPool.getInstance().getSchema( newName ) != null )
                 {
                     MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow()
@@ -652,6 +657,8 @@
                 //when we have been written, we are synchronised with the filesystem
                 this.saved();
                 notifyChanged( LDAPModelEvent.Reason.SchemaSaved, this, null );
+                Activator.getDefault().getPreferenceStore().putValue( PluginConstants.PREFS_SAVE_FILE_DIALOG,
+                    new File( newName ).getParent() );
             }
         }
     }



Mime
View raw message