com.intellij.ide.util.projectWizard.ModuleBuilder Java Examples

The following examples show how to use com.intellij.ide.util.projectWizard.ModuleBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProjectDetails.java    From intellij-spring-assistant with MIT License 6 votes vote down vote up
public boolean validate(ModuleBuilder moduleBuilder, WizardContext wizardContext)
    throws ConfigurationException {
  if (!request.hasValidGroupId()) {
    throw new ConfigurationException("Invalid group id", "Invalid Data");
  } else if (!request.hasValidArtifactId()) {
    throw new ConfigurationException("Invalid artifact id", "Invalid Data");
  } else if (!request.hasValidVersion()) {
    throw new ConfigurationException("Invalid version", "Invalid Data");
  } else if (!request.hasValidName()) {
    throw new ConfigurationException("Invalid name", "Invalid Data");
  } else if (!request.hasValidPackageName()) {
    throw new ConfigurationException("Invalid package", "Invalid Data");
  } else if (!request.hasCompatibleJavaVersion(moduleBuilder, wizardContext)) {
    JavaSdkVersion wizardSdkVersion = from(wizardContext, moduleBuilder);
    throw new ConfigurationException("Selected Java version " + requireNonNull(
        IdAndName.class.cast(javaVersion.getSelectedItem())).getName()
        + " is not supported. Max supported version is (" + requireNonNull(wizardSdkVersion)
        .getMaxLanguageLevel().getCompilerComplianceDefaultOption()
        + ").\n\n You can go back to first screen and change the Project/Module SDK version there if you need support for newer Java versions",
        "Java Compatibility");
  }
  return true;
}
 
Example #2
Source File: ProjectFromSourcesBuilderImplModified.java    From tmc-intellij with MIT License 6 votes vote down vote up
private static Module createModule(
        ProjectDescriptor projectDescriptor,
        final ModuleDescriptor descriptor,
        final Map<LibraryDescriptor, Library> projectLibs,
        final ModifiableModuleModel moduleModel) {

    logger.info("Starting createModule in ProjectFromSourcesBuilderImplModified");
    final String moduleFilePath = descriptor.computeModuleFilePath();
    ModuleBuilder.deleteModuleFile(moduleFilePath);

    final Module module =
            moduleModel.newModule(moduleFilePath, descriptor.getModuleType().getId());
    final ModifiableRootModel modifiableModel =
            ModuleRootManager.getInstance(module).getModifiableModel();
    setupRootModel(projectDescriptor, descriptor, modifiableModel, projectLibs);
    descriptor.updateModuleConfiguration(module, modifiableModel);
    modifiableModel.commit();
    logger.info("ending createModule in ProjectFromSourcesBuilderImplModified");
    return module;
}
 
Example #3
Source File: InitializrUtil.java    From intellij-spring-assistant with MIT License 5 votes vote down vote up
@Nullable
public static JavaSdkVersion from(WizardContext context, ModuleBuilder builder) {
  Sdk wizardSdk = context.isCreatingNewProject() ?
      context.getProjectJdk() :
      chooseNotNull(builder.getModuleJdk(), context.getProjectJdk());
  return wizardSdk == null ? null : getInstance().getVersion(wizardSdk);
}
 
Example #4
Source File: ProjectCreationRequest.java    From intellij-spring-assistant with MIT License 5 votes vote down vote up
public boolean hasCompatibleJavaVersion(ModuleBuilder moduleBuilder,
    WizardContext wizardContext) {
  JavaSdkVersion wizardSdkVersion = from(wizardContext, moduleBuilder);
  if (wizardSdkVersion != null) {
    LanguageLevel selectedLanguageLevel = parse(javaVersion.getId());
    JavaSdkVersion selectedSdkVersion =
        selectedLanguageLevel != null ? fromLanguageLevel(selectedLanguageLevel) : null;
    // only if selected java version is compatible with wizard version
    return selectedSdkVersion == null || wizardSdkVersion.isAtLeast(selectedSdkVersion);
  }
  return true;
}
 
Example #5
Source File: RoboVmTemplatesFactory.java    From robovm-idea with GNU General Public License v2.0 4 votes vote down vote up
public RoboVmProjectTemplate(String name, String description, ModuleBuilder builder) {
    super(builder);
    this.name = name;
    this.description = description;
}