Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate local variable to receive the return value of a method eclipse

Tags:

java

eclipse

for example I have this code

categoryCT.getInsertedItems();

and I want shortcut to generate code like this

List<Category> insertedItems=   categoryCT.getInsertedItems();
like image 205
Mohammed Subhi Sheikh Quroush Avatar asked Jul 23 '13 10:07

Mohammed Subhi Sheikh Quroush


People also ask

What is the shortcut key for return type in Eclipse?

CTRL+2,L and ALT+CTRL+L can get the job done for you. you can press any key of these four as u need it.

How do you call a method in eclipse?

Select mymethod() and press ctrl + alt + h .

Where is method declaration in Eclipse?

You can open any method or type in your workspace using the "Open Type" wizard or the "Open Method" wizard. -Or- press Ctrl+Shift+T (for a type) or Ctrl+Shift+M (for a method). The "Open Type/Method" dialog will appear. If a type/method was previously selected in the editor or outline views, it will be displayed.


2 Answers

I don't think I saw Alt+Shift+L, but that works and if your right-hand assignment is the only thing on the line, you don't even have to highlight it

like image 118
Dilettante44 Avatar answered Sep 29 '22 05:09

Dilettante44


I'd add for windows users:

Press ctrl+2 for the available options.

For ex. ctrl+2+L will assign your statement to a local variable.

like image 31
Shanu Gupta Avatar answered Sep 29 '22 05:09

Shanu Gupta