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

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

Related

How to set shortcut to a line of code in Eclipse IDE editor

I'm after a feature in eclipse that allows me to allocate a shortcut to a line (say line number 55) then go somewhere else in the same file and hit the shortcut then IDE shows me the line 55. I have used this feature in Delphi IDE. Using CNTL + number keys[1,2,...,0] a shortcut to line where the curser is will be created. This shortcut only has effect within the editor and each opened file would have its own shortcuts.
Is there such a feature in eclipse? Is there any plugins out there which adds this feature to eclipse?
Regards,
Ali
By default there is no shortcut defined for this task.
I use to define my shortcuts in Eclipse in "Windows/Preferences/General/Keys" type bookmark in the filter text and select the commands you want to define the shortcuts.
My current shortcuts are:
Alt+Shift+B, Alt+Shift+A: Add Bookmark;
Alt+Shift+B, Alt+Shift+V: Show View (BookMarks);
But, I agree, still is not fast as the Delphi predefined shortcuts.
Update 1:
This plugin (or its sucessor) seems to offer the option. From their site:
Add a numbered bookmark at the cursor: Alt>+[digit]. This creates a
quick bookmark with the specified number using a "single" keypress.
Only one bookmark of the given number can be present in the workspace.
Setting the same number bookmark again will clear the earlier
instance.
Goto a numbered bookmark: Alt+Shift+[digit]. Moves to the bookmark as
it was set using Alt+[digit].
Update 2:
Tested (Eclipse Indigo) and it worked like a charm.
You can add Bookmarks to the code fragments you think are important to you in eclipse.
I referred this link for the same purpose.

does eclipse have a feature whereby I can find all instances of a specific label?

I know I can just grep it, but I was wondering if Eclipse has a built in feature where I can highlight a public class member and get a list of all the places where it is being used in the package.
TIA
Yep, right click on the member (I usually left click first and wait for Eclipse to highlight the member to make sure it knows what I want to search for) and choose Open Call Hierarchy for methods or References > Workspace for fields.
Highlight the class member and press ctrl + shift + g to find references in the workspace
Click Group by Package in the toolbar:
Click the View Menu arrow icon in the toolbar and select Show as Tree in the popup menu
Locate the desired package in the treeview and expand it to see results
I don't use Eclipse for Java, but in CDT, you can right click and select References->Project to do this.

How to Ctrl+Shift+Space shortcut shows method help on eclipse?

In eclipse, when mouse pointer moves over on method help hint shows. I want to show method help on eclipse like Visual Studio. When I pressed Ctrl+Shift+Space when cursor inside method parenthesis, I want to see method help as hint. How can I do it? Which shortcut's setting should I change?
PS: Netbeans IDE completley works as I wanted, but I want to do same in eclipse.
You can use the JavaDoc View (View -> Show View -> JavaDoc / Alt+Shift+Q,J) to show the JavaDoc of the method your text cursor is inside. Or place the mouse cursor over the method name and the JavaDoc will be presented as tooltip.
F2 (Show Tooltip decription) will give you the JavaDoc as mentioned in your question update. Ctrl-Shift-Space gives you Context Information (e.g. list of all possible methods) and you probably won't lose this due to new declaration.
In General > Editors > Keys look the command should be "Show tooltip description", which is binded to F2 as default (same effect as the hover tooltip)
File -> Settings -> Editor -> General
In the other Section you will find - "Show quick doc on mouse move"
Just mark the checkbox to help in 500ms(Time delay is changable)

What are the shortcuts keys for Netbeans code folding?

Does anybody know a shortcut to fold/unfold (collapse/expand) all classes/methods in a php file using netbeans?
To Collapse: Ctrl+Shift+Minus (on the keypad)
To Expand: Ctrl+Shift+Plus (on the keypad)
This works regardless of what language your using, (Tested on PHP, HTML, CSS & Javascript)
But you can find out the keyboard shortcuts easily yourself, and even change them:
Open the Options Dialog (Tools -> Options)
Then Select Keymap
Enter "Collapse" into the input field labelled "Search" and all shortcuts for that action are displayed. You can do the same for "Expand All"
I found the Collapse All function to be a pain because it even collapses the nested blocks inside of your methods. There seems to be no collapse methods shortcut.
If you are like me and just want the methods and comments collapsed by default this can be configured in the preferences.
Under Editor->Folding in your Preferences click on the language dropdown and select PHP.
Check the 'Functions and methods' checkbox.
Check the 'PHPDoc documentation' checkbox.
This will probably yield the result you are looking for.
I also like to uncheck the 'Show summary' checkbox to reduce visual noise.
You can still use the Expand All shortcut key as described in the other post if you wish to see everything.

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.