public ImportRunProfile(VirtualFile file, Project project) {
      myFile = file;
      myProject = project;
      try {
        final Document document = JDOMUtil.loadDocument(VfsUtilCore.virtualToIoFile(myFile));
        final Element config = document.getRootElement().getChild("config");
        if (config != null) {
          String configTypeId = config.getAttributeValue("configId");
          if (configTypeId != null) {
            final ConfigurationType configurationType =
                ConfigurationTypeUtil.findConfigurationType(configTypeId);
            if (configurationType != null) {
              myConfiguration =
                  configurationType.getConfigurationFactories()[0].createTemplateConfiguration(
                      project);
              myConfiguration.setName(config.getAttributeValue("name"));
              myConfiguration.readExternal(config);

              final Executor executor =
                  ExecutorRegistry.getInstance().getExecutorById(DefaultRunExecutor.EXECUTOR_ID);
              if (executor != null) {
                if (myConfiguration instanceof SMRunnerConsolePropertiesProvider) {
                  myProperties =
                      ((SMRunnerConsolePropertiesProvider) myConfiguration)
                          .createTestConsoleProperties(executor);
                }
              }
            }
          }
        }
      } catch (Exception ignore) {
      }
    }
 /**
  * Returns original {@link RunConfiguration} from this context. For example, it could be some test
  * framework runtime configuration that had been launched and that had brought a result test tree
  * on which a right-click action was performed.
  *
  * @param type {@link ConfigurationType} instance to filter original runtime configuration by its
  *     type
  * @return {@link RunConfiguration} instance, it could be null
  */
 @Nullable
 public RunConfiguration getOriginalConfiguration(@Nullable ConfigurationType type) {
   if (type == null) {
     return myRuntimeConfiguration;
   }
   if (myRuntimeConfiguration != null
       && ConfigurationTypeUtil.equals(myRuntimeConfiguration.getType(), type)) {
     return myRuntimeConfiguration;
   }
   return null;
 }
 private static RunnerAndConfigurationSettings createRunnerAndConfigurationSettings(
     MavenGeneralSettings generalSettings,
     MavenRunnerSettings runnerSettings,
     MavenRunnerParameters params,
     Project project) {
   MavenRunConfigurationType type =
       ConfigurationTypeUtil.findConfigurationType(MavenRunConfigurationType.class);
   final RunnerAndConfigurationSettings settings =
       RunManagerEx.getInstanceEx(project)
           .createConfiguration(
               MavenRunConfigurationType.generateName(project, params),
               type.getConfigurationFactories()[0]);
   MavenRunConfiguration runConfiguration = (MavenRunConfiguration) settings.getConfiguration();
   runConfiguration.setRunnerParameters(params);
   if (generalSettings != null) runConfiguration.setGeneralSettings(generalSettings);
   if (runnerSettings != null) runConfiguration.setRunnerSettings(runnerSettings);
   return settings;
 }
 public static AndroidRunConfigurationType getInstance() {
   return ConfigurationTypeUtil.findConfigurationType(AndroidRunConfigurationType.class);
 }
 public LiftRunConfigurationProducer() {
   super(ConfigurationTypeUtil.findConfigurationType(MavenRunConfigurationType.class));
 }
 public static GroovyScriptRunConfigurationType getInstance() {
   return ConfigurationTypeUtil.findConfigurationType(GroovyScriptRunConfigurationType.class);
 }