Search usages of Subclass's method - intellij-idea

I have parent class Parent with method getToken(). And I have its child class - ChildA and ChildB, which don't override method getToken().
How I can search usages of method getToken() which used by instance of class ChildA?
Sorry for my English. Thanks!

As I spent half an hour to find the exact solution through all complicated and outdated documentations and examples, I just put the full answer using SSR here (Intellij 15.0.5):
Open SSR dialog (Edit > Find > Search Structurally...) and input template in screenshot, then click on "Edit variables..." to see the second dialog and edit the "Expression type (regexp)" as shown:
and if you want to include subclasses of ChildA too, just check the box "Apply constraint within type hierarchy" bellow the expression type:

You can add getToken() to ChildA, perform the search only for this method, then delete it. Another way is to use Structural Search and Replace.

Intellij asks about this if you use Ctrl+Alt+Shift+F7 for the search. First you have to explicitly override the method in the subclass/subinterface though, as CrazyCoder suggested.

Related

Show overloads of a method in Intellij

Often times I know what method to use but not what overload of that method. Is there a quick way to show all overloads of a method in Intellij?
Just use Code Completion Cmd/Ctrl+Space?
It is also possible to show overloaded constructors by enabling a hidden option. Invoke the Help | Find Action menu item and type Registry to go to the Registry. Here enable the java.completion.show.constructors option.
When you already have the complete method or constructor name, and just want to know which parameters it and its overloads accepts, use View | Parameter Info Cmd/Ctrl+P.

Finding where class constructors are called in IDEA

In Eclipse, you can focus on class XXX and press Ctrl+Alt+H, to get a call hierarchy showing everywhere that new XXX(...) is called.
In IntelliJ IDEA, I can only do this on each constructor separately, and I can't do it at all on the default constructor (invisible).
Is there a way in IDEA that I'm missing? (Ultimate 12.1.3)
If I'm understanding your question correctly - one way you can do this is to select the classname (instead of an individual constructor name) and press Alt+F7 (Find usages).
This will find all usages of that class - the "Found Usages" window that will be displayed is split up into expandable sections, one of which will be "new instance creation".
NOTE: if you can't see a New instance creation grouping, makes sure Group by usage type is enabled (the "funnel" looking icon in the screen shot below).
In IDEA 2017.2, it looks like this:

JavaFX 2 define onChange listener in FXML

I am busy teaching myself FXML.
I'm doing this by following this example.
It's a simple text editor.
However, in the tutorial everything is Java code.
I myself am using FXML to seperate the view of the logic.
I currently face the following challenge:
I have defined an TextArea in my FXML like so:
<TextArea id="taTextArea" fx:id="taContent" wrapText="true" />
Usually you add action listeners using onAction="#actionName"
What I want to know is, how can I do something similar for text changes. So I can detect wether a save is needed, modify the status bar label etc.
I want to avoid having to attach the TextArea to a change listener in the init method of the controller(implementing Initializable).
Also.. when I complete this application, I will write a blog about it.
With the lacking FXML documentation, I think itll be helpfull to other newbies.
So I want my code to be as clean as possible.
EDIT 1
No progress yet. I need to know if theres a thing such as code completion in FXML
So I can check what kind of properties I can use in FXMl. There should be a textLength property. In the provided link the author uses lengthProperty.addListener. I need an FXML equivilant
You could use the onKeyPressed property:
onKeyPressed="#textChanged"
which calls the textChanged method in the specified controller.
For the second question: The best reference for FXML currently is the javadoc of JavaFX, since all properties are listed there.

Find inheritance chain of a dijit widget

Is there a dojo/dijit method to which i can pass a widget and get the inheritance hierarchy of that widget.
getInheritanceHierarchy(dijitWidgetInstance)
which will return the inheritance hierarchy in some format (json or array).
I checked the doc. Say for example, i want to find the inheritance hierarchy for dojox.grid.TreeGrid.
The doc says "Object » DataGrid » dojox.grid.TreeGrid", but when i click on the Datagrid link there, it goes to error page.
This prints the inheritance chain in reverse order:
dojo.forEach(MyClass._meta.bases,function(b) {
console.log(b.prototype.declaredClass);
});
Replace MyClass with instance.constructor when using instances.
NOTE: This is likely to change or break and should not be used in production code! Useful only for debugging.

dojo: how to i know all the extension points of a widget

Say for example that i have a grid (dojox.grid.DataGrid). I want to know all the extension points available on that grid.
When checked with the dojo api doc in events section of the grid i cant find the extension points, (say for example extension point onBeforeRow is not listed in that event section).
Thanks in advance.
pretty much every public method is an extension point, in that you can dojo.connect to it. The "on" pattern indicates an event pattern, and there's no formal declaration beyond the naming pattern AFAIK.