Where I can find the implementation for "Use Static Import If Possible" option in Settings -> Editor -> LiveTemplates

Can someone point me to the source responsible for handling the option "Use Static Import If Possible" in the `Settings -> Editor -> LiveTemplates` section

I would like to know which class has implemented the functionality of adding static import to the class & removing the Class FQN from the inserted live template

You can see the option I'm talking about in this image

Thanks

0
3 comments
Avatar
Permanently deleted user

I've found just one real usage of ReplaceOptions.isToUseStaticImport() in JavaReplaceHandler class

0
Avatar
Permanently deleted user

Thanks for pointing this.

Looks like `JavaReplaceHandler.shortenWithStaticImports` is responsible for the replacement

0
Avatar
Stefan Endrullis

This feature is implemented in ShortenToStaticImportProcessor.  If you have a template you can easily enable the option via

// create template
Template template = createTemplate(manager, templateString);
// set "use static import if possible" option
template.setValue(Template.Property.USE_STATIC_IMPORT_IF_POSSIBLE, true);

 

0

Please sign in to leave a comment.