You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2012/04/30 14:38:00 UTC
svn commit: r1332175 - in
/directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor:
ExecuteLdifAction.java LdifEditor.java messages.properties
messages_de.properties messages_fr.properties
Author: pamarcelot
Date: Mon Apr 30 12:38:00 2012
New Revision: 1332175
URL: http://svn.apache.org/viewvc?rev=1332175&view=rev
Log:
Fix for DIRSTUDIO-809 (Improve the behavior of the "Execute LDIF" action of the LDIF Editor).
Modified:
directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/ExecuteLdifAction.java
directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java
directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/messages.properties
directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/messages_de.properties
directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/messages_fr.properties
Modified: directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/ExecuteLdifAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/ExecuteLdifAction.java?rev=1332175&r1=1332174&r2=1332175&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/ExecuteLdifAction.java (original)
+++ directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/ExecuteLdifAction.java Mon Apr 30 12:38:00 2012
@@ -21,6 +21,7 @@
package org.apache.directory.studio.ldifeditor.editor;
+import org.apache.directory.studio.ldapbrowser.common.dialogs.SelectBrowserConnectionDialog;
import org.apache.directory.studio.ldapbrowser.core.jobs.ExecuteLdifRunnable;
import org.apache.directory.studio.ldapbrowser.core.jobs.StudioBrowserJob;
import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
@@ -37,6 +38,7 @@ import org.eclipse.jface.preference.IPre
*/
public class ExecuteLdifAction extends Action
{
+ /** The LDIF Editor */
private LdifEditor editor;
@@ -61,6 +63,31 @@ public class ExecuteLdifAction extends A
public void run()
{
IBrowserConnection connection = editor.getConnection();
+
+ // Checking if we already have a connection
+ if ( connection == null )
+ {
+ // Requesting the user to select a connection
+ SelectBrowserConnectionDialog dialog = new SelectBrowserConnectionDialog( editor.getSite().getShell(),
+ Messages.getString( "ExecuteLdifAction.SelectConnection" ), null ); //$NON-NLS-1$
+ if ( dialog.open() == SelectBrowserConnectionDialog.OK )
+ {
+ connection = dialog.getSelectedBrowserConnection();
+
+ if ( connection != null )
+ {
+ editor.setConnection( connection, true );
+ }
+ }
+
+ // Checking a second time if we have a connection
+ if ( connection == null )
+ {
+ return;
+ }
+ }
+
+
String ldif = editor.getLdifModel().toRawString();
IPreferenceStore preferenceStore = LdifEditorActivator.getDefault().getPreferenceStore();
@@ -81,6 +108,6 @@ public class ExecuteLdifAction extends A
*/
public boolean isEnabled()
{
- return editor != null && editor.getConnection() != null;
+ return editor != null;
}
}
Modified: directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java?rev=1332175&r1=1332174&r2=1332175&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java (original)
+++ directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java Mon Apr 30 12:38:00 2012
@@ -593,18 +593,24 @@ public class LdifEditor extends TextEdit
*/
protected void setConnection( IBrowserConnection browserConnection )
{
+ setConnection( browserConnection, false );
+ }
+
+
+ /**
+ * Sets the Connection
+ *
+ * @param browserConnection the browser connection to set
+ * @param updateBrowserConnectionWidget the flag indicating if the browser connection widget
+ * should be updated
+ */
+ protected void setConnection( IBrowserConnection browserConnection, boolean updateBrowserConnectionWidget )
+ {
this.browserConnection = browserConnection;
- getEditorSite().getActionBars().getStatusLineManager().setMessage(
- Messages.getString( "LdifEditor.UsedConnection" ) //$NON-NLS-1$
- + ( browserConnection == null || browserConnection.getConnection() == null ? "-" : browserConnection //$NON-NLS-1$
- .getConnection().getName() ) );
- // getStatusField("ldapconnection").setText();
- IAction action = getAction( LdifEditorConstants.ACTION_ID_EXECUTE_LDIF );
- if ( action != null )
+ if ( updateBrowserConnectionWidget && ( browserConnectionWidget != null ) )
{
- action.setEnabled( browserConnection == null );
- action.setEnabled( browserConnection != null );
+ browserConnectionWidget.setBrowserConnection( browserConnection );
}
}
@@ -755,7 +761,8 @@ public class LdifEditor extends TextEdit
final File externalFile = new File( path );
if ( externalFile.exists() )
{
- MessageDialog overwriteDialog = new MessageDialog( shell,
+ MessageDialog overwriteDialog = new MessageDialog(
+ shell,
Messages.getString( "LdifEditor.Overwrite" ), null, Messages.getString( "LdifEditor.OverwriteQuestion" ), //$NON-NLS-1$ //$NON-NLS-2$
MessageDialog.WARNING, new String[]
{ IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1 ); // 'No' is the default
Modified: directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/messages.properties?rev=1332175&r1=1332174&r2=1332175&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/messages.properties (original)
+++ directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/messages.properties Mon Apr 30 12:38:00 2012
@@ -16,6 +16,7 @@
# under the License.
ExecuteLdifAction.ExecuteLDIF=Execute LDIF
+ExecuteLdifAction.SelectConnection=Select Connection
LdifEditor.Overwrite=Overwrite
LdifEditor.OverwriteQuestion=Overwrite?
LdifEditor.ErrorInSaveAs=Error in Save As...
Modified: directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/messages_de.properties?rev=1332175&r1=1332174&r2=1332175&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/messages_de.properties (original)
+++ directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/messages_de.properties Mon Apr 30 12:38:00 2012
@@ -16,6 +16,7 @@
# under the License.
ExecuteLdifAction.ExecuteLDIF=LDIF ausf\u00FChren
+ExecuteLdifAction.SelectConnection=Verbindung ausw\u00E4hlen
LdifEditor.Overwrite=\u00DCberschreiben
LdifEditor.OverwriteQuestion=\u00DCberschreiben?
LdifEditor.ErrorInSaveAs=Fehler bei Speichern als...
Modified: directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/messages_fr.properties?rev=1332175&r1=1332174&r2=1332175&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/messages_fr.properties (original)
+++ directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/messages_fr.properties Mon Apr 30 12:38:00 2012
@@ -16,6 +16,7 @@
# under the License.
ExecuteLdifAction.ExecuteLDIF=Executer LDIF
+ExecuteLdifAction.SelectConnection=Selectionnez une connexion
LdifEditor.Overwrite=Ecraser
LdifEditor.OverwriteQuestion=Ecraser ?
LdifEditor.ErrorInSaveAs=Erreur lors de Enregistrer sous...