Saturday, June 13, 2009

Every pixel counts! The new eclipse fullscreen plugin...

A few days ago Kevin McGuire blogged with the title Every pixel is sacred (not any more!) and a follow up Eclipse UI Real Estate Wasters!. I still believe that every pixel counts and I often wanted to have eclipse in full screen mode to save a few pixel. I use full screen mode in the browser and with pdf files a lot and I really love it. I remembered that there is a new Shell.setFullScreen method in SWT. During a boring meeting, I decided to create a small plugin that would add a toolbar button and a menu entry to toggle eclipse in to fullscreen. I started with the "New Plugin wizard" and choose the Hello, World Command example and replace the handleCommand line with one line:
window.getShell().setFullScreen(!window.getShell().getFullScreen());

I changed the labels in the plugin.xml and I was done, in less than 10 munites.....

I should know that even "simple" things can be quite complicated.
I wanted to make the plugin nice and share it but that was the start of a nightmare..... but that is another story.


Download/update


You can use this site as update site or download the plugin from here: gr.scharf.fullscreen.zip


Functionality


The plugin has been written for eclipse 3.5 but it works also for eclipse 3.4 although there are some problems with the handling of the toggle state of the commands...

The plugin adds a Fullscreen command to the Windows menu and a Keybinding M3+F11 which translates on windows to Alt+F11:



When fullscreen mode is active all (main) windows are in full screen mode:



There is also a Toolbar button that can be enabled. Because the plugin uses the Commands Framework there are some unfortunate restrictions (bug 280033):

  • When you go to Window->Customize Perspective->Tool Bar Visibility, you will not find the Fullscreen tool bar unless you have enabled it in Window->Customize Perspective->Command Groups Availability

  • The Toolbar details are empty, although the toolbar contains a command:



Once you have succeeded enabling the toolbar button, it will look like this:

and

I decided to hide the button by default, because in most cases the shortcut and the windows menu command should be enough.

11 comments:

  1. Shouldn't this code go as a patch into the Eclipse platform UI in 3.6?

    I guess it makes more sense as providing a separate plugin for 1 menu entry and 3 lines of code ;-)

    Andrei

    ReplyDelete
  2. Hmm, the update site doesn't work. Could you fix that, please?

    ReplyDelete
  3. Great plugin. Actually, it is not that impressing under Mac OS X, because on that platform only the dock and the title bar is hidden -- the menu bar is on top of the screen anyway. But still it's a nice thing to have that little bit space extra -- which I can always use when I'm playing around with GEF3D ;-)

    I'm looking forward to the results of your next boring meeting ;-)

    Cheers

    Jens

    BTW: As a natural born hacker I was able to crack your URL code, so this is the correct update site:
    http://www.scharf.gr/eclipse/fullscreen/update/

    ReplyDelete
  4. Jens, great finding! I obviously used a relative url :-(

    Michael

    ReplyDelete
  5. There is already such a plug-in:
    Eclipse Full Screen Plugin. What is different between these plug-ins?

    ReplyDelete
  6. Yes, I am also using Eclipse Full Screen Plugin for a long time. Doesn't seem any different. But nice explanation on what is being done to develop it.

    Thanks

    ReplyDelete
  7. Andrei, there are two bugs currently open about this, there's bug 171398 and bug 260354.

    ReplyDelete
  8. Yea -- I should have done a google search before I created my plugin -- but it was a kind of exercise to learn commands.

    The differences are:
    - the google plugin removes also the toolbar and can remove the menu
    - the google plugin is internationalized
    - the google plugin uses Esc to exit the full screen mode (like browsers do)

    - my plugin shows a toggle state and uses commands
    - my plugin puts all windows in full screen mode

    But I am currently working on a new version that allows you to hide the toolbar, status bar and even the main menu...

    ReplyDelete
  9. By the way, this should be in the Platform.

    I've been wanting this support for a long time and there's a bug open somewhere.

    ReplyDelete
  10. This is an amazing plugin , i am going to try it now, I agree every pixle count if you are working on laptop and don't have big screen to see most of code you would like to leverage this feature but yes this should be part of platform itself rather than available as plugin.

    Javin
    Top 20 Core Java Interview question

    ReplyDelete
  11. Is there an up to date version of this plugin or something similar for indigo?

    ReplyDelete