for example I have this code
categoryCT.getInsertedItems();
and I want shortcut to generate code like this
List<Category> insertedItems= categoryCT.getInsertedItems();
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()
;
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.
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 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
Just uses eclipse's quick fix: Cmd+1. after type categoryCT.getInsertedItems(), then click Cmd+1 when the cursor is at the end.
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.
for me option+command+L
worked on mac with apple chip.
Alternatively, you can select your statement that you want to extract a local variable and right click then from menu options go to refactors
and you should be able to find the Extract Local Variable
as option.
© 2022 - 2024 — McMap. All rights reserved.
categoryCT.getInsertedItems()
since that's what you want to assign. – Wooley