developing facets

I'd like to have a "facet" called "Gosu", which can be added to Java module. when it is added, I want my code to add Gosu SDK libraries to the module. (I suppose this is a correct usage of Facets).

I see Android Facet has

    <facetType implementation="org.jetbrains.android.facet.AndroidFacetType"/>



and Groovy has

    <frameworkSupport implementation="org.jetbrains.plugins.groovy.config.GroovyFacetSupportProvider"/>



what's the proper usage for each of these approaches?

4 comments
Comment actions Permalink

Hello Alexey,

Probably the best open-source example for what you're trying to do is the
Scala plugin.

I'd like to have a "facet" called "Gosu", which can be added to Java
module. when it is added, I want my code to add some libraries to the
module. (I suppose this is a correct usage of Facets).

Is there an example of how to create a new facet type?


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Facets are used to setup module-specific settings for frameworks. If you just need to add some libraries you shouldn't create a new facet type. You
can provide FrameworkSupportProvider extension to add a new option into list of frameworks in the 'New Project' wizard and 'Add Framework Support' dialog.

I'd like to have a "facet" called "Gosu", which can be added to Java module. when it is added, I want my code to add some libraries to the module. (I suppose this is a correct usage of Facets).

>

Is there an example of how to create a new facet type?

>
>

---
Original message URL: http://devnet.jetbrains.net/message/5309647#5309647



--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Thanks! Actually, we do need to specify module-specific settings for Gosu, so I'll try using Facets. I've implemented a simple Facet and it seems to work fine now (prototype).
Now I need to also create a new "SDK type": "Gosu SDK" (just like Java SDK).

the first execution of the plugin with my dummy SDK throws:

[  15199]  ERROR - com.intellij.ide.IdeEventQueue - Error during dispatching of java.awt.event.MouseEvent[MOUSE_RELEASED,(188,48),absolute(1958,216),button=1,modifiers=Button1,clickCount=1] on dialog0
org.picocontainer.defaults.UnsatisfiableDependenciesException: gw.plugin.ij.sdk.GosuSdkType has unsatisfied dependency: class java.lang.String among unsatisfiable dependencies: [[class java.lang.String]] where AreaPicoContainer[null] was the leaf container being asked for dependencies.


this error message is a bit confusing... this is probably because I return NULL somewhere where it's not allowed (I had to return Null in many places to just compile the prototype), but anyway - the "unsatisfied String dependency" looks weird...
0
Comment actions Permalink

ok, never mind - I replaced several "return null" with meaningful values and there's no weird "String dependency" error anymore.

Thanks, guys.

0

Please sign in to leave a comment.