Sources:
Java All-In One Desk Reference For Dummies, Second Edition
Misc
Compare files that aren’t in an Eclipse project
-
Open the Quick Access search box
- Linux/Windows: Ctrl+3
- Mac: ⌘+3
-
Type compare and select Compare With Other Resource
-
Select the files to compare > OK
Three-way compare
Alternatively, use Meld
-
Select the first file, then hold down Ctrl and select the other two files
-
Right-click > Compare With > Each Other
- Select the common ancestor (if you’re merging the changes from file a to file b into file c, this is file a)
- If the file you want to merge the changes into (file c) is on the left, click the button on the top-right that says “Copy All Non-Conflicting Changes from Right to Left” (and vice-versa if the file you want to merge the changes into is on the right).
- Lastly, starting at the top of the page, click the Next Difference button to make sure all of your customizations in file “c” have been preserved, and then click save.
Upgrade Eclipse
-
Get the update site for the version you want to upgrade to:
-
Help > Install New Software > Work with > Add > Location > paste the update site you got from the previous step > OK > Cancel
-
Help > Check for Updates > follow the steps to upgrade Eclipse
Debugging
Step into
Executes the highlighted statement, and then suspends the thread
Step over
Skips the highlighted statement and executes the next statement, and then suspends the thread
Step return/run to return
Executes the highlighted statement and continues executing statements until the end of the current method is reached. Then, the thread is suspended
Tips
- Position the mouse cursor over a variable in the code pane when debuggin to get that variable’s value
Refactoring
Lets you change all occurrences of the thing you’re refactoring (variable, method)
Refactor > Rename
Refactor > Extract
Lets you create a separate method from one or more statements. select the statement(s) then choose extract
Refactor > Extract local variable
Replaces a repeated expression with a variable