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

The following examples show how to use com.intellij.ide.util.projectWizard.ProjectBuilder. 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: PantsOpenProjectProvider.java    From intellij-pants-plugin with Apache License 2.0 6 votes vote down vote up
private void link(@NotNull VirtualFile projectFile, @NotNull Project project, AddModuleWizard dialog) {
  if (dialog == null) return;

  ProjectBuilder builder = dialog.getBuilder(project);
  if (builder == null) return;

  try {
    ApplicationManager.getApplication().runWriteAction(() -> {
      Optional.ofNullable(dialog.getNewProjectJdk())
        .ifPresent(jdk -> NewProjectUtil.applyJdkToProject(project, jdk));

      URI output = projectDir(projectFile).resolve(".out").toUri();
      Optional.ofNullable(CompilerProjectExtension.getInstance(project))
        .ifPresent(ext -> ext.setCompilerOutputUrl(output.toString()));
    });

    builder.commit(project, null, ModulesProvider.EMPTY_MODULES_PROVIDER);
    project.putUserData(ExternalSystemDataKeys.NEWLY_IMPORTED_PROJECT, Boolean.TRUE);

    project.save();
  }
  finally {
    builder.cleanup();
  }
}
 
Example #2
Source File: VueModuleWizardStep.java    From vue-for-idea with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void updateDataModel() {
    final ProjectBuilder projectBuilder = myContext.getProjectBuilder();
    if (projectBuilder instanceof VueModuleBuilder) {
        ((VueModuleBuilder)projectBuilder).setWizardData(myPeer.getSettings());
    }
}
 
Example #3
Source File: OclProjectJdkWizardStep.java    From reasonml-idea-plugin with MIT License 4 votes vote down vote up
@Override
public void onWizardFinished() throws CommitStepException {
    Sdk odk = null;

    if (c_rdSelectExisting.isSelected()) {
        JdkComboBox.JdkComboBoxItem selectedItem = c_selExistingSdk.getSelectedItem();
        odk = selectedItem == null ? null : selectedItem.getJdk();
    } else if (c_rdDownloadSdk.isSelected()) {
        String selectedSdk = (String) c_selDownload.getSelectedItem();
        String sdkHomeValue = PropertiesComponent.getInstance().getValue(SDK_HOME);
        if (sdkHomeValue != null) {
            VirtualFileSystem fileSystem = LocalFileSystem.getInstance();
            VirtualFile sdkHome = fileSystem.findFileByPath(sdkHomeValue);

            if (selectedSdk != null && sdkHome != null) {
                int pos = selectedSdk.lastIndexOf('.');
                String patch = selectedSdk.substring(pos + 1);
                String majorMinor = selectedSdk.substring(0, pos);
                pos = majorMinor.lastIndexOf('.');
                String major = majorMinor.substring(0, pos);
                String minor = majorMinor.substring(pos + 1);

                // Download SDK from distribution site
                LOG.debug("Download SDK", selectedSdk);
                ProgressManager.getInstance().run(SdkDownloader.modalTask(major, minor, patch, sdkHome, m_context.getProject()));

                // Create SDK
                LOG.debug("Create SDK", selectedSdk);
                File targetSdkLocation = new File(sdkHome.getCanonicalPath(), "ocaml-" + selectedSdk);
                odk = SdkConfigurationUtil.createAndAddSDK(targetSdkLocation.getAbsolutePath(), new OCamlSdkType());
                if (odk != null) {
                    SdkModificator odkModificator = odk.getSdkModificator();

                    odkModificator.setVersionString(selectedSdk);  // must be set after home path, otherwise setting home path clears the version string
                    odkModificator.setName("OCaml (sources only) " + major);
                    try {
                        addSdkSources(odkModificator, targetSdkLocation);
                    } catch (IOException e) {
                        throw new CommitStepException(e.getMessage());
                    }

                    odkModificator.commitChanges();
                }
            }
        }
    }

    // update selected sdk in builder
    ProjectBuilder builder = m_context.getProjectBuilder();
    if (odk != null && builder instanceof DuneProjectImportBuilder) {
        ((DuneProjectImportBuilder) builder).setModuleSdk(odk);
    }
}
 
Example #4
Source File: BlazeProjectCreator.java    From intellij with Apache License 2.0 4 votes vote down vote up
BlazeProjectCreator(WizardContext wizardContext, ProjectBuilder projectBuilder) {
  this.wizardContext = wizardContext;
  this.projectBuilder = projectBuilder;
}
 
Example #5
Source File: ProjectImportWizardStep.java    From intellij with Apache License 2.0 4 votes vote down vote up
protected ProjectBuilder getBuilder() {
  return myContext.getProjectBuilder();
}