Reputation: 3039
Is there a way to filter hierarchy subtype in IntelliJ Idea?
For example, I would like to generate the class hierarchy for java.util.Map.Entry<K, V>
but would like to display just the public classes and classes residing in java.*
package.
Eclipse seems not to support this either and I can't see a way to directly do this from IDE UI so is there a way to achieve this or perhaps script it within IDEA itself?
EDIT: To clarify things, I wanted to find if there is already a simple and public implementation of Entry<K, V>
within the JDK so that I don't need to write my own crufty code.
Turns out there are two good candidates (SimpleEntry<K, V>
and SimpleImmutableEntry<K, V>
, for those who may be interested) but I only managed to find them after some painstaking sifting through the myriad implementations of Entry<K, V>
on my classpath (see here).
What I want is to filter such deep type hierarchies according to package name and access modifier.
Upvotes: 3
Views: 764
Reputation: 1794
I'm not sure what are you exactly trying to achieve, because you're talking about "generating the class hierarchy" and then you're talking about "displaying just public items".
I assume, that you would like to navigate to Hirarchy Tool Window (by pressing CTRL-H on selected type) and filter results, so that only types from desired package (java.*
) will be displayed.
To achieve this, in Hirarchy Tool Window on the toolbar there is a "Scope
" ComboBox. Click it and choose "Configure...
". "Scopes
" window will appear, where you can add and configure a new custom scope, which will filter the desired types for you.
EDIT: I couldn't found in scope languge syntax reference any option for filtering based on access modifiers.
But I've googled a little bit and I think you might be looking for Structural Search
(CTRL+SHIFT+S). You can also use here "Scopes" like described above, and also use access modifiers like this:
public class $DerivedClass$ implements Entry {}
or
private class $DerivedClass$ implements Entry {}
I haven't used it too much, but it's probably a very powerful tool and will help you achieve better results than Hirarchy Tool Window.
Reference: here, here and here.
Upvotes: 4