Java Code Examples for org.eclipse.swt.SWT#getPlatform()

The following examples show how to use org.eclipse.swt.SWT#getPlatform() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: http4e   File: SwtUtils.java    License: Apache License 2.0 6 votes vote down vote up
public static boolean isMac(){
   String platform = SWT.getPlatform();
   if ("carbon".equals(platform) || "cocoa".equals(platform)) {
      return true;
   }

   // if ("win32".equals(platform) || "wpf".equals(platform)) {
   // // className = "org.eclipse.swt.browser.IE";
   // } else if ("motif".equals(platform)) {
   // // className = "org.eclipse.swt.browser.Mozilla";
   // } else if ("gtk".equals(platform)) {
   // // className = "org.eclipse.swt.browser.Mozilla";
   // } else if ("carbon".equals(platform) || "cocoa".equals(platform)) {
   // // className = "org.eclipse.swt.browser.Safari";
   // return true;
   // } else if ("photon".equals(platform)) {
   // // className = "org.eclipse.swt.browser.Voyager";
   // } else {
   // // dispose ();
   // // SWT.error (SWT.ERROR_NO_HANDLES);
   // }

   return false;
}
 
Example 2
Source Project: http4e   File: SwtUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static boolean isWindows(){
   String platform = SWT.getPlatform();
   if ("win32".equals(platform) || "wpf".equals(platform)) {
      return true;
   }
   return false;
}
 
Example 3
/**
 * Performs show and sets the edit string to be the initial character or
 * string
 * 
 * @param initialChar
 */
public void show(char initialChar) {
	initialString = initialString.append(initialChar);
	show();
	if (SWT.getPlatform() != "carbon") { //$NON-NLS-1$ 
		// Set the cell editor text to the initial character
		setEditText(initialString.toString());
	}
}
 
Example 4
Source Project: birt   File: ChartUIUtil.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private static boolean isWindows( )
{
	String platform = SWT.getPlatform( );
	if ( "win32".equals( platform ) ) //$NON-NLS-1$
	{
		return true;
	}
	return false;
}
 
Example 5
Source Project: birt   File: ImageLabel.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Check the style bits to ensure that no invalid styles are applied.
 */
private static int checkStyle( int style )
{
	if ( ( style & SWT.BORDER ) != 0 )
		style |= SWT.SHADOW_IN;
	int mask = SWT.SHADOW_IN
			| SWT.SHADOW_OUT
			| SWT.SHADOW_NONE
			| SWT.LEFT_TO_RIGHT
			| SWT.RIGHT_TO_LEFT;
	style = style & mask;
	style |= SWT.NO_FOCUS;
	if ( ( style & ( SWT.CENTER | SWT.RIGHT ) ) == 0 )
		style |= SWT.LEFT;
	// TEMPORARY CODE
	/*
	 * The default background on carbon and some GTK themes is not a solid
	 * color but a texture. To show the correct default background, we must
	 * allow the operating system to draw it and therefore, we can not use
	 * the NO_BACKGROUND style. The NO_BACKGROUND style is not required on
	 * platforms that use double buffering which is true in both of these
	 * cases.
	 */
	String platform = SWT.getPlatform( );
	if ( "carbon".equals( platform ) || "gtk".equals( platform ) )return style; //$NON-NLS-1$ //$NON-NLS-2$
	return style | SWT.NO_BACKGROUND;
}
 
Example 6
Source Project: swt-bling   File: ClientOS.java    License: MIT License 5 votes vote down vote up
public static boolean isWindows7() {
    boolean windows7 = false;
    String swtPlatform = SWT.getPlatform();
    if(swtPlatform.equals("win32")) {
        double version;
        try {
            version = Float.parseFloat(System.getProperty("os.version"));
            //Windows 7 is internally identified as 6.1
            windows7 = version <= 6.1;
        } catch (NumberFormatException ex) {
            windows7 = true;
        }
    }
    return windows7;
}
 
Example 7
Source Project: swt-bling   File: ClientOS.java    License: MIT License 5 votes vote down vote up
public static boolean isWindows() {
    boolean windows = false;
    String swtPlatform = SWT.getPlatform();
    if(swtPlatform.equals("win32")) {
       windows = true;
    }
    return windows;
}
 
Example 8
Source Project: hop   File: OsHelper.java    License: Apache License 2.0 4 votes vote down vote up
public static final boolean isWindows() {
  final String ws = SWT.getPlatform();
  return WS_WIN32.equals( ws ) || WS_WPF.equals( ws );
}
 
Example 9
Source Project: hop   File: OsHelper.java    License: Apache License 2.0 4 votes vote down vote up
public static final boolean isMac() {
  final String ws = SWT.getPlatform();
  return WS_CARBON.equals( ws ) || WS_COCOA.equals( ws );
}
 
Example 10
public KbaBootstrapper() {
  this(MechanicLog.getDefault(),
      (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class),
      SWT.getPlatform());
}
 
Example 11
/**
 * Return true if the operating system is Mac.
 */
public static boolean isMac() {
  String platform = SWT.getPlatform();
  return ("carbon".equals(platform) || "cocoa".equals(platform));
}
 
Example 12
/**
 * @return true if the operating system is Mac
 */
public static boolean isMac() {
  String platform = SWT.getPlatform();
  return ("carbon".equals(platform) || "cocoa".equals(platform));
}
 
Example 13
Source Project: pentaho-kettle   File: OsHelper.java    License: Apache License 2.0 4 votes vote down vote up
public static final boolean isWindows() {
  final String ws = SWT.getPlatform();
  return WS_WIN32.equals( ws ) || WS_WPF.equals( ws );
}
 
Example 14
Source Project: pentaho-kettle   File: OsHelper.java    License: Apache License 2.0 4 votes vote down vote up
public static final boolean isMac() {
  final String ws = SWT.getPlatform();
  return WS_CARBON.equals( ws ) || WS_COCOA.equals( ws );
}