diff options
author | Grant Gayed <grant_gayed@ca.ibm.com> | 2012-02-23 11:58:09 -0500 |
---|---|---|
committer | Grant Gayed <grant_gayed@ca.ibm.com> | 2012-02-23 11:58:09 -0500 |
commit | 7cf8ec47ce4db03e1986c7fd1d969608eee20f71 (patch) | |
tree | 003f3ca6ebf1c8ac523d5288a8cf8b5d540343cc /bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt | |
parent | f1be364c1b97911cbcdda6fd507fc5d82efe8be0 (diff) | |
download | eclipse.platform.swt-7cf8ec47ce4db03e1986c7fd1d969608eee20f71.tar.gz eclipse.platform.swt-7cf8ec47ce4db03e1986c7fd1d969608eee20f71.tar.xz eclipse.platform.swt-7cf8ec47ce4db03e1986c7fd1d969608eee20f71.zip |
move implementation from Platform to Library
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/Platform.java | 41 |
1 files changed, 5 insertions, 36 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/Platform.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/Platform.java index d0d35b454e..cfb461e926 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/Platform.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/Platform.java @@ -15,43 +15,12 @@ import java.net.*; import java.util.jar.*; public class Platform { - -public static final String PLATFORM = "cocoa"; //$NON-NLS-1$ -public static final Lock lock = new Lock (); -public static boolean IsLoadable () { - URL url = Platform.class.getClassLoader ().getResource ("org/eclipse/swt/SWT.class"); //$NON-NLS-1$ - if (!url.getProtocol ().equals ("jar")) { //$NON-NLS-1$ - /* SWT is presumably running in a development environment */ - return true; - } + public static final String PLATFORM = "cocoa"; //$NON-NLS-1$ + public static final Lock lock = new Lock (); - try { - url = new URL (url.getPath ()); - } catch (MalformedURLException e) { - /* should never happen since url's initial path value must be valid */ - } - String path = url.getPath (); - int index = path.indexOf ('!'); - File file = new File (path.substring (0, index)); - - try { - JarFile jar = new JarFile (file); - Manifest manifest = jar.getManifest (); - Attributes attributes = manifest.getMainAttributes (); - - /* - * Cocoa has a special case since SWT's 32-bit library contains natives for both the - * x86 and PPC architectures. - */ - if (!Library.os ().equals (attributes.getValue ("SWT-OS"))) return false; //$NON-NLS-1$ - String libraryArch = Library.arch (); - String manifestArch = attributes.getValue ("SWT-Arch"); //$NON-NLS-1$ - return libraryArch.equals (manifestArch) || (manifestArch.equals ("x86") && libraryArch.equals ("ppc")); //$NON-NLS-1$ //$NON-NLS-2$ - } catch (IOException e) { - /* should never happen for a valid SWT jar with the expected manifest values */ - } - - return false; +public static boolean isLoadable () { + return Library.isLoadable (); } + } |