diff options
author | Grant Gayed | 2010-09-17 17:57:29 +0000 |
---|---|---|
committer | Grant Gayed | 2010-09-17 17:57:29 +0000 |
commit | 1065415e239507fa887cbb82c3592b58b83f4023 (patch) | |
tree | 30f973047f2bf907749022ce50b889ea0ed0fea4 /bundles/org.eclipse.swt/Eclipse SWT PI/win32/org | |
parent | 75c6b52912768f207a601dbff89c84ba81f942a4 (diff) | |
download | eclipse.platform.swt-1065415e239507fa887cbb82c3592b58b83f4023.tar.gz eclipse.platform.swt-1065415e239507fa887cbb82c3592b58b83f4023.tar.xz eclipse.platform.swt-1065415e239507fa887cbb82c3592b58b83f4023.zip |
add toString()
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI/win32/org')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/GUID.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/GUID.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/GUID.java index 8a4c3017f9..1c9349f742 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/GUID.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/GUID.java @@ -16,4 +16,24 @@ public final class GUID { public short Data3; public byte[] Data4 = new byte[8]; public static final int sizeof = COM.GUID_sizeof (); + + static final String zeros = "00000000"; //$NON-NLS-1$ + +static String toHex (int v, int length) { + String t = Integer.toHexString (v).toUpperCase (); + int tlen = t.length (); + if (tlen > length) { + t = t.substring (tlen - length); + } + return zeros.substring (0, Math.max (0, length - tlen)) + t; +} + +public String toString () { + return '{' + toHex (Data1, 8) + '-' + + toHex (Data2, 4) + '-' + + toHex (Data3, 4) + '-' + + toHex (Data4[0], 2) + toHex (Data4[1], 2) + '-' + + toHex (Data4[2], 2) + toHex (Data4[3], 2) + toHex (Data4[4], 2) + toHex (Data4[5], 2) + toHex (Data4[6], 2) + toHex (Data4[7], 2) + '}'; +} + } |