So I have a case where Find Usages doesn't return hits from a particular class of mine. I'm using Android Studio 1.0.2. The class is used in a method paramter, is a part of the main source code base and module, and does pop up when I do a free text Find in Path
Have I somehow removed the file VgXitiLogger.java from indexing? Where in that case do I configure that?
Your "Find Usages" screenshot shows the usages of the constructor of the SearchPerformedEvent class, because you triggered Find Usages when the caret was on the constructor of the class. The occurrences on the second screenshot are usages of the class, not of the constructor.
Related
On windows, I know that we can search for all the methods in the current class by using Ctrl+F12.
Suppose, that I am in the class Car.java
and there we have a method called accelerate();
The method is really long and now I did some modifications at the end of this method. How can I jump back to the place where the method accelerate() starts?
I used Ctrl+U but that just does not do anything at all.
Refer to this page from IntelliJ's manual: Method navigation
It's Alt+Up or Alt+Down
I'm used to work with NetBeans and now I'm trying IntelliJ. So my question is: Does IntelliJ has a way to get right class by its methods?
For example, in NetBeans if I write:
glGenBu // Intellisense will kick in and will suggest me
to use GL15.glGenBuffers() method from GL15 class
This will automatically import the right library.
This is very handy because I'm working with LWJGL and it has a bad way to manage OpenGL methods ('GLXX' where XX is the version of OpenGL and all methods that appeared in that version are stored in that class) and I never remember the right class where my desired method is.
Thank you.
Pressing Ctrl+Space when you already see completion list will show more suggestions, with static methods from the entire project among them. See https://www.jetbrains.com/help/idea/auto-completing-code.html for more details.
is it possible to check the usage for multiple methods in a class at once in Intellij?
For example, class A has 100 methods. Instead of going over each single method and check if it is used, can we actually check some or all of usages for methods in this class at once in Intellij?
If you are purely looking for methods that are unused, and there are no errors in the source, you can just use F2 to jump between them.
Unused methods will be highlighted grey, with an underline.
Extract method can be used to extract a method to the same file, but if I want to move the method to another class, how would I go about doing that?
Updating this for anyone finding this through a search engine...
As of PhpStorm 7, moving static members is supported.
You can utilise this feature by right-clicking a static member and choosing Refactor > Move....
See also: https://blog.jetbrains.com/phpstorm/2013/09/move-static-member-refactoring-for-php-in-phpstorm/
Let's say I want to see how "copy" is implemented in the Dictionary class. Currently I use the system browser and manually traverse the inheritance hierarchy (bottom up) until I find the class that implements the given message. Is there a one-liner for the workspace, that would open the system browser at the right location?
( SomeClass whichClassIncludesSelector: #initialize ) browse
That will browse the class that implements the message #initialize.
Personally, I just type the #selector in a workspace, highlight it, and hit alt+m to pull up all implementors of the message. Much faster than typing all that code.
(SomeClass>>#someSelector) browse
works as well in my Pharo image.
works as well in my Pharo image.
And since you want to find a class first, you can combine it with previous example..
((SomeSubclass whichClassIncludesSelector: #someSelector)>>#someSelector) browse
to directly go to given method.
If you are using OmniBrowser, you can use the contextual menu Implementors in Hierarchy... to only browse the implementors of a selector in the hierarchy of the Dictionary.
OmniBrowser also provides an Inheritance Browser. Select any implementation of #copy and click on the Inheritance button in the toolbar. It will show you a hierarchical view of all implementors of #copy.