Create a non-Java project

I would like to modify the Pythonid plugin to create a new module type, "Python Module" analogous to "Java Module." I want the user to be able do the following:

File | New Module -> The "Add Module" dialog appears. I want "Python Module" to appear as a choice. How do I get my module type to show up in this list?

The user will select "Python Module" and then choose "next" to get to the module name/content root step. The user then enters a module name and a chooses an existing directory for the content root. The user presses "Next." IntelliJ will look for source files, but instead of Java source files, it should look for Python source files (*.py) How do I tell IntelliJ what types of files to search for?

Thanks,
Brian

7 comments

Take a look at the J2ME plugin sources that come with the plugin-dev package.

0

Brian Smith wrote:

I would like to modify the Pythonid plugin to create a new module type,
"Python Module" analogous to "Java Module." I want the user to be able do
the following:

File | New Module -> The "Add Module" dialog appears. I want "Python
Module" to appear as a choice. How do I get my module type to show up in
this list?

The user will select "Python Module" and then choose "next" to get to the
module name/content root step. The user then enters a module name and a
chooses an existing directory for the content root. The user presses
"Next." IntelliJ will look for source files, but instead of Java source
files, it should look for Python source files (*.py) How do I tell
IntelliJ what types of files to search for?


Ok, looking at the J2ME example is what I have done, and it is a bit
tedious... ;o) Since I have just done that, I thought I give you some
pointers (if you still need them).


You need to create a subclass of a ModuleBuilder (the J2ME is using the
JavaModuleBuilder, but the sources of JavaModuleBuilder is available, so
you make an equiv for Python). You then create a

public class PuthonModuleType extends ModuleType]]>

with a public default constructor.

You need to override the
public ModuleWizardStep[] createWizardSteps( WizardContext wizardContext,
OsgiModuleBuilder moduleBuilder, ModulesProvider modulesProvider )

And each ModuleWizardStep is an implementation that you provide, which will
provide the JComponent via
public JComponent getComponent()


I hope this helps.

Cheers
Niclas


0

Hello Brian,

BS> I would like to modify the Pythonid plugin to create a new module
BS> type, "Python Module" analogous to "Java Module." I want the user to
BS> be able do the following:

Don't forget to apply for project membership at http://pythonid.dev.java.net/
and check in your changes once you get something working. :)

--
Dmitry Jemerov
Software Developer
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Thank you for your answers.

Dmitry, I will send in my changes to Pythonid when they are done. But, I am mostly adding this feature to Pythonid because I want a similar feature for a different plugin that I am designing. My knowledge of Python is lacking, so my contributions to Pythonid will probably not end up being very useful.

0

Okay, I got to the point where I can successfully create new new Module. Besides the excellent points mentioned above, here are two hurdles I ran up against. It was relatively painless.

I wanted to use ProjectWizardStepFactory#createNameAndLocationStep, but I couldn't because it requires a JavaModuleBuilder. As a result, I ended up creating my own work-alike. I also want to use the standard "Paths" tab in my module settings dialog, but I cannot find a way to do this unless I subclass JavaModuleType. Is it possible otherwise? Am I going to run into a lot of difficulties if my ModuleType is not a subclass of JavaModuleType?

With Pythonid, navigation using CtrlClick works but CtrlN and CtrlShiftAlt+N do not. Are these limitations of the Open API or are they just not implemented (yet) for Pythonid?

Thanks,
Brian

0

Hello Brian,

BS> With Pythonid, navigation using CtrlClick works but CtrlN and
BS> CtrlShiftAlt+N do not. Are these limitations of the Open API or
BS> are they just not implemented (yet) for Pythonid?

The latter. OpenAPI support is available, but the current version of Pythonid
doesn't build any global index for class or symbol navigation.

--
Dmitry Jemerov
Software Developer
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please, take a look for JSSymbolContributor in JavaScript module sources

Brian Smith wrote:

CtrlN and CtrlShiftAltN do not. Are these limitations of the Open API or are they just not implemented (yet) for Pythonid?



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Please sign in to leave a comment.