Alex headshot

AlBlue’s Blog

Macs, Modularity and More

Full-screen support for Eclipse on OSX Lion

2011 Eclipse Osx

If you've updated to Lion, you know that the full-screen apps are likely to be a significant impact to applications. Unfortunately, the release of Eclipse Indigo was just before OSX Lion was released, so it wasn't possible to implement full-screen handling for Eclipse applications.

Fortunately, the change is relatively easy. the code is already in place in SWT to make it happen, although not invoked by Eclipse. If you have an SWT window and you want to make it full-screen on OSX, you can do:

NSWindow nswindow = shell.view.window();
nswindow.setCollectionBehavior(1 << 7);

If you want to apply this to your current Eclipse instance, point an update site to where I have put a plugin together which applies this change to existing Eclipse windows. You can then hit the arrow at the top-right of the screen in order to put Eclipse into full-screen mode; to bring it back, move the mouse to the top-right of the screen and the menu will pop back into action – you can click on the fullscreen icon to bring it back as a regular window.

Hopefully this will be added by default in future versions (bug 349148) of Eclipse rather than needing this plugin as a workaround.

Update: This seems to fail on some versions of OSX (or on some JVMs on OSX) with missing osgi.os properties; in addition, the code is compiled against the 64-bit SWT and so fails when running with a 32-bit SWT. These problems will be fixed in the near future.

Update 2: I have pushed a new version which supports both 32-bit and 64-bit Eclipse. It also fixes the empty toolbar at the top of the screen in full-screen mode.

Update 3: This is now available via the Eclipse Marketplace

Update 4: The plugin now supports coming out of fullscreen mode with Escape as well as adding a Window menu item to Toggle Full Screen. Work continues on bug 349148 which will extend the SWT API to do this natively, probably from Eclipse 3.8 onwards as it's adding new API.