How to Display Current Function in Eclipse - 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.

Related

Where is the Variables Menu gone in the new Dymola UI?

Until Dymola 2020, now and then I used the Edit->Variables menu to set annotations. Where do I find it in the new UI in 2020x?
Edit->Variables:
I think the dialog you are referring to is available using one of two ways:
via the context menu, after a right-click. Within the "Variables" menu you will need to select the variable you want to edit from the list shown there.
If you select a variable before doing the right-click, it will be highlighted and moved to the top of the list of available variables as shown in the above screenshot.
Additionally it should be possible to access the dialog by highlighting the variable and pressing CTRL+Shift+N, but that does not work reliably for me...
Using the component browser (after enabling the "Include non-graphical" option, which is marked red) by right-clicking the variable you want to edit and then select "Variable..."
You can also find it in the GUI in the Text tab - well hidden inside the Insert button:

How do I get rid of this toolbar in Eclipse?

How do I get rid of this toolbar shown in the picture? I fatfingered some keys and now I can't get rid of it, primarily because I'm not 100% sure what it is...
This is in the normal Java perspective. I've tried resetting the perspective, but that didn't work.
The annoying toolbar you're describing is called the Java Editor Breadcrumb (see Eclipse documentation)
It can be disabled by pressing Ctrl + 3 and toggling Java Editor Breadcrumb
That's the breadcrumb bar. It shows the details of the location of the class you're currently editing. It's useful to quickly see if you're editing the correct class, and you can use it to navigate to other locations in your project as well.
If you want to turn it off click this button in the toolbar:

How to remove eclipse project explorer above the editor?

When I was working on a project for my program fundimentals class I somehow got this miniature project explorer above the editor in eclipse, I have tried to look for a solution on google but I don't think i'm asking the right question so this was my final place to go.
Here is a screenshot of my eclipse:
That is the breadcrumb view.
To toggle it on/off:
Shift+Alt+B (by default on Linux)
Right click in editor and choose Show in breadcrumb
Ctrl+3 to open up quick access (or click in quick access) and type breadcrumb and select the toggle command as in this screenshot:
Click this icon in the tool bar
Yeah that is annoying, the workspace is cluttered enough. I was trying to simply minimize the explorer area so I could see the whole line of code and I eneded up activating this breadcrumb mode. Looks like:
FILES/PREFERENCES/SETTINGS/WORKBENCH/BREADCRUMBS/DISABLE

Eclipse code template to insert a bookmark?

Eclipse has a nifty feature which allows you to define "templates" for code. I have created one to automatically put in a println and add a "TODO" comment. I'd like for this to also add a bookmark so I can easily find it again.
(The codebase I am working with makes it unfeasible to use just the Task List to find what I need to do since there are a lot of TODOs laying around.)
My current template is simply System.out.println("don't commit me!"); //TODO: fix this ${cursor}.
A bookmark is part of the editor.
You can find all of your TODO comments in the Eclipse Tasks view. If the Tasks view isn't open, just left click on Window -> Show View -> Tasks (not Task List).
If you left click on the Tasks description to make sure the Tasks view has focus, then double click on the Tasks description, Eclipse will open the editor and take you to the TODO line.
If you have the code already open in the Eclipse editor, Eclipse draws blue rectangles on the right side of the editor to mark all of the TODO comments. Left clicking on the blue rectangles will take you to the TODO comment line.
Edited to add: You can sort the Tasks view by clicking on any of the titles, like Resource.
I don't think it's possible via a code template.
It's certainly possible with the a key shortcut that can be assigned to add bookmark in:
Window->Preferences->Keys
but you still have the prompt to enter the name of the bookmark (rather than use a default set of text).
If you really want to get close to the functionality you want you could take a look at the Eclipse Bookmarks plugin:
http://www.etc.to/eclipse_bookmarks_plugin
and maybe hack it to do what you want... (if it doesn't already)...

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