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/10/12 16:32:33 UTC
svn commit: r1397581 -
/directory/studio/trunk/plugins/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/integer/IntegerValueEditor.java
Author: pamarcelot
Date: Fri Oct 12 14:32:33 2012
New Revision: 1397581
URL: http://svn.apache.org/viewvc?rev=1397581&view=rev
Log:
Fix for DIRSTUDIO-823 (Integer Value Editor only selects values of Java Integer magnitude).
Modified:
directory/studio/trunk/plugins/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/integer/IntegerValueEditor.java
Modified: directory/studio/trunk/plugins/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/integer/IntegerValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/integer/IntegerValueEditor.java?rev=1397581&r1=1397580&r2=1397581&view=diff
==============================================================================
--- directory/studio/trunk/plugins/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/integer/IntegerValueEditor.java (original)
+++ directory/studio/trunk/plugins/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/integer/IntegerValueEditor.java Fri Oct 12 14:32:33 2012
@@ -21,6 +21,8 @@
package org.apache.directory.studio.valueeditors.integer;
+import java.math.BigDecimal;
+
import org.apache.directory.studio.valueeditors.AbstractDialogStringValueEditor;
import org.eclipse.swt.widgets.Shell;
@@ -32,7 +34,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class IntegerValueEditor extends AbstractDialogStringValueEditor
{
-
/**
* {@inheritDoc}
*
@@ -41,27 +42,34 @@ public class IntegerValueEditor extends
public boolean openDialog( Shell shell )
{
Object value = getValue();
+
if ( value != null && value instanceof String )
{
- String stringValue = ( String ) value;
- int intValue;
+ BigDecimal integer = null;
boolean isNewOrMalformedValue = false;
+
try
{
- intValue = Integer.valueOf( stringValue );
+ integer = new BigDecimal( ( String ) value );
}
catch ( NumberFormatException e )
{
- intValue = 0;
+ integer = new BigDecimal( 0 );
isNewOrMalformedValue = true;
}
- IntegerDialog dialog = new IntegerDialog( shell, intValue );
+
+ IntegerDialog dialog = new IntegerDialog( shell, integer );
if ( dialog.open() == IntegerDialog.OK && ( dialog.isDirty() || isNewOrMalformedValue ) )
{
- setValue( Integer.toString( dialog.getInteger() ) );
- return true;
+ BigDecimal newValue = dialog.getInteger();
+ if ( newValue != null )
+ {
+ setValue( newValue.toString() );
+ return true;
+ }
}
}
+
return false;
}
}