1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-02 22:55:26 +02:00

[160776] use ICU4J to format file sizes

This commit is contained in:
David Dykstal 2007-06-02 14:54:30 +00:00
parent aa3e275484
commit ce2e9075db
2 changed files with 12 additions and 4 deletions

View file

@ -15,6 +15,7 @@
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* David Dykstal (IBM) - [160776] format file size according to client system conventions and locale
********************************************************************************/
package org.eclipse.rse.internal.files.ui.propertypages;
@ -57,6 +58,7 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.ide.IDEEncoding;
import com.ibm.icu.text.DateFormat;
import com.ibm.icu.text.NumberFormat;
/**
@ -396,8 +398,11 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
labelPath.setText(file.getParentPath());
}
// size
if (labelSize != null)
labelSize.setText(Long.toString(file.getLength()));
if (labelSize != null) {
NumberFormat fmt = NumberFormat.getIntegerInstance();
String formattedNumber = fmt.format(file.getLength());
labelSize.setText(formattedNumber);
}
// modified
if (labelModified != null)
{

View file

@ -23,11 +23,11 @@
* Martin Oberhuber (Wind River) - [186997] No deferred queries in Local Files
* Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core
* Xuan Chen (IBM) - [180671] [refresh] It is not possible to refresh editor with double clicking on it
* David Dykstal (IBM) - [160776] format file size according to client system conventions and locale
********************************************************************************/
package org.eclipse.rse.internal.files.ui.view;
import java.io.File;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
@ -143,6 +143,7 @@ import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.PropertyDescriptor;
import com.ibm.icu.text.DateFormat;
import com.ibm.icu.text.NumberFormat;
/**
* Adapter for displaying remote file system objects in tree views.
@ -1185,7 +1186,9 @@ public class SystemViewRemoteFileAdapter
{
if (formatted)
{
return sub(xlatedSize, MSG_SUB1, Long.toString(file.getLength()));
NumberFormat fmt = NumberFormat.getIntegerInstance();
String formattedNumber = fmt.format(file.getLength());
return sub(xlatedSize, MSG_SUB1, formattedNumber);
}
else
{