ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

Call Hierarchy With IntelliJ IDEA

2021-10-07 07:31:26  阅读:543  来源: 互联网

标签:IntelliJ Hierarchy tool hierarchy window Call method methods


https://www.jetbrains.com/help/idea/viewing-structure-and-hierarchy-of-the-source-code.html

With IntelliJ IDEA, you can examine the hierarchy of classes, methods, and calls and explore the structure of source files.

Build hierarchies

  • Type hierarchies show parent and child classes of a class.

  • Method hierarchies show subclasses where the method overrides the selected one as well as superclasses or interfaces where the selected method gets overridden.

    In the hierarchy tree, IntelliJ IDEA displays the method should be defined icon to indicate subclasses that are not abstract but don't have the method defined in them. When a method is not defined in a class, but is defined in the superclass, IntelliJ IDEA displays the method not defined icon.

  • Call hierarchies show callers (supertypes) or callees (subtypes) of a method.

    If you invoke the call hierarchy on a field, it will show you the list of the methods where the selected field is used.

When built, a hierarchy can be immediately viewed and examined in the Hierarchy tool window. By default, every new built hierarchy overwrites the contents of the current tab. You can retain the current tab and have the next hierarchy built in a new one.

Build a type hierarchy

  1. Select the desired class in the Project tool window or open it in the editor.

  2. From the main menu, select Navigate | Type Hierarchy or just press Ctrl+H.

    Class hierarchy shown in the Hierarchy Tool Window

     

Build a method hierarchy

  1. Open the file in the editor and place the caret at the declaration of the desired method.

    Alternatively, select the desired method in the Project tool window.

  2. From the main menu, select Navigate | Method Hierarchy or press Ctrl+Shift+H.

Build a call hierarchy

  1. Open a file in the editor and place the caret at the declaration or usage of the desired method or a field.

    Alternatively, select the desired method or the field in the Project tool window.

  2. From the main menu, select Navigate | Call Hierarchy or press Ctrl+Alt+H.

Retain a hierarchy tab

  • In the Hierarchy tool window, click the Pin Tab button Pin button on the toolbar.

View hierarchies

Open the Hierarchy tool window

  1. Make sure, you have already built hierarchies to show, see Building hierarchies above.

  2. Select View | Tool Windows | Hierarchy from the main menu.

Navigate between the tabs

  • Click the currently displayed tab and select the next one to display from the list.

Toggle between views

  • With IntelliJ IDEA, you can build and explore ascending or descending hierarchies, that is, callee or caller methods, parent or children classes, and so on.

    Click the Caller Hierarchy toolbar button or the Callee Hierarchy toolbar button to show caller methods or callee methods respectively.

 

Hierarchy tool window buttons

==============

 

https://www.jetbrains.com/go/guide/tips/call-hierarchy/

 

Call Hierarchy

Analyze call trees for functions or methods

<iframe data-gtm-yt-inspected-1_25="true" data-gtm-yt-inspected-58776_780="true" frameborder="0" height="360" id="vjs_video_3_youtube_api" src="https://www.youtube.com/embed/alp6DFEuFYw?controls=0&modestbranding=1&rel=0&showinfo=0&loop=0&fs=0&hl=en&list=PLM-t1Z4tbFflkIOaap4P-BV30ZrZwrDld&enablejsapi=1&origin=https%3A%2F%2Fwww.jetbrains.com&widgetid=1" title="YouTube video player" width="640"></iframe>    

Call Hierarchy allows you to quickly see all the places where a function or method is used.

How to use:

Press Ctrl + Alt + H on Windows/Linux⌥ + ^ + H on macOS, and the Call Hierarchy tool window will open up with all the places that the function is called inside.

Pro tip:

This works for interface methods, type methods, methods, and calls.

You can then drill down into the call chain to see where those other functions are called.

Speed Typing is available to help you quickly navigate to the element you need.

New in 2017.3

标签:IntelliJ,Hierarchy,tool,hierarchy,window,Call,method,methods
来源: https://www.cnblogs.com/kungfupanda/p/15374896.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有