for example I have this code
categoryCT.getInsertedItems();
and I want shortcut to generate code like this
List<Category> insertedItems= categoryCT.getInsertedItems();
Eclipse can't help you with the variable name but you can write:
insertedItems = categoryCT.getInsertedItems();
This will give you a compile error.
If you press Ctrl+1 anywhere in this line, Eclipse will offer "Create local variable 'insertedItems'"
Fewest keystrokes to get the desired result:
catCT
Ctrl+Space -> categoryCT
.getII
Ctrl+Space -> categoryCT.getInsertedItems()
;
The shortcut that works on my Mac is ⌘ 2 + l (lowercase L key)
Steps:
categoryCT.getInsertedItems();
; This will create the line List<Category> insertedItems= categoryCT.getInsertedItems();
.
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.
Just uses eclipse's quick fix: Cmd+1. after type categoryCT.getInsertedItems(), then click Cmd+1 when the cursor is at the end.
Ctrl+2, L 会做你想要的。
Alt + Shift + V: in NetBeans Extracts an existing expression or statement into a new variable. For example, the statement appears multiple times so it should be introduced to a variable:
textEmail.getText()
String text = textEmail.getText()
Select statement then the Introduce Variable dialog appears. Introduce Variable dialog Enter the variable name and click OK.
Note that the scope of the newly introduced variable is local.
我不认为我看到了Alt+Shift+L
,但这有效,如果你的右手分配是唯一的东西,你甚至不必突出它
In IntelliJ IDEA you can use ctrl + alt + l.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.