Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

format duration ourselves

  • Loading branch information...
commit e5732b93fd99a4ef5705d58e319012eb86d4b1dd 1 parent f8dece1
JP Moresmau authored
1  net.sf.eclipsefp.haskell.debug.core/META-INF/MANIFEST.MF
View
@@ -28,6 +28,7 @@ Export-Package: net.sf.eclipsefp.haskell.debug.core.internal,
net.sf.eclipsefp.haskell.ui,
net.sf.eclipsefp.haskell.debug.ui,
net.sf.eclipsefp.haskell.hugs",
+ net.sf.eclipsefp.haskell.debug.core.internal.util,
net.sf.eclipsefp.haskell.debug.core.test
Bundle-ClassPath: .,
lib/jdom.jar
3  ...ll.debug.core/src/net/sf/eclipsefp/haskell/debug/core/internal/launch/AbstractHaskellLaunchDelegate.java
View
@@ -19,7 +19,6 @@
import net.sf.eclipsefp.haskell.debug.core.internal.util.CoreTexts;
import net.sf.eclipsefp.haskell.util.CommandLineUtil;
import net.sf.eclipsefp.haskell.util.NetworkUtil;
-import org.apache.commons.lang3.time.DurationFormatUtils;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -251,7 +250,7 @@ public void launchesTerminated( final ILaunch[] launches ) {
if (st!=null && st.length()>0){
long start=Long.parseLong(st);
long dur=System.currentTimeMillis()-start;
- buffer.append(DurationFormatUtils.formatDuration( dur, "mm:ss.SSS")); //$NON-NLS-1$
+ buffer.append(CoreTexts.formatDuration( dur));
} else {
buffer.append(process.getLabel());
}
56 net.sf.eclipsefp.haskell.debug.core/src/net/sf/eclipsefp/haskell/debug/core/internal/util/CoreTexts.java
View
@@ -30,10 +30,66 @@
public static String jdt_notFound_title;
public static String jdt_notFound_message;
+
+ public static String duration_hour;
+ public static String duration_hours;
+ public static String duration_minute;
+ public static String duration_minutes;
+ public static String duration_second;
+ public static String duration_seconds;
+ public static String duration_milliseconds;
+ public static String duration_sep;
+
private static final String BUNDLE_NAME
= CoreTexts.class.getPackage().getName() + ".coretexts"; //$NON-NLS-1$
static {
NLS.initializeMessages( BUNDLE_NAME, CoreTexts.class );
}
+
+ /**
+ * format duration in current locale
+ * @param duration
+ * @return
+ */
+ public static String formatDuration(long duration){
+ long ms=duration%1000;
+ String ret=NLS.bind(duration_milliseconds,ms);
+ duration/=1000;
+ long s=duration%60;
+ if (s>0){
+ String sS=null;
+ if (s==1){
+ sS=NLS.bind(duration_second,s);
+ } else {
+ sS=NLS.bind(duration_seconds,s);
+ }
+ ret=NLS.bind( duration_sep, sS,ret );
+ duration/=60;
+ long m=duration%60;
+ if (m>0){
+ String mS=null;
+ if (m==1){
+ mS=NLS.bind(duration_minute,m);
+ } else {
+ mS=NLS.bind(duration_minutes,m);
+ }
+ ret=NLS.bind( duration_sep, mS,ret );
+ long h=duration/60;
+
+ if (h>0){
+ String hS=null;
+ if (h==1){
+ hS=NLS.bind(duration_hour,h);
+ } else {
+ hS=NLS.bind(duration_hours,h);
+ }
+ ret=NLS.bind( duration_sep, hS,ret );
+ }
+ }
+ }
+
+ return ret;
+ }
+
}
11 ....eclipsefp.haskell.debug.core/src/net/sf/eclipsefp/haskell/debug/core/internal/util/coretexts.properties
View
@@ -21,4 +21,13 @@ profiling_waiting=Getting profiling information
jdt_notFound_title=JDT not found
jdt_notFound_message=Java Development Tools are not installed in your system, so the JUnit view cannot be launched. \
You can check the test results in the Console view.\n\
-Check how to install the JDT in http://eclipsefp.github.com/installation.html.
+Check how to install the JDT in http://eclipsefp.github.com/installation.html.
+
+duration_hour={0} hour
+duration_hours={0} hours
+duration_minute={0} minute
+duration_minutes={0} minutes
+duration_second={0} second
+duration_seconds={0} seconds
+duration_milliseconds={0} ms
+duration_sep={0}, {1}
3  net.sf.eclipsefp.haskell.debug.ui.test/META-INF/MANIFEST.MF
View
@@ -13,7 +13,8 @@ Require-Bundle: net.sf.eclipsefp.haskell.core,
org.eclipse.core.resources,
org.eclipse.core.runtime,
org.eclipse.ui,
- org.junit4
+ org.junit4,
+ net.sf.eclipsefp.haskell.debug.core;bundle-version="2.6.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: net.sf.eclipsefp.haskell.debug.ui.test
Please sign in to comment.
Something went wrong with that request. Please try again.