How to easily see the name of the current method - eclipse

When I used Visual Studio with C++ there was a nice combo box where you could always easily see the name of the method in which the cursor was. Is there something similar in eclipse for Java (except of Outline, of course)?

You can switch on a breadcrumb like bar in the top of Java editors. Right-click a Java editor an select Show in breadcrumb or ShiftAltB.
You can also select elements of every level, the dropdowns also allow to expand into deeper levels.

if you hover your cursor over the closing bracket of a method or class then it will show you the name of the method/class that the bracket belongs too

Related

How to add text hovers for generic eclipse editor- generic text hover for all text editors

I want to display a text hover functionality in Eclipse editors without contributing a new editor. That means my hover functionality shall work on CDT editor ,JDT editor (java editor) and all other text editors.Is their any generic extension point is present for this purpose ? I know, for java editor org.eclipse.jdt.ui.javaEdit or TextHovers is there and for CDT editor org.eclipse.cdt.ui.textHovers is there. But I want the hover shall work in all type of editors. is there any extension point present for this?
Thank you in advance.
I think what you are looking for is the org.eclipse.jface.text.ITextHover extension point and then write a class that implements ITextHover which allows you to specify an IRegion for areas where the hover should be displaye dand then another method for displaying hover text based in cursor position.

Visual Studio variables/methods outline and dropdown options?

Eclipse has something like this showing you the outlines of method declarations, imports, variables...
Is there something similar in Visual Studio 2010? I can't seem to find it.
Another thing is the context menu dropdowns.
In Visual Studio, I have to click on the underlined word:
And wait for that little blue underscore to pop up then I have to carefully hover over it like so:
for the drop down menu to pop up. Then I have to click on it to bring up the options.
In Eclipse I can hover over the underlined word and get the options about half a sec later OR hover over it and press F2 immediately to get the options.
Does anyone know if such features are available in VS2010?
For your first question, there is a window called "Class View" that may be similar to what you want. You can access it via CtrlWC.
For your second question, if your cursor is on the identifier that is underlined, you can type either of the following in order to open that same context menu:
Ctrl. (that's a period or dot)
AltShiftF10

Does Eclipse have a plugin for code clips like in Coda?

There is a very useful "Clips" feature in Coda, does Eclipse have such feature?
What it does is pretty simple, you save a code clip once, which you use very often and assign it a shortcut and when you want to re-use you type the shortcut and it automatically pastes it and sets the caret at the defined position.
e.g. when I type 4dom and press TAB it types this:
jQuery(function($){
//puts cursor here
});
so, how do you do this in Eclipse?
In Eclipse they are called Templates. You can find this in Window->Preferences then JavaScript/Editor/Templates.
It will allow you to create or edit.
Similar function in Eclipse is called Snippets.
Find it by doing this:
click on Window > Show View > Other > General > Snippets

How to Display Current Function in Eclipse

I miss a certain functionality in Eclipse. I would like to know the name of the current function the cursor is currently inside. This is useful when browsing unknown code using the search function, for example.
Any idea how to show it? Maybe a plugin?
I'm using the "Toggle Breadcrumb" option from toolbar:
It shows a nice breadcrumb, ending with current function name.
It's quite handy for me, as Outline becomes cumbersome to use if you have zilions of functions.
It produces the following structure above your Java Editor (truncated at the picture below):
The "Outline" view shows the current function.
It may be necessary to enable the 'Link to Editor' option in the Outline View dropdown menu. This might be off by default for CDT.
I was looking for something similar (Xcode-like bar at the top showing the current function, where you can also go to another function by clicking on it to open a popup list of functions). Here is what I settled on with Eclipse 3.5.1 CDT:
I moved the Outline view to the top, resized it to make it a 1-line horizontal strip (don't make it too narrow), and selected "Link With Editor" in its menu, so that it always shows the current function. However, this doesn't open a popup list like Xcode. For that functionality, I assigned a shortcut to the "Show Outline" command which does open a popup list of all functions.
The Eclipse function 'show outline' will pop up a list of outline objects, and it will highlight the object your cursor is inside in grey. It's typically bound to 'ctrl-o' (the letter 'o', not zero), but you can re-bind it as you see fit. I'm running Eclipse with the CDT plugin and it works pretty well for me.
To enable the breadcrumb invoke Toggle Java Editor Breadcrumb in the toolbar or press Alt+Shift+B in the Java editor.
You can also display the Quick Outline (ctrl+o). This way you see the context quickly without having to have a permanent Outline Window linked to the Editor.
Use the "Link With Editor" option on the outline menu
Press Ctrl+o (cursor is currently inside a function at a particular line).
It highlights the current method, or name of the class if the cursor is outside the method body.
You can click on highlighted method.
It has got inline search feature ...start typing name of the method to navigate to the specified method or method with matching search pattern.
If you press again Ctrl+o to shows the inherited members/methods.
Using outline with "link with editor" option worked also for me, thanks!
Just an addition, you can move outline pane in to the same window group as search, progress etc. saves the space in your perspective instead of keeping it at another group.

short for custom surround with

Is there any shortcut for surrounding any selection with a template from "Surround With..."?
In this special case, I defined a surround with brackets template... It would be a great enhancement to have such a shortcut.
Thanks for your help in advance.
The only shortcut I know about for surround templates
(that is for templates with ${line_selection} variable in their definition)
has been introduced in eclipse 3.2 (refined actually in eclipse3.2 M4)
It is the "Surround With Quick Fix" mechanism
(source: kano.net)
Assign a shortcut to Quick-Fix (CTRL-1 by default), and if your selection is eligible ((contains a line), all compliant templates will be displayed in the Quick-Fix dialog.
You will then be able to choose the appropriate surround template (like the one you defined).
Answer from #VonC is not working on Eclipse Kepler. Use short cut for show surround with quick menu.
Select one or more lines in java editor press Alt + Shift + Z then you will get the popup context menu as shown below(Menu items differ based on the region of selection).