Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

eclipse shortcuts

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
Avatar of girionis
girionis
Flag of Greece image

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

ASKER

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
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.
Avatar of gudii9

ASKER

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?
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).
Avatar of gudii9

ASKER

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
Avatar of gudii9

ASKER

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

ASKER

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?
Avatar of gudii9

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial