Android Studio/Intellij Idea: "Table of Contents" for a class
I have been messing around with Android Studio and so far I like most of what I have seen. One thing that has been annoying me though is this lack of "Table of Contents" for a class. I apologize for not knowing exactly what to call it. But what I am referring to is the dropdown menu in eclipse that lists all the methods, interfaces, classes and so on that are in that class file. This then allows you to jump to that position. This view is when you are in "Package Explorer" and click the arrow to the left of the class. This is one thing that makes me really miss eclipse. I know that you can easily search with Ctrl+F
inside a document but I often forget the method names. I tried looking through here but to no avail. Just wondering if anyone knows some way to handle this.
Solution 1:
IDEA has a tab called "Structure", which shows all the methods, fields, etc. of the currently-open class.
Solution 2:
I've just got a Tip of the Day popup in Android Studio helping with exactly this problem.
You can quickly navigate in the currently edited file with Ctrl/⌘+F12 (Navigate | File Structure).
It shows the list of members of the current class. Select an element you want to navigate to and press the Enter key or the F4 key. To easily locate an item in the list, just start typing its name.
Also, as danny117 points out, you can use Alt/⌘+7 to show / hide the same content in a side panel view (shown above in Chris Jester-Young's answer).
Solution 3:
View > Tool Windows > Structure
Solution 4:
In addition to what Chris Jester-Young
said, it's worth pointing out how to see the methods and properties of a class pointed by the cursor.
a) Type Ctrl + H
in the class pointed by cursor.
b) In the class name, in the hierarchy window, double-click the class name. The system, upon confirmation, will decompile and open the class code.
c) Alt + 7
(Windows) or Command + 7
(MAC) to display the structure window.
d) One can now visualize properties, methods, derived classes, derived interfaces, and even include inherited items. All related to the class under the caret.