Project and Module settings and settings-panel

Answered

Hi everyone,

until now, I didn't really need to have project and module settings for the Mathematica plugin. In future, I will need them as I need to mark folders as test-sources or set language level. First the project settings dialog: Even when I have selected a MathematicaSDK, there is still the setting for "Project language level" and "Compiler output".

Q1: is there a way to change this panel to my needs which are: (1) change language levels according to Mathematica versions instead of Java and (2) remove/change the settings for compiler output as Mathematica is not compiled?

The second part of my question addresses the Module panel. Currently, it is completely empty:

I have searched through the SDK and tried to understand how I can incorporate my own ModuleEditor without luck. 

Q2: How can I implement my own tabbed module editor on the basis of existing things like the source tree view where I can mark parts of the source as test-src? How do I incorporate new things like drop-down menus for the language level?

Q3: What do I have to do to support "Mark directory as" (source, tests, documentation, ...) from the project view in the main editor? I couldn't find how I can extend my MathematicaModule to support this.

Cheers
Patrick

3 comments
Comment actions Permalink

One part of my questions seems to be solved. I found the answer in the Haskell plugin at https://github.com/carymrobbins/intellij-haskforce. To create a Module editor, you have to implement the extension point 

<extensionPoint name="moduleConfigurationEditorProvider"
interface="com.intellij.openapi.roots.ui.configuration.ModuleConfigurationEditorProvider"
area="IDEA_MODULE"/>

From there, a starting point is to look at the com.intellij.openapi.roots.ui.configuration.JavaContentEntriesEditor

0
Comment actions Permalink

Regarding Q1: unfortunately currently it isn't possible to customize 'Project' settings in 'Project Structure' dialog. Probably we can automatically hide these panels if there are no Java modules in the project, feel free to create an issue about that in our tracker.

Regarding Q2: yes, you need to use ModuleConfigurationEditorProvider extension point for that.

Regarding Q3: it depends on what kind of source roots your module have. If it isn't the standard one you need to provide implementation of ModuleSourceRootEditHandler extension (it is also required for CommonContentEntriesEditor to work properly with your type of source roots). Anyway you can look at MarkSourceRootAction. If it won't work for you it's possible to create your own action in a similar manner and add it to 'MarkRootGroup' action group.

1
Comment actions Permalink

Thank you Nikolay for this thorough answer!

1

Please sign in to leave a comment.