Search in sources :

Example 1 with CMakeAppRunConfiguration

use of com.jetbrains.cidr.cpp.execution.CMakeAppRunConfiguration in project clion-embedded-arm by elmot.

the class ConvertProject method modifyCMakeConfigs.

private static void modifyCMakeConfigs(Project project, ProjectData projectData) {
    RunManager runManager = RunManager.getInstance(project);
    @SuppressWarnings("ConstantConditions") ConfigurationFactory factory = runManager.getConfigurationType(OpenOcdConfigurationType.TYPE_ID).getConfigurationFactories()[0];
    String name = "OCD " + projectData.getProjectName();
    if (runManager.findConfigurationByTypeAndName(OpenOcdConfigurationType.TYPE_ID, name) == null) {
        RunnerAndConfigurationSettings newRunConfig = runManager.createRunConfiguration(name, factory);
        newRunConfig.setSingleton(true);
        ((CMakeAppRunConfiguration) newRunConfig.getConfiguration()).setupDefaultTargetAndExecutable();
        ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> {
            runManager.addConfiguration(newRunConfig);
            runManager.makeStable(newRunConfig);
            runManager.setSelectedConfiguration(newRunConfig);
        }));
    }
}
Also used : CMakeAppRunConfiguration(com.jetbrains.cidr.cpp.execution.CMakeAppRunConfiguration) ConfigurationFactory(com.intellij.execution.configurations.ConfigurationFactory) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) RunManager(com.intellij.execution.RunManager)

Aggregations

RunManager (com.intellij.execution.RunManager)1 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)1 ConfigurationFactory (com.intellij.execution.configurations.ConfigurationFactory)1 CMakeAppRunConfiguration (com.jetbrains.cidr.cpp.execution.CMakeAppRunConfiguration)1