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
LVL 7
gudii9Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

girionisCommented:
Ctrl + Alt + h finds the callers of a method.
Ctrl + shift + g finds the references in the workspace.
gudii9Author 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
girionisCommented:
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.
Maximize Customer Retention with Superior Service

The IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more to help build customer satisfaction and retention.

gudii9Author 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?
girionisCommented:
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).
gudii9Author 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
gudii9Author Commented:
I see call references by doing control shift g as attached which found who is immediate member calling it
call_REFERENCES.jpg
gudii9Author 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?
gudii9Author 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
girionisCommented:
I think I have answered all of your questions.

In general:
1) control + shift + g finds the immediate caller (the references)
2) control + alt + h finds the call hierarchy (you will need to expand the arrow in order to see all callers).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.