Unshorten reference (import)
Hi,
I'd like to "unshorten" the reference to a class (the exact opposite to javaCodeStyleManager.shortenClassReferences(referenceClazz);). Is there any kind of utility method to achieve this kind of thing?
To illustrate this further, please consider the following example:
import blablub.A.ABuilder;
public class Test {
public static void main(String[] args) {
new ABuilder();
}
}
I'd like to get the following result:
import blablub.A;
public class Test {
public static void main(String[] args) {
new A.ABuilder();
}
}
Thank you very much in advance, Matthias
Please sign in to leave a comment.
I'm not aware of any existing utility method to do this.
Well I found a solution for this issue. An example how you can do it is
com.intellij.psi.util.ImportsUtil#expand (which is used within the ExpandStaticImportAction). You can modify the method a little bit, resulting in a method like that one:
Matthias