dev/Sorting/Thoughts

Journal of development Sorting Thoughts and more…

Platform check in Eclipse 3.5

Posted on Jul 8, 2009 in Eclipse, Java

To check the running platform in an Eclipse 3.5 plugin or RCP app use this:

org.eclipse.jface/src/org/eclipse/jface/util/Util.java

...
        /**
	 * Note: this may be made internal in 3.5
	 * @return true for windows platforms
	 * @since 3.5
	 */
	public static final boolean isWindows() {
		final String ws = SWT.getPlatform();
		return WS_WIN32.equals(ws) || WS_WPF.equals(ws);
	}
	
	/**
	 * Note: this may be made internal in 3.5
	 * @return true for mac platforms
	 * @since 3.5
	 */
	public static final boolean isMac() {
		final String ws = SWT.getPlatform();
		return WS_CARBON.equals(ws) || WS_COCOA.equals(ws);
	}
...
 

Submit a Comment

Your email address will not be published. Required fields are marked *

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close