directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r607031 - /directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java
Date Thu, 27 Dec 2007 10:20:23 GMT
Author: pamarcelot
Date: Thu Dec 27 02:20:23 2007
New Revision: 607031

URL: http://svn.apache.org/viewvc?rev=607031&view=rev
Log:
Part of a fix for DIRSTUDIO-236 (Update the Apache DS Configuration plugin to work with the
server.xml file of Apache DS 1.5.1).
Improved Save Panel when in RCP mode.

Modified:
    directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java

Modified: directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java?rev=607031&r1=607030&r2=607031&view=diff
==============================================================================
--- directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java
(original)
+++ directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java
Thu Dec 27 02:20:23 2007
@@ -47,7 +47,6 @@
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.window.Window;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.FileDialog;
 import org.eclipse.swt.widgets.MessageBox;
@@ -399,26 +398,44 @@
         else
         {
             Shell shell = getSite().getShell();
+            boolean canOverwrite = false;
+            String path = null;
 
-            // Open FileDialog
-            FileDialog dialog = new FileDialog( shell, SWT.SAVE );
-
-            String path = dialog.open();
-            if ( path == null )
+            while ( !canOverwrite )
             {
-                return false;
-            }
-
-            // Check whether file exists and if so, confirm overwrite
-            final File externalFile = new File( path );
-            if ( externalFile.exists() )
-            {
-                MessageDialog overwriteDialog = new MessageDialog( shell, "Overwrite", null,
"Overwrite?",
-                    MessageDialog.WARNING, new String[]
-                        { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1 ); //
'No' is the default
-                if ( overwriteDialog.open() != Window.OK )
+                // Open FileDialog
+                FileDialog dialog = new FileDialog( shell, SWT.SAVE );
+                path = dialog.open();
+                if ( path == null )
                 {
                     return false;
+                }
+
+                // Check whether file exists and if so, confirm overwrite
+                final File externalFile = new File( path );
+                if ( externalFile.exists() )
+                {
+                    String question = "The file '" + path
+                        + "' already exists. Do you want to replace the existing file?";
+                    MessageDialog overwriteDialog = new MessageDialog( shell, "Question",
null, question,
+                        MessageDialog.QUESTION, new String[]
+                            { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL
}, 0 );
+                    int overwrite = overwriteDialog.open();
+                    switch ( overwrite )
+                    {
+                        case 0: // Yes
+                            canOverwrite = true;
+                            break;
+                        case 1: // No
+                            break;
+                        case 2: // Cancel
+                        default:
+                            return false;
+                    }
+                }
+                else
+                {
+                    canOverwrite = true;
                 }
             }
 



Mime
View raw message