From NoskeWiki
Jump to navigation Jump to search


Eclipse is a free, cross platform software development environment (IDE) comprising a workspace and an extensible plug-in system. Eclipse is written mostly in Java, but supports all kinds of languages. On this page I'll record any special tricks/tips on Eclipse I discover.

Increasing Memory Size

Eclipse usually takes a up a lot of ram but the default limit is 1 GB which falls short on some occasions, and you may see eclipse "blackout". Do a "pico ~/.eclipse/" and change it to the following:

# source .bashrc if it exists
  if [[ -r "${HOME}/.bashrc" ]]; then
    . ${HOME}/.bashrc;


This should make it use 8 GB of RAM and make it much smoother.


  • [Ctrl]+[Shift]+[O] - Organize imports - adjusts your includes by commenting out stuff you don't need.
  • [Ctrl]+[Shift]+[N] - Add import - add import for the class your mouse is currently over.
  • [Shift]+[Alt]+[R] - Refactor - allows you to change the name of the selected variable and it will change in all files (so long as indexing is done).
  • [Ctrl]+[F] - Find/Replace - works on one file only.
  • [Ctrl]+[H] - Search - use first tab to search all files in project.
    • [Alt]+[Shift]+[O] - Toggle Mark Occurrences - highlight occurrences of whatever variable the cursor is over.

Eclipse Setup Tasks

Add Line Numbers

Line numbers are off by default. To fix:

  • Go Windows > Preference > General > Editors > Text Editors, check on the Show line numbers option.

Add syntax highlighting to a new extension

Let say you have a file extension ".blueprint" which you want to color using the existing "GCL Editor" style (color syntax highlighting). The steps are:

  1. Go: Window > Preferences > General > Editors > File Associations
  2. Click the "Add" button up top and enter "*.sh".
  3. Under "Associated Editors" click "Add" and select "BUILD File Editor".
  4. Close the dialog, close your files, reopen them and they should appear in chosen editor / CSS highlighting (you shouldn't need to restart).
  • Suggested mappings:
    • "*.sh" > "BUILD File Editor"
    • "*.blueprint" > "GCL Editor"
    • "*.json" > "BUILD Editor"
    • "*.asciiproto" > "BUILD Editor"
    • "*.cfg" > "GCL Editor"

Another method (although less effective):

  1. Go: Window > Preferences > General > Content Types > Text > CSS
  2. Click the "Add" button and enter ".blueprint".
  3. Close the dialog, close your .blueprint files then reopen them and they should appear with CSS syntax highlighting.

Snippets and Templates

  • Code snippets - allow you to mouse click to add that snippet of code.
    • Create by going: menubar >> Window >> Show View >> Other >> General >> Snippets.
    • Now right click the Snippet window and Customize to add a new one.
  • Template - allow you to type a few letters then hit [Ctrl]+[Space] (sometimes twice) to auto-complete / add the template text.
    • Create by going: menubar >> Window >> Preferences >> C/C++ >> Editor >> Templates >> New.
    • Add the prefix name (eg: 'loe') and template (eg: 'LOG(ERROR) << " %%%%%% $(cursor)"').

Eclipse Troubleshooting

There are a bunch of things that can go wrong, but the ones that have happened to me:

  • Problem: During launch, Eclipse displays a see ~/workspace/.metadata/.log warning and quits.
  • Solution: Could be a bunch of things, but for me this happened after an unclean shutdown. The culprit was path_to_workspace/.metadata/.plugins/org.eclipse.core.resources/.snap. From "On normal Eclipse shutdown, the complete workspace state is saved and the .snap files are deleted". I manually deleted this file, and the problem was fixed immediately. If that doesn't work path_to_workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/project_name/ contains all files associated with your projects saved state. Deleting .markers, .markers.snap and all files in the sub-directory supposedly might fix eclipse with some minor loss of state (requiring a refresh of the project).