How to add Run/Debug actions to context menu ?


I'm developing a custom language so I have implemented my own file type. I have implemented a RunConfiguration for creating my file type (it executes a JavaCommandLineState).
My RunConfiguration is accessible by the classic Run/Debug buttons in the toolbar thanks to the 2 folowing bold lines (these class extends respectively BasicProgramRunner and GenericDebuggerRunner). It works but I don't know if it's the good way to do it...

    <extensions defaultExtensionNs="com.intellij">
        <fileTypeFactory implementation="fr.stateofmind.acceptium.idea.AcceptiumLanguageSupportLoader"/>
        <fileEditorProvider implementation="fr.stateofmind.acceptium.idea.AcceptiumEditorProvider"/>
        <configurationType implementation="fr.stateofmind.acceptium.idea.AcceptiumConfigurationType"/>
        <programRunner id="AcceptiumProgramRunner" implementation="fr.stateofmind.acceptium.idea.AcceptiumProgramRunner" order="last"/>
        <programRunner id="AcceptiumDebugRunner" implementation="fr.stateofmind.acceptium.idea.AcceptiumDebugRunner"/>


Now, I would like to have access to the Run/Debug actions in the context menu when I right click on the files that match to my own file type (such as for the execution of a main() or the execution JUnit tests).

Do I need to implement an AnAction class and define update(AnActionEvent e) ? If so, how to link this action to the JavaCommandLineState ?

Thanks !


Comment actions Permalink

See RuntimeConfigurationProducer class

Comment actions Permalink

Thanks Alexander ! It is solved.

For other people, I took XsltConfigurationProducer as example. It"s really easy.


Please sign in to leave a comment.