Initialize a project with prebuilt run configurations

I want to create some standard run configurations on my project startup, so that they show up in the run configuration selector by default. 

I know how to create a run configuration object on the fly and execute it but here I want to register it as well so that it is visible to the user by default. 

How can I achieve this?

1
3 comments
Avatar
Permanently deleted user

This is kind of important for me. It would be great if I can get some help on this.

Right now this is how I am executing a configuration on the fly. But it is only executed and not registered in the list

RunManagerImpl runManager = (RunManagerImpl) RunManager.getInstance(project);
RunnerAndConfigurationSettings runnerAndConfigurationSettings = new RunnerAndConfigurationSettingsImpl(runManager, configuration, false);
ProgramRunnerUtil.executeConfiguration(project, runnerAndConfigurationSettings, DefaultRunExecutor.getRunExecutorInstance());
0

ConfigurationType is the way to go. It produces ConfigurationFactory that is responcible for creating run configurations.

0
Avatar
Permanently deleted user

I am able to create Configuration objects but these configs dont show up in the list in the toolbar. I want to create a configuration that shows up on the toolbar. 

Following is what I am doing but it only runs the configuration.

public void runBuildConfiguration(List<String> directories, boolean isFullBuild)
{
BuildConfigurationFactory factory = (new Selector<BuildConfigurationFactory>()).select(BuildConfigurationFactory.class);
if (factory != null)
{
for(String directory : directories)
{
BuildConfiguration template = (BuildConfiguration) factory.createTemplateConfiguration(project);
template.setFullBuild(isFullBuild);
template.setDirectory(directory);
runConfiguration(factory.createConfiguration("build", template));
}
}
}

0

Please sign in to leave a comment.