This page is offered as a service of Bristle Software, Inc. New tips are sent to an associated mailing list when they are posted here. Please send comments, corrections, any tips you'd like to contribute, or requests to be added to the mailing list, to tips@bristle.com.
Original Version: 12/21/2005
Last Updated: 12/8/2011
Applies to: Eclipse 3.1.1+
Here is a list of some of the more useful shortcut keys in Eclipse.
Notes:
Key | Function | ||
---|---|---|---|
Ctrl-Shift-L | Show popup list of all currently applicable shortcut keys and
key sequences. |
||
Click | Highlight all occurrences of identifier in file | ||
Ctrl-Click | Go to declaration of object at cursor (variable, class, etc.) | ||
F3 | Go to declaration of object at cursor (variable, class, etc.) | ||
F4 | Go to type at cursor in class hierarchy window | ||
Ctrl-Shift-T |
Selection dialog for types (classes, etc.), where you can type the
beginning of the short name (w/o packages) and quickly go to the right
source file. Wildcards * (any sequence of chars) and ? (any
single char) are supported.
|
||
Ctrl-F3 | Selection dialog for members of the current class (methods,
variables, etc.), where you can type the
beginning of the name and quickly go to the right place in the source file.
Wildcards * (any sequence of chars) and ? (any single char) are
supported. Thanks to Ken Smith for showing me this one! |
||
Ctrl-Shift-R | Selection dialog for resources (Java source files, config files,
property files, etc.), where you can type the beginning of the short
file name (w/o folder names) and quickly go to the right source file.
Wildcards * (any sequence of chars) and ? (any single char) are
supported.
|
||
Ctrl-Shift-H | Selection dialog to show a type in the class hierarchy window.
Like Ctrl-Shift-T, but shows class hierarchy instead of Java source.
Wildcards * (any sequence of chars) and ? (any single char) are
supported.
|
||
Ctrl-T | Show Quick Class Hierarchy | ||
DblClick a tab | Maximize/restore view/editor in that tab (toggle) | ||
Ctrl-M | Maximize/restore current view/editor (toggle) | ||
Ctrl-Space |
Content Assist
|
||
Ctrl-Space (Mac, not Cmd) | |||
Ctrl-Shift-Space | Parameter Hints | ||
Ctrl-1 | Quick Fix (after finding compiler error, easy way to add imports, correct spelling errors, etc.) | ||
Ctrl-2 | Quick Assist (fast renaming, etc.) | ||
Ctrl-3 | Quick Access (fast way to find an editor command) (New in Eclipse 3.3) |
||
Hover | Show Quick Javadoc | ||
F2 | Show Quick Javadoc in scrollable, copy-enabled window | ||
Shift-F2 | Show Javadoc in a separate browser window | ||
Ctrl-Z | Undo | ||
Ctrl-Y | Redo | ||
Alt-Shift-Z | Undo refactoring operation | ||
Alt-Shift-Y | Redo refactoring operation | ||
Ctrl-O | Show current context (method, class, package, etc.), and allow quick navigation to other methods, members, inherited methods, etc. | ||
Ctrl-G | Show context of identifier at cursor (method, class, package, etc.) | ||
Alt-Left |
Go back (through recent editing locations) | ||
Cmd-[ | |||
Opt-Cmd-Left | |||
Alt-Right |
Go forward (through recent editing locations) | ||
Cmd-] | |||
Opt-Cmd-Right | |||
Ctrl-Q | Go to most recently edited location | ||
Ctrl-F4 | Close editor window | ||
Cmd-W | |||
Ctrl-PageDn | Go to next editor window in current tab set | ||
Ctrl-Fn-Down |
|||
Ctrl-PageUp | Go to previous editor window in current tab set | ||
Ctrl-Fn-Up |
|||
Ctrl-E | Switch to another editor in current tab set. Can type a name here. | ||
Ctrl-F6 | Go to next editor (shows list and toggles between 2 most recent) | ||
Ctrl-F7 | Go to next view (shows list and toggles between 2 most recent) | ||
Ctrl-F8 | Go to next perspective (shows list and toggles between 2 most recent) | ||
Ctrl-Shift-P |
Go to matching bracket | ||
Cmd-Shift-P | |||
Ctrl-Shift-Down |
Go to next object (method, variable, class, etc.) in source file. | ||
Ctrl-Opt-Down | |||
Ctrl-Shift-Up |
Go to previous object (method, variable, class, etc.) in source file. | ||
Ctrl-Opt-Up | |||
Ctrl-L | Go to line number | ||
Ctrl-F | Search within a file | ||
Ctrl-K | Search Next within a file | ||
Ctrl-Shift-K | Search Previous within a file | ||
Ctrl-H | Search in project, workspace, file system, etc. Also offers Java-sensitive searches, limiting matches to:
|
||
Ctrl-J | Incremental Search forward | ||
Ctrl-Shift-J | Incremental Search back | ||
Ctrl-Period |
Search Next, also Next Error, Next Diff (only in the views for search, problems, compare, etc.) | ||
Ctrl-Comma | Search Previous, also Previous Error, Previous Diff (only in the views for search, problems, compare, etc.) | ||
Ctrl-Shift-U | When an identifier is selected: Find all occurrences of identifier in the file (showing them in Search pane) | ||
When a class or interface name that follows one of the keyword "extends" or "implements" is selected: Find all methods in the file that implement methods defined in the class or interface (showing them in Search pane) | |||
Ctrl-Alt-G | Find all occurrences of selected text in workspace (showing them in Search pane) | ||
Ctrl-Shift-G | Find all references to selected identifier in workspace (showing them in Search pane) | ||
Ctrl-Alt-H | Show call hierarchy | ||
Ctrl-Slash | Comment | ||
Ctrl-Backslash | Uncomment | ||
Tab | Indent | ||
Shift-Tab | Undent | ||
Cmd-Shift-F11 | Run (may have to click on project name first) | ||
Cmd-F11 | Debug (may have to click on project name first) | ||
F5 | Step Into | ||
F6 | Step Over | ||
F7 | Step Out | ||
F8 | Resume | ||
Alt-Shift-W | Show in another view (chosen from popup) | ||
Alt-Shift-Arrows | Expand/contract selection syntactically
(variable ==> expression ==> statement ==> block ==> method ==> class ==> file) |
||
Alt-Shift-R | Rename item (method, field, variable, parameter, type, compilation unit, package, source folder, project) | ||
Ctrl-Shift-Y | To lower case | ||
Ctrl-Shift-X | To upper case | ||
Alt-Shift-X,T | Run JUnit |
This list is far from complete. Please feel free to mail me your favorite shortcuts. I'll add to this list as time permits.
As described above, the complete list of bound keys and bindable commands is available in Eclipse by hitting Ctrl-Shift-L twice.
There's also a cool plugin that notices you using the menus, and teaches you about their keyboard shortcuts. Written by Andriy Palamarchuk. I haven't tried it since I know the shortcuts so well already, but it looks useful. See:
http://www.mousefeed.com/
http://blog.mousefeed.com/
--Fred
Original Version: 12/5/2007
Last Updated: 6/10/2008
Applies to: Eclipse 3.1.1+
Having trouble getting Eclipse to show you the entire Java source file you are editing?
I'd been using Eclipse for years when it suddenly slipped into the mode of showing me only one Java variable or method at a time instead of the entire source file. This can be a nice feature when you want it, but I never want it. Clearly, I had accidentally enabled a feature that was there intentionally, but I couldn't find a way to turn it off.
I checked all the menus and all of the likely settings, dug through the Eclipse Help system, and did a couple quick Google searches, but couldn't find such a switch. I lived with it for a while, since I seemed to be able to get out of that mode by closing and re-opening the source file. However, it kept kicking back into that mode whenever I did a search with Ctrl-H and clicked on a match, or used Ctrl-Shift-Up/Down to go to the previous/next construct, or clicked on something in the Outline view, or various other navigation techniques.
Eventually, I made a concerted effort to Google the answer and finally found it. There is a tiny little toolbar button with a hover popup that says:
Show Source of Selected Element Only
I must have bumped it, and it has stayed on ever since. Clicking it again solved my problem. I guess I'll have to stop assuming that toolbar buttons are just shortcuts to things in menus.
Thanks to the following Web page for giving me the answer:
http://www.myeclipseide.com/PNphpBB2-viewtopic-t-15522.html
--Fred
Last Updated: 6/10/2008
Applies to: Eclipse 3.1.1+
Want Eclipse to use a larger popup window?
Eclipse pops up all sort of useful windows, some of which default to a smaller size than I like. For example, I often hit Ctrl-O to see which method I am currently in, and a list of other methods of the class for quick navigation to them. However, the default window size is too small, so I have to immediately drag the edges to make it wider so I can see the full method signatures, and taller so I can see more of the methods at once. Or spend a lot of time scrolling back and forth.
A couple years ago, I noticed that once you've resized the window, you can tell Eclipse to remember the new window size and location for future popups, in the current and future sessions of Eclipse. Look for the tiny little down arrow icon at the top right of the popup window. Click it to see a drop down menu of options, one of which is "Remember Size and Location".
Look for this same drop down menu icon in the top right corner of many of the Eclipse popup windows, and also the docked window panes. Lots of useful options for sorting, filtering, etc.
--Fred
Last Updated: 1/25/2006
Applies to: Eclipse 3.1.1+
Eclipse supports the following useful command line options:
Option | Function |
---|---|
-data workspace | The full path of the Eclipse workspace (folder) to use. |
-vmargs vmargs | Arguments and options to pass to the Java VM. This must be the last option on the command line (other than the VM options that follow it). |
The Java VM supports the following useful command line options:
Option | Function |
---|---|
-Xmssize | Initial VM memory (heap) size. Default for Eclipse is 40m (40 MB). Useful to reduce initial size on a low memory computer. Also useful to increase initial size which may speed up interaction later. |
-Xmxsize | Max VM memory (heap) size. Default for Eclipse is 256m (256 MB). Useful to increase max size if you have a large project or large workspace. |
Therefore, the following are useful combinations that you might want to put in a BAT file or a Windows shortcut.
-data c:\workspace1
-data c:\workspace2
To run Eclipse on workspaces other than your default workspace.
-data c:\large\workspace -vmargs -Xms256m -Xmx512m
To run Eclipse on a large workspace with large initial and max heap size.
For more Eclipse options, see:
Eclipse
Launcher Command Line
Eclipse Startup Jar Command
Line
For more Java VM options, see:
http://bristle.com/Tips/Java.htm#jvm_command_line
or type:
java -?
java -X
Thanks to Ken Smith for this tip!
--Fred
The eclipse.exe file, known as the "Eclipse Launcher", is a small executable that launches the Eclipse application, most of which is implemented by various Java JAR files. You can use it to pass command arguments or other config info to Eclipse. You can also use it to launch your own non-Eclipse Java programs. See below for details.
Last Updated: 1/21/2006
Applies to: Eclipse 3.1.1+
The Eclipse Launcher supports the following command line options.
Option | Function |
---|---|
-vm javaVM | The JVM (Java Virtual Machine) to use (the full path to the java.exe file) |
-os os | The operating system being run on |
-arch arch | The window system to use: win32, motif, gtk, ... |
-ws ws | The hardware architecture: x86, sparc, hp9000, ... |
-nosplash | No splash screen |
-name "name" | Name to use in error messages and such (default = name of the .exe with first letter capitalized, so typically "Eclipse") |
-startup jar | JAR file to execute. |
startupJarArgs | Any additional arguments are passed to the startup JAR file.
For more info, see: Eclipse Startup JAR Command Line |
-vmargs vmargs |
Arguments and options to pass to the Java VM. This must be the last option
on the command line (other than the VM options
that follow it). For a list of typical Java VM arguments and
options, see: Eclipse Command Line |
--Fred
Last Updated: 1/21/2006
Applies to: Eclipse 3.1.1+
The Eclipse startup JAR file supports the following command line options that are useful for integrating with the launcher, for customizing its appearance, and for operating on different workspaces.
Option | Function | ||||||||
---|---|---|---|---|---|---|---|---|---|
-data workspace | The full path of the Eclipse workspace (folder) to use. | ||||||||
-launcher launcher | Full path of the launcher. Typically passed by the launcher, as a value like: c:\Apps\Eclipse\eclipse.exe | ||||||||
-name "name" | Name to use in error messages and such. Typically passed by the launcher, as a value like "Eclipse". | ||||||||
-showsplash secs | Splash time out in seconds. | ||||||||
-exitdata id | Id of a 16KB shared memory area for writing "exit data"
when exiting to give further instructions to the launcher. The
following instructions are recognized in the exit data:
|
For a complete list of the dozens of other options, see:
--Fred
Last Updated: 1/21/2006
Applies to: Eclipse 3.1.1+
The Eclipse Launcher reads options from a config file. The config file has the same name as the launcher, but with .exe changed to .ini, and resides in the same folder as the .exe file. Since the default name of the launcher is eclipse.exe, the default name of the config file is eclipse.ini.
If you rename the launcher, or move or copy it to a new folder or a new filename, it will look for the config file in the new folder with the corresponding new config filename. Thus, you can easily maintain multiple different Eclipse configurations. Each exe will find its associated config file.
Options specified on the command line override those in the config file. Beware that a -vmargs option on the command line (which can be used to specify one or more VM arguments and options) overrides all of the VM arguments and options specified in the config file, not just the VM arguments and options re-specified on the command line.
--Fred
Last Updated: 1/21/2006
Applies to: Eclipse 3.1.1+
The Eclipse Launcher (eclipse.exe) is a simple program that executes a specified Java VM with a specified set of VM options to run a specified Java JAR file with a specified set of options. The main Eclipse functionality is in the default JAR file.
You can use the launcher to launch any Java application you like, even one completely unrelated to Eclipse. By copying eclipse.exe to a different name, you pick up a different config file, and display a different name in the error messages. There are options to specify the name of the Java JAR file to run, to suppress the splash screen, etc. Therefore, you can easily use this launcher for any non-Eclipse application.
For more info, see:
http://dev.eclipse.org/viewcvs/index.cgi/platform-swt-home/launcher.html?rev=1.2
For the full source code of the Eclipse Launcher, see:
http://dev.eclipse.org/viewcvs/index.cgi/platform-launcher/library/eclipse.c?rev=HEAD
--Fred
©Copyright 2006-2021, Bristle Software, Inc. All rights reserved