Identify the superclass or interface on which a method is being called in the Java editor of IntelliJ 2018? - intellij-idea

Is there a quick easy way to have IntelliJ identify the superclass or interface defining the method being called in a class?
For example, in the following example, the fireEvent method is being called on the implicit this but this method is not defined within this Java class being edited in IntelliJ 2018.3. Is there some way to ask IntelliJ which of the several interfaces being implemented as well as any parent in the superclass hierarchy defines this particular method?
…
private void doIt() {
…
fireEvent( event ) ;
}
What I am asking is for the opposite of this Question, Does IntelliJ have the equivalent of the Eclipse “method view”?. That Question asks “for a given class, what are its methods offered?”. I am asking “for a given method being invoked, from what inherited superclass or interface is that method defined?”.

I generally just context-click (Ctrl-click on PC, Command-click on macOS) to navigate to the source for a method. The .java file of the superclass or interface opens in the editor.
In order to avoid navigating away, you can also context-hover. Another option is showing the javadoc via context-q when the cursor is somewhere in the method name.

Related

Where is some methods implemented in the Kotlin source code?

If I want to find out how any method is implemented in Java, I can always move to its declaration by pressing Ctrl+B on it in my IDE (IntelliJ IDEA) and then jump to the implementation with Ctrl+Alt+B.
However, in some cases for Kotlin, my IDE only writes No implementations found. For example, I found no implementation of any methods in Kotlin's ArrayList and LinkedHashMap.
Where should I look for a method implementation in this case?
After clicking CTRL+B you should be moved* to TypeAliasesKt.class to this line:
#kotlin.SinceKotlin public typealias LinkedHashMap<K, V> = java.util.LinkedHashMap<K, V>
with cursor on the left side, move it to right side and click CTRL+B again, then you should be moved to source. It's because LinkedHashMap is just an typealias of java LinkedHashMap.
*in this place there should be prompt window asking about decompiling sources, you should click Yes.

Intellisense - deduce right Class by its methods

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.

Pharo/Squeak - How do I quickly browse the implementation of a given method in a given class?

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.

Flex Interface method createAutomationIDPartWithRequiredProperties error

I'm currently creating a class that extends UIComponent in Flex 3, but when the flash builder try to compile show me some errors
1044: Interface method createAutomationIDPartWithRequiredProperties in namespace mx.automation:IAutomationObject not implemented by class components:ArtWorkImage
1044: Interface method get automationEnabled in namespace mx.automation:IAutomationObject not implemented by class com.senocular.display:TransformTool
I see that UIComponent implements this interface, but I had never had this error before, I'm assuming UIComponent should made this implementation by default, so it should be something else, I already try to recreate the project or clean it, with no result, can someone please point me how maybe this can be fix, thanks for your help
oh btw I had this project before in flex builder, exported as a FXP and imported in Flash Builder, thanks!
All UI objects use an Automation delegate to handle implementation of the automation interface. Each UIComponent has a specific automation delegate registered with the Automation Framework. These automation delegate implementations are injected into the object by the Automation framework when the object is created according to the class name of the object.
For example:
UIComponent <- UIComponentAutomationImpl
ToolTip <- ToolTipAutomationImpl
DateChooser <- DateChooserAutomationImpl
Normally if you subclass a component you should inherit the Automation Implementation. However depending upon how the instances of the object are being created the automation framework may not be able to resolve the class name to the appropriate super class. In this case you may need to take additional steps to get the automation implementation into your class.
If you want your class to automatically be injected with a particulary automation implementation you should call the static registerDelegateClass method on the mx.automation.Automation class.
import mx.automation.*
Automation.registerDelegateClass(com.foo.bar.ArtWorkImage, mx.automation.delelegates.core.UIComponentAutomationImpl);
Alternatively you could directly implement the IAutomationObject methods in your UIComponent or create your own delegate class and instantiate and "inject" it into your class in its' constructor thereby by passing the Automation framework.
Here are few links that might help you understand the automation framework:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/automation/Automation.html
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/automation/delegates/core/UIComponentAutomationImpl.html
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/automation/package-detail.html

Showing inherited methods in Squeak/Pharo Smalltalk

I'm familiar with the VisualWorks and Dolphin versions of Smalltalk, but have not previously used Squeak. I'm just familiarising myself with Pharo, which is a 'cleaned up' fork of Squeak.
I'm used to having the facility in the Class Browser to show either only the methods implemented by a class or both the methods inherited and the methods implemented.
Is this useful facility missing in Squeak, or have I just been unable to find it?
You can double-click on any class to open a Hierarchy Browser on that particular class. The hierarchy button in the toolbar and the menu entry browse hierarchy (Ctrl+H) open the same view.
There is the Inheritance Browser that shows you the hierarchal implementations of the currently selected method. Click on the inheritance button in the toolbar.
Furthermore there is the Protocol Browser that displays all methods and super methods of a class together. To open this browser select browse protocol (Ctrl+Shift+P) in the context menu of the class.
If you want to build a browser with that behaviour, you should take a look at the Glamour browser construction DSL.
I personally do not feel the need to see all 34 pages of method names defined in ProtoObject and Object, or the 5 pages of method categories. Object methods size prints 421.
AFAIK in the GemStoneTool there is such a thing, thre is a 1 or so and a # which seems to change the view to see all the methods available in a class (be it inherited or in the class itself) I'm as amazed as you that nothing like that exists in "standard images". Maybe the users know the libraries for ages, and maybe they remember enough to not bother. ....