directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1057281 - /directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java
Date Mon, 10 Jan 2011 17:00:16 GMT
Author: pamarcelot
Date: Mon Jan 10 17:00:16 2011
New Revision: 1057281

URL: http://svn.apache.org/viewvc?rev=1057281&view=rev
Log:
Fixed "Save As..." option depending on the kind of the original input.

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

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java?rev=1057281&r1=1057280&r2=1057281&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java
Mon Jan 10 17:00:16 2011
@@ -323,7 +323,7 @@ public class ServerConfigurationEditor e
                     try
                     {
                         monitor
-                            .beginTask( "Saving The Server Configuration", IProgressMonitor.UNKNOWN
);
+                            .beginTask( "Saving Server Configuration", IProgressMonitor.UNKNOWN
);
                         boolean success = doSaveAs( monitor );
                         setDirty( !success );
                         monitor.done();
@@ -342,7 +342,6 @@ public class ServerConfigurationEditor e
         }
     }
 
-
     /**
      * Performs the "Save as..." action.
      *
@@ -360,11 +359,35 @@ public class ServerConfigurationEditor e
         {
             // Asking the user for the location where to 'save as' the file
             SaveAsDialog dialog = new SaveAsDialog( getSite().getShell() );
-            if ( !( getEditorInput() instanceof NewServerConfigurationInput ) )
+
+            IEditorInput input = getEditorInput();
+            String inputClassName = input.getClass().getName();
+            if ( input instanceof FileEditorInput )
+            // FileEditorInput class is used when the file is opened
+            // from a project in the workspace.
             {
-                dialog.setOriginalFile( ResourcesPlugin.getWorkspace().getRoot().getFile(
-                    new Path( getEditorInput().getToolTipText() ) ) );
+                dialog.setOriginalFile( ( ( FileEditorInput ) input ).getFile() );
             }
+            else if ( input instanceof IPathEditorInput )
+            {
+                dialog.setOriginalFile( ResourcesPlugin.getWorkspace().getRoot()
+                    .getFile( ( ( IPathEditorInput ) input ).getPath() ) );
+            }
+            else if ( inputClassName.equals( "org.eclipse.ui.internal.editors.text.JavaFileEditorInput"
) //$NON-NLS-1$
+                || inputClassName.equals( "org.eclipse.ui.ide.FileStoreEditorInput" ) ) //$NON-NLS-1$
+            // The class 'org.eclipse.ui.internal.editors.text.JavaFileEditorInput'
+            // is used when opening a file from the menu File > Open... in Eclipse 3.2.x
+            // The class 'org.eclipse.ui.ide.FileStoreEditorInput' is used when
+            // opening a file from the menu File > Open... in Eclipse 3.3.x
+            {
+                dialog.setOriginalFile( ResourcesPlugin.getWorkspace().getRoot()
+                    .getFile( new Path( input.getToolTipText() ) ) );
+            }
+            else
+            {
+                dialog.setOriginalName( "config.ldif" );
+            }
+
             if ( dialog.open() != Dialog.OK )
             {
                 return false;



Mime
View raw message