Friday, October 15, 2010


I'm now working on Android!

In particular, I'm working on tooling for Android. That means I get to work fully in open source again which I enjoyed in the NetBeans days. We use the public Android git repository and I submit my fixes into the Gerrit code review tool which is a really nice workflow tool for git; I highly recommend it.

As you may or may not know, the Android tooling is Eclipse based, so I'm learning both to use Eclipse as well as writing plugins for it. There are some things I'm missing from NetBeans, but there are also some new features I'm welcoming. I just need to rewire my motor reflexes for it all to feel natural!

In the past when I've posted NetBeans tips, many of you have helpfully listed the corresponding Eclipse (and IntelliJ) shortcuts. While I have found replacements for many of the features I'm used to, I'm still stumped with the following, so if any of you could enlighten me - either with existing keybindings or optional plugins, I would appreciate it:

  • Most important: How can I, via the keyboard, navigate through my matches in the Find Usages search? This was my favorite keystroke in NetBeans (and I had meant to do a code tip about it) - if you press Cmd-period, you can navigate through find usages searches, build errors, diff view differences, etc. In Eclipse there is also Cmd-period, but it only works if the Search window has focus - and it doesn't work in the Diff view. (In fact, Cmd-period doesn't work in the Search window on the Mac; I don't know why, because it's listed as the shortcut, and Cmd-period does work in the editor view to navigate parsing errors. Luckily I've found the workaround of Cmd+Shift+period which navigates backwards, so I'm using that one, but I still have to give the Search window focus.)
  • When I select a symbol in the editor, all the occurrences (of the same variable, class, method, etc) are highlighted. In NetBeans I could navigate through these via a shortcut. Is there a way to do that in Eclipse? (Somebody told me that I could select the text and then use Cmd-k to navigate, but that's text-search based and will jump to unrelated symbols that happen to be the same string, e.g. the same parameter name in a different function).
  • How can I, via the keyboard, see the light bulb text? Sometimes I get a light bulb in the editor margin trying to tell me something. I have not found a way to see what it's saying other than hovering over it with the mouse. In NetBeans, Alt+Enter would show the light bulb text above the current line as well as the quickfix suggestions below the current line. In Eclipse I know I can press Cmd-1 to see the suggestions, but it doesn't show what the warning is and sometimes it isn't obvious from the suggestions what the problem is.  (For example, for an unused variable the suggestion is "Remove x").
  • I'm really missing the NetBeans version control view (the one which lists the "status"; all your changed, added, and removed files and made it trivial to walk through and diff them). Maybe this is just because I'm working with git and there isn't a plugin which offers that view yet?
  • This is minor, but when I initiate instant-renaming, it doesn't select the text, which NetBeans did, and I prefer that (so I can hit rename and type the new name). Is there a way to configure it to do that?

These are the answers I've asked some Eclipse users about and still haven't learned the answers to. One question I did ask, and eventually found the answer to is how to navigate files similar to NetBeans' Ctrl-Tab feature. The reason I'm bringing it up is that only one person finally showed me the right feature but most people didn't know about it - so if you're an Eclipse user, maybe you'll find this useful: "Next Editor". It's bound to something I can't remember in Eclipse, but I rebound the action called "Next Editor" to Ctrl-Tab (since Cmd-Tab is the equivalent application-switch shortcut on the Mac). You can press it to jump between two files - but the key thing is that when you're jumping between more than two files you can keep holding the Ctrl key after typing Tab to see a dialog of your recently edited files in most-recently-edited order.  I find this more intuitive than the jump-between-editing-locations since sometimes I jump to a file, look for something (without editing) and then I want to go back.

Anyway, I'm having a great time. I love working on tools, and perhaps even more, Android!

(By the way, if there are any SWT mavens out there, I would love an answer to this question which I posed on StackOverflow. If you know the answer but don't have or want to have a Stackoverflow account, feel free to post it here and I'll link back to it.)


  1. The only git plugin I have heard of for Eclipse is egit. I can't testify to how good/bad it is.

  2. Yep, I'm using that one. It's pretty decent - but it doesn't (as far as I can tell) have a "status view" which was the primary view for all version control systems in NetBeans -- cvs, subversion, mercurial, git. Egit does however have a Diff view so I can view the diffs, but I also haven't found a way to have it diff all the files I've changed in one go - I seem to have to go and open each one. I'm hoping I've just missed something and that the functionality is there...

  3. Hi. I'm reading your post and I'm new to Eclipse too (because Android). I find this and I hope this really help you:

    Is not beautiful, but it's useful.


  4. Eclipse is ok - though I switched to Netbeans from Eclipse about a year ago and never want to go back. Too bad the (really awesome) tooling from Google is all about eclipse.
    A big "thank you" for your contributions to Netbeans and all the OpenSource projects in the past which make my life so much better!
    I wonder what the Android future will be :)

    PS: Must be quite a trip to change the stack - I never liked git compared to hg. If you can make it, I will have a second look.

  5. I'm in the same boat, switching from Netbeans to Eclipse after a job change. For the version control view maybe you'll see a git option in General>Editors>Text Editors>Quick Diff? I have a couple for Perforce.

  6. I'm just guessing, but isn't there a synchronize view/perspective for viewing all incoming/outgoing changes with egit? I'd be surprised if there wasn't...

  7. to do what you want with renaming, you can hit cmd-option-r to do the instant rename, then hit it again to get a modal dialog with the full text selected.

  8. I've always found the Synchronize View to be one of the best version control features I've used. So I suggest that one for sure. One of the times I use the mouse is to select team -> Synchronize.

    Also there is a command for the search for current symbol.

    Command is: Search All Occurrences in File
    No shortcut was mapped by default.
    I added shortcut (Window->Preferences->General->Keys, Searched for it, added a keyboard short cut for it (look out for conflicts). I set the context to Java Editor. Then Ctrl . and , work to move between them.

  9. Awesome news!

    As a long, long time Javaposse listener I'm very happy to get another very skilled coder to work with Android. I don't know what you're going to be doing in Google but I really hope you would be working improving the tooling. Android really needs it.

    Best of luck in your new job!

  10. Another approach to rename is to double-click to select the symbol you want to rename and then trigger the rename function.

  11. A really good site for Eclipse tips is He has all sorts of little shortcuts and keyboard help that even after using Eclipse for years I didn't know about.

  12. Congratulations Tor .. awesome news.

  13. You might try asking these questions in the Eclipse forums

    The newcomer and swt forums would be ideal.

    I will also try to point people at your blog.

    Congrats on the new gig at Google.

  14. If you say something funny about egit on twitter and @caniszczyk, I'm sure you will get a reply.

  15. Re: lightbulb. This tells you that a 'quick fix' is possible. Often this comes with a warning / error.

    If you put your cursor on the line, the status bar will tell you the error / warning. You can also press F2 to see it in a text box.

    As you mentioned, you can press Ctrl+1 to get the quickfix options.

    As for the other things, if they turn out to be missing features, please feel free to file bugs / feature requests (


  16. Hi Tor,

    welcome to the Eclipse community! We are happy that you are joining us. :-)

    I'm not sure if I get your first question right, but you can use Ctrl+J to have an incremental text search. If you press Ctrl+J it brings you to the next occurance.

    Light bulb: As Ian said F2 should work.

    Egit (team provider) is currenlty under heavy development and they are actively reacting to bug reports. This link should allow you to open a bug if you are not happy with EGit:

    A intro to EGit can be found here:

    I also would prefer if Alt+Shift+R would select the full text. This might be personal preference.

    You find my personal main important shortcuts here:

    For example Cntr+Q is pretty useful (Goes to the last edited position in the editor).

    In case you need some material to get started with Eclipse Plugin development I hope these links might be helpful:

    Again, welcome in the Eclipse community. :-)

  17. For navigating my search results from anywhere, I use my own little plugin. ALT+. and ALT+, will move to the next search result and activate that editor. I can make it available (it's trivial) if anybody is interested.

    Also, within the editor you can add "Occurrences" to the list of things that CTRL+. and CTRL+, navigate through. Either in the preferences, or by using the dropdown menu from the NextAnnotation/PreviousAnnotation toolbar items.


  18. @Paul: I like to get your plugin for navigating the search results.

  19. I answered your question about the mouse down/drag listener problem on, but the short version is that it's a bug without a workaround. If you file a bug I'll attach my patch to it.

  20. @Lars: sure, the plugin is attached to

  21. Everyone, thank you very, very much!

    With all your suggestions I'm now much more productive. I haven't had a chance to try Paul's plugin yet, which sounds like exactly what I want (well, it would be even better if it would also work on diff views, e.g. Go To Next Difference when I'm in a diff view, but I'm starting to get used to using a different keybinding for that iteration). I'll try the plugin today.

    Anyway, thanks again! I'll go and file some request-for-enhancement on a couple of minor issues. For example - thank you for the tip about the lightbulb error appearing in the status bar - I hadn't noticed that because it only happens if the cursor is -inside- the underlined region, it doesn't happen if the caret is anywhere on the line as I was used to from NetBeans. etc.

    Scott, thanks for not only investigating that SWT issue, but beating me to filing a bug and even fixing it with both Windows and Mac patches within a day!

  22. @Paul: Thanks. This is really useful.

  23. @Tor,
    For issue (2) selecting a symbol and navigating between the occurances, you can use the Next/Prev annotation. By default only Errors & Warnings are selected, but you can add Occurances to it (the options are available via the pulldown menu in the toolbar)