Eclipse C++: How do you quickly switch between header and implementation files? - eclipse

How do you switch between header (.h) and implementation files (.cpp) in Eclipse when using the C++/CDT environment with a keyboard shortcut?
In XCode you can quickly switch between headers and implementation with applekey option and up/down arrow keys. I was hoping that eclipse had something similar, but I haven't found it yet.

Ctrl + Tab.
See in menu Window --> Preferences --> "General" category (far left) --> Keys --> "Toggle Source/Header"

Ctrl + Tab is the default shortcut and here is a list of some of the more useful shortcut keys in Eclipse.

Ctrl + Tab is the default shortcut. You can change it in Window->Preferences->General->Keys - Toggle Source/Header

F3 to jump between declarations and definitions of specific methods
This is another good one to know in this context:
double click on the method name with the mouse, selecting it
hit F3 (shortcut for Right Click > Open Declaration)
This takes you from the declaration (.hpp) to definition (.cpp) and vice versa depending on which one you are currently in, which is useful if you want to go to the other file to see a specific method when the file is large.
Tested in Eclipse CDT 2019-09.

You can also Ctrl + click on an identifier ( method name of member,... ). That way you seldomly need Ctrl + Tab.

Related

Eclipse, shortcut to create new Java class

Is it possible to assign a shortcut to go automatically on New Java Class Dialog? At the very beginning of a project when I am creating a lot of classes, it's quite annoying have to go through the 'New..' wizard.
Here's the image of the dialog I want to reach.
Select Window -> Preferences -> General -> Keys and search for New (Class). Click on Binding, press the keyboard shortcut you want, and click OK to configure the shortcut.
Press alt+shift+n it will give you a context menu from where you can select new class,package,interface
Ctrl+n will launch new wizard, there you can select the class/any to create new document.
There's an icon (C icon) in the header toolbar for creating class! Its available by default Just click it!
hit alt+shift+N and then click the respective first character for creating
the respective file. For example, let's suppose you want to create a new java class:
Hit alt+shift+N.
Hit c (stands for creating java class).
j (it will highlight the java package).
like this you can use shortcut keys as well as first character of the word what you want to create.
Hope this might help.
You could use Ctrl+3 to open the "Quick Access" Wizard and type in "java class"
on Mac alt(option)+command+N > displays a menu, scroll using arrow keys for appropriate selection and hit Enter.
You can use the New Java Class wizard to create a Java class. It can be invoked in different ways:
By clicking on the File menu and selecting New → Class.
By right clicking in the package explorer and selecting New → Class.
By clicking on the class drop down button and selecting class.
The shortcuts for basic Eclipse file management actions are different between Mac and Windows/Linux environment.
Check it out:
Visit for more Eclipse shortcuts.
First press
ctrl + n and then press c
then press Enter
press ctrl + n
press c (for selecting the class)
press Enter (for creating a class name)
and then class will easily created.

How to disable Ctrl Alt M in Eclipse?

When in a Java editor in Eclipse, pressing Ctrl+Alt+M inserts a new line (like hitting the enter key). How can I disable that? I did not find any corresponding entry in Preferences > General > Keys.
The same happens if I press Alt Gr+M (generally, Alt Gr seems to be the same as Ctrl+Alt in many cases).
Is there some other place where you can see/disable/change key shortcuts in Eclipse (or plug-ins?)
#msa, Go to : Window --> Preferences --> General --> Keys. Now type Ctrl+Alt+M in the search box. You will find a command named as "Add Memory Block" & an option below that "Unbind Command". Select the command & press the button. Now Click on "Apply" button & you're done.
In my case, it unbinds when binding it to another command (for example, maven install) when in Windows.
As stated by RAS, you can unbind the key combination functionality through eclipse preferences - > General -> Keys . Here's a screenshot for easy reference.

Is there a hotkey in Eclipse to "Open declared type"?

When hovering over a variable, one can go straight to its definition pressing F3. But what I'm looking for is for a way to go directly to its type definition, which I'm currently doing by pressing CTRL + clicking "Open declared type".
Is there a easier way to do this?
Assign a key stroke for 'Navigate > Open Hyperlink' command via 'Preferences > Keys'. (I use F6)
Now you can use this key stroke instead of using Ctrl+Click to bring up the hyperlink popup.
Not exactly what you are looking for, but this is the best solution I think.
There is another option, using Ctrl+Shift+t. This opens a window where you can look up any type you wish. This becomes a shortcut when you highlight your target, press Ctrl+Shift+t and hit enter. Imho Ctrl+Click is still faster.
If you would like to check any other shortcuts bind keys go to Windows -> Preferences -> General -> Keys
I've always relied on a combination of ctrl+shift+t and the hover options. I never thought of the key stroke assignment. I might try mapping a scroll button click, like opening a link in a new tab.
in Windows > Preferences > Keys
search for Go to Type and assign it a ctrl-f3 or shift-f3 (there is a conflict with ctrl-f3)

Adding Alt + Space shortcut in Eclipse

I am using win7 and eclipse with Aptana plugin for trying some examples on Ruby. But I can't figure out how to add Alt + Space as a shortcut in Eclipse (I want to add it to complete already defined variables). The issue is that when I try to add that combination (Eclipse reads the keys clicked) and the menu window appears in the top left -> it is shown when you hit the Alt key.
Does anyone has a hint how to add the shortcut?
I found similar post, but don't know how and where to add the code there.
Autohotkey, remap Left Alt + Space to Control + Escape
In Eclipse, the code-completion shortcut is Ctrl+Space (it's called Content Assist in Eclipse lingo). Is that what you're looking for?
I'm pretty sure it can be mapped to a different keyboard combination. Open Preferences and navigate to General > Keys and then search for the Content Assist command to re-map.

Is there a shortcut for switching between panels in eclipse?

Eclipse has an MDI structure (Multi Document Interface), so the search panel, the package explorer and the code editor can all be open in one window, but I haven't found a keyboard shortcut for switching between these panels. For example, after I search the code-base, I would love to have a quick shortcut for going back to the code editor.
If I understand your question correct, you are probably looking for Ctrl + F7 and Ctrl + Shift + F7. Other navigational shortcuts can be found in the menu: Window > Navigation.
Not an universal shortcut for going to any panel, but:
Ctrl+Shift+E
allows you to go back to any Editor (although it's still a little heavyweight for quick editor navigation).
And if you want to switch between perspectives its: Crtl + F8 and Ctrl + Shift + F8. You can go to Help > Key Assist... for a full list of shortcuts (this list will change depending on the active editor etc.).
There are two ways to do it.
One is how #VonC did it, in an earlier reply; using CTRL+SHIFT+E which opens a box containing all the panes with their paths.
The other one is to simply use CTRL+E, which will open a pop-up just over your cursor containing the list of panes open. Parse using arrows and ENTER