0

I've got two questions:

  1. How I can to know the type of the current platform in code? Is it Mac or Linux or Windows.
  2. Is there something in SWT?
Baz
  • 36,440
  • 11
  • 68
  • 94

1 Answers1

2

You can use:

String platform = SWT.getPlatform();

which returns "win32", "motif", "gtk", "photon", "carbon", "cocoa", "wpf" ...

It is rare to actually need to use this.

greg-449
  • 109,219
  • 232
  • 102
  • 145
  • TNX! Only one question more: Is result is cocoa for last macos? I will fix the code editor code: // handle "Ctrl+Z" : undo tw.addKeyListener(new KeyStrokeAdapter("Ctrl+z") { @Override protected void onAction() { getUndoManager().undo(); } }); end for mac I mast replace the Ctrl+Z to cmd+z – Pavel Kopychenko Sep 03 '14 at 14:21
  • 64 bit SWT on Mac OS X is "cocoa". Eclipse key bindings support `M1` for Cmd on Macs and Ctrl elsewhere - but I don't know what your `KeyStrokeAdapter` is so I don't know if it will work here. – greg-449 Sep 03 '14 at 14:26