directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r796811 - in /directory/studio/trunk: connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dialogs/ valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/
Date Wed, 22 Jul 2009 17:48:49 GMT
Author: pamarcelot
Date: Wed Jul 22 17:48:49 2009
New Revision: 796811

URL: http://svn.apache.org/viewvc?rev=796811&view=rev
Log:
Fix for DIRSTUDIO-504 (Timestamp attribute with an invalid time in it is read only - editor
ignores entry).

Modified:
    directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dialogs/messages_fr.properties
    directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/GeneralizedTimeValueEditor.java
    directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/messages.properties
    directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/messages_de.properties
    directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/messages_fr.properties

Modified: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dialogs/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dialogs/messages_fr.properties?rev=796811&r1=796810&r2=796811&view=diff
==============================================================================
--- directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dialogs/messages_fr.properties
(original)
+++ directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dialogs/messages_fr.properties
Wed Jul 22 17:48:49 2009
@@ -24,7 +24,7 @@
 CertificateTrustDialog.CertificateNotYetValid=- Le certificat n'est pas encore valide
 CertificateTrustDialog.CertificateExpired=- Le certificat a expir\u00E9
 CertificateTrustDialog.SelfSignedCertificate=- Le certificat est auto-sign\u00E9
-CertificateTrustDialog.HostnameVerificationFailed=- Le nom d'hôte du server ne correspond
pas au nom d'hôte du certificat
+CertificateTrustDialog.HostnameVerificationFailed=- Le nom d'h\u00F4te du server ne correspond
pas au nom d'h\u00F4te du certificat
 CertificateTrustDialog.ChooseTrustLevel=Veuillez examiner le certificat et choisissez si
vous souhaitez lui faire confiance:
 CertificateTrustDialog.ViewCertificate=Afficher le certificat...
 CertificateTrustDialog.DoNotTrust=Ne pas faire confiance \u00E0 ce certificat.

Modified: directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/GeneralizedTimeValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/GeneralizedTimeValueEditor.java?rev=796811&r1=796810&r2=796811&view=diff
==============================================================================
--- directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/GeneralizedTimeValueEditor.java
(original)
+++ directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/GeneralizedTimeValueEditor.java
Wed Jul 22 17:48:49 2009
@@ -23,13 +23,17 @@
 
 import java.text.DateFormat;
 import java.text.ParseException;
+import java.util.Calendar;
 import java.util.Date;
 
 import org.apache.directory.shared.ldap.util.GeneralizedTime;
 import org.apache.directory.studio.ldapbrowser.common.dialogs.TextDialog;
 import org.apache.directory.studio.ldapbrowser.core.model.IValue;
 import org.apache.directory.studio.valueeditors.AbstractDialogStringValueEditor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
 
 
 /**
@@ -83,22 +87,42 @@
         if ( value != null && value instanceof String )
         {
             String s = ( String ) value;
+
+            // Trying to parse the value
+            GeneralizedTime generalizedTime = null;
             try
             {
-                GeneralizedTime generalizedTime = "".equals( s ) ? null : new GeneralizedTime(
s ); //$NON-NLS-1$
-                GeneralizedTimeValueDialog dialog = new GeneralizedTimeValueDialog( shell,
generalizedTime );
-                if ( dialog.open() == TextDialog.OK )
-                {
-                    setValue( dialog.getGeneralizedTime().toGeneralizedTime() );
-                    return true;
-                }
+                generalizedTime = "".equals( s ) ? null : new GeneralizedTime( s ); //$NON-NLS-1$
             }
             catch ( ParseException pe )
             {
-                return false;
+                // The value could not be parsed correctly
+
+                // Displaying an error window indicating to the user that the value is bogus
+                // and asking him if he wants to continue to edit the value with current
date and time selected
+                if ( MessageDialog.openConfirm( PlatformUI.getWorkbench().getDisplay().getActiveShell(),
Messages
+                    .getString( "GeneralizedTimeValueEditor.BogusDateAndTimeValue" ), NLS.bind(
//$NON-NLS-1$
+                    Messages.getString( "GeneralizedTimeValueEditor.TheValueIsBogus" ), new
String[] //$NON-NLS-1$
+                    { s } ) ) )
+                {
+                    // Generating today's date and time
+                    generalizedTime = new GeneralizedTime( Calendar.getInstance() );
+                }
+                else
+                {
+                    return false;
+                }
             }
 
+            // Creating and opening the dialog
+            GeneralizedTimeValueDialog dialog = new GeneralizedTimeValueDialog( shell, generalizedTime
);
+            if ( dialog.open() == TextDialog.OK )
+            {
+                setValue( dialog.getGeneralizedTime().toGeneralizedTime() );
+                return true;
+            }
         }
+
         return false;
     }
 }

Modified: directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/messages.properties?rev=796811&r1=796810&r2=796811&view=diff
==============================================================================
--- directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/messages.properties
(original)
+++ directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/messages.properties
Wed Jul 22 17:48:49 2009
@@ -20,3 +20,5 @@
 GeneralizedTimeValueDialog.RawValue=Raw value:
 GeneralizedTimeValueDialog.Time=Time:
 GeneralizedTimeValueDialog.Timezone=Time zone:
+GeneralizedTimeValueEditor.BogusDateAndTimeValue=Bogus Date & Time Value
+GeneralizedTimeValueEditor.TheValueIsBogus=The value ''{0}'' is bogus and cannot be edited
in the Date and Time Editor.\n\nWould you like to open the Date and Time Editor with today's
date and time ?\n\n\nNote: To edit the bogus value, you can use the In-Place Text Editor.

Modified: directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/messages_de.properties?rev=796811&r1=796810&r2=796811&view=diff
==============================================================================
--- directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/messages_de.properties
(original)
+++ directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/messages_de.properties
Wed Jul 22 17:48:49 2009
@@ -20,3 +20,5 @@
 GeneralizedTimeValueDialog.RawValue=Unbearbeiteter Wert\:
 GeneralizedTimeValueDialog.Time=Zeit\:
 GeneralizedTimeValueDialog.Timezone=Zeitzone\:
+GeneralizedTimeValueEditor.BogusDateAndTimeValue=TODO:Bogus Date & Time Value
+GeneralizedTimeValueEditor.TheValueIsBogus=TODO:The value ''{0}'' is bogus and cannot be
edited in the Date and Time Editor.\n\nWould you like to open the Date and Time Editor with
today's date and time ?\n\n\nNote: To edit the bogus value, you can use the In-Place Text
Editor.

Modified: directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/messages_fr.properties?rev=796811&r1=796810&r2=796811&view=diff
==============================================================================
--- directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/messages_fr.properties
(original)
+++ directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/time/messages_fr.properties
Wed Jul 22 17:48:49 2009
@@ -20,3 +20,5 @@
 GeneralizedTimeValueDialog.RawValue=Valeur brute:
 GeneralizedTimeValueDialog.Time=Heure:
 GeneralizedTimeValueDialog.Timezone=Fuseau horaire:
+GeneralizedTimeValueEditor.BogusDateAndTimeValue=Valeur de date et heure erron\u00E9e
+GeneralizedTimeValueEditor.TheValueIsBogus=La valeur ''{0}'' est erron\u00E9e et ne peut
pas \u00EAtre \u00E9dit\u00E9e dans l''\u00E9diteur de date et heure.\n\nVoulez-vous ouvrir
l''\u00E9diteur de date et heure avec la date et l''heure d''aujourd''hui ?\n\n\nNote: Pour
\u00E9diter la valeur erron\u00E9e, vous pouvez utiliser l''\u00E9diteur de texte en-place.



Mime
View raw message