четверг, 2 июля 2015 г.

Pants initial wizard

I was working on initial wizard for IntelliJ IDEA. I was looking at such IDEA's plugins as Gradle, Android, Scala and Aspose.
Firstly I adapted the Gradle plugin's wizard code for Pants plugin. But unfortunately IDEA didn't see my wizard despite the fact that I modified the plugin.xml file appropriately.
Thanks to my mentor who helped me by showing how the minimal initial wizard should look like.
I took it this implementation as a basis.

Then I was designing the wizard steps. As Pants plugin wizard should have a possibility to create projects both in Java and Scala, the first wizard's step should contain the choice of language. To implement this I looked at the source code of Android and Scala plugins' wizards for IntelliJ IDEA. To add a possibility to choose Scala SDK I had to make two separate Module builders for Java and Scala appropriately. I think there is a better way to do it, but I haven't yet found out. Here it is what we have for now. 

Also I worked on implementation of generating a new project's BUILD file. I studied how it is done in Gradle plugin : via templates (.ft). As I understood, information about all templates from all plugins are stored in the hash table, where IDEA then could find a requested template by calling findTemplateByName() of FTManager class. I unsuccessfully tried to insert a new template for Pants in this hash table. May be I'm moving in the wrong direction and it should be done in another way: I'm working on this issue.