We help IT Professionals succeed at work.

eclipse shortcuts

327 Views
Last Modified: 2019-01-17
what is difference between below two eclipse short cuts

control +alt+h
(above does not yield any results saying members calling that method in workspace it shows at bottom again same method nothing else)

control +shift+g
(above shows like 8 references in workspace)

please advise
shortcut.png
Comment
Watch Question

CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Ctrl + Alt + h finds the callers of a method.
Ctrl + shift + g finds the references in the workspace.

Author

Commented:
Ctrl + Alt + h finds the callers of a method.
Ctrl + shift + g finds the references in the workspace.
how above two are different?
both sound like same thing to me?
any other most commonly used short cuts for day to day debugging?
Please advise
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Lets say you have a method firstMethod, that calls a method called secondMethod and the secondMethod calls another method thirdMethod. So you have:

firstMethod calls secondMethod calls thirdMethod.

If you do Ctrl + Alt + h on the thirdMethod it will find the secondMethod and the firstMethod. This is the call hierarchy.

If you do Ctrl + Shift + g on the thirdMethod it will only find the secondMethod. This is the reference.

Author

Commented:
If you do Ctrl + Alt + h on the thirdMethod it will find the secondMethod and the firstMethod. This is the call hierarchy.

If you do Ctrl + Shift + g on the thirdMethod it will only find the secondMethod. This is the reference.

Ctrl + Alt + h  is better to use right in that case compared to Ctrl + Shift + g as call hierarchy already has reference?
If it has more than 1 reference say secondMethod also calls fourthMethod apart from thirdMethod does it show both of them?

Please advise

Also how to track reverse/opposite way like thirdMethod called by secondMethod etc.?
fourthMethod called by secondMethod?

Say i have some functionality called AddUser button in the UI goes through some Business Layer then DAO layer then persists the data to database. In this case how to find all the complete call hierarchy of the calls to understand the flow? any good tips around this?
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Ctrl + Alt + h  is better to use right in that case compared to Ctrl + Shift + g as call hierarchy already has reference?
Ctrl + Alt + h returns more information, so if you just want to find the references better use ctrl + shift + g, otherwise go for the call hierarchy.

If it has more than 1 reference say secondMethod also calls fourthMethod apart from thirdMethod does it show both of them?
For this you will have to do Ctrl + Alt + h on the fourthMethod.

Also how to track reverse/opposite way like thirdMethod called by secondMethod etc.?
fourthMethod called by secondMethod?
This is the Ctrl + Alt + h. What you describe is the call hierarchy.

Say i have some functionality called AddUser button in the UI goes through some Business Layer then DAO layer then persists the data to database. In this case how to find all the complete call hierarchy of the calls to understand the flow? any good tips around this?
You will have to perform Ctrl + Alt + h always on the last method (the lower the method, the better).

Author

Commented:
If you do Ctrl + Alt + h on the thirdMethod it will find the secondMethod and the firstMethod. This is the call hierarchy.
     
I wrote as below and tried above step but it is showing second and first.(i have to expand small arrow next to secondMethod though which i never observed until now)

void firstMethod (){
            secondMethod();
      }
void secondMethod (){
      thirdMethod();
      }

void thirdMethod (){
      
}
call_hierarchy.jpg

Author

Commented:
I see call references by doing control shift g as attached which found who is immediate member calling it
call_REFERENCES.jpg

Author

Commented:
For this you will have to do Ctrl + Alt + h on the fourthMethod.
if i do not know which is starting method or end method or middle methods etc. how to use these shortcuts to find the entire call hierarchy?

Author

Commented:
I see call references by doing control shift g as attached which found who is immediate member calling it
i see reference search coming in search window where as call hierarchy comes in new separate window
i wonder why?
please advise
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.