private static @Nullable String getTargetTypeId(@NotNull Project project, @Nullable RunConfiguration runConfiguration) {
    if (runConfiguration instanceof TargetEnvironmentAwareRunProfile) {
      String assignedTargetName = ((TargetEnvironmentAwareRunProfile)runConfiguration).getDefaultTargetName();
      TargetEnvironmentConfiguration effectiveTargetConfiguration =
        TargetEnvironmentConfigurations.getEffectiveConfiguration(assignedTargetName, project);
      if (effectiveTargetConfiguration != null) {
        return effectiveTargetConfiguration.getTypeId();
      }
    }
    else if (runConfiguration instanceof ImplicitTargetAwareRunProfile) {
      TargetEnvironmentType<?> targetType = ((ImplicitTargetAwareRunProfile)runConfiguration).getTargetType();
      if (targetType != null) {
        return targetType.getId();
      }
    }
    return null;
  }
private static @Nullable String getTargetTypeId(@NotNull Project project, @Nullable RunConfiguration runConfiguration)