26

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?

Alobar
  • 73
  • 1
  • 8

9 Answers9

46

I'm using the "Toggle Breadcrumb" option from toolbar:

Eclipse Breadcrumb button

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):

Eclipse Breadcrumb path

Alobar
  • 73
  • 1
  • 8
antoni.rasul
  • 648
  • 6
  • 12
29

The "Outline" view shows the current function.

enter image description here

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.

Martin Flaska
  • 673
  • 7
  • 10
Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
  • 7
    maybe this is different for Java development in Eclipse (I use Eclipse+CDT for C development), but the outline view doesn't tell you what function your cursor is in - it just lists all objects, and provides hyperlinking. This question is specifically about how to tell where you are "right now"... – dls Oct 03 '09 at 21:33
  • 1
    @dis Thank you for your enlightening comment but I actually perfectly understood that the question is about telling the user where he is "right now". To my knowledge, this is one of the features of the outline view in Java, Ruby, Lisp... And when I look at this article http://www.ibm.com/developerworks/opensource/library/os-ecc/, it seems to apply to C/C++ development too. BTW, did you see somewhere that the OP was doing C development? I didn't. – Pascal Thivent Oct 03 '09 at 22:17
  • 1
    @Pascal: Fair comment about C development. However, the reference article contains two sentences about Outline View in the CDT and neither of them describe the behavior this gentleman was after. Couple that with the fact that the Eclipse/CDT installation I'm currently using does not exhibit this behavior and it becomes perfectly reasonable for me to make the comment I did. Also, please be conscious of the tenor of your responses. – dls Oct 04 '09 at 00:52
  • 30
    The trick is to enable the 'Link to Editor' option in the Outline View dropdown menu. This seems to be off by default for CDT. – Quantum7 Jul 15 '10 at 23:45
  • @PascalThivent: It may be worth mentioning the "Link to Editor" option in your answer. – David Feb 03 '16 at 20:51
14

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.

cornelius
  • 147
  • 3
  • 5
  • Thanks a lot, without your answer I probably would have never discovered the "Link with editor" option and remained thinking that this functionality is not available in CDT! – atzz Dec 06 '10 at 12:47
7

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.

dls
  • 4,146
  • 2
  • 24
  • 26
5

To enable the breadcrumb invoke Toggle Java Editor Breadcrumb in the toolbar or press Alt+Shift+B in the Java editor.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
pradip garala
  • 482
  • 8
  • 7
3

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.

Llopeth
  • 406
  • 5
  • 11
2

Use the "Link With Editor" option on the outline menu

Nir
  • 1,618
  • 16
  • 24
1

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.

Sree Rama
  • 1,207
  • 12
  • 25
0

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.

Olgun
  • 1
  • 1