Platform check in Eclipse 3.5

July 8, 2009 | In Java, Eclipse | No Comments

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);
	}
…

Powered by WordPress. Theme based on Pool theme design by Borja Fernandez.
Entries and comments feeds. Valid XHTML and CSS. ^Top^