com.intellij.projectImport.ProjectImportBuilder Java Examples

The following examples show how to use com.intellij.projectImport.ProjectImportBuilder. 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: GradleToolDelegate.java    From intellij-quarkus with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void processImport(Module module) {
    Project project = module.getProject();
    File gradleFile = null;

    for(VirtualFile virtualFile : ModuleRootManager.getInstance(module).getContentRoots()) {
        File baseDir = VfsUtilCore.virtualToIoFile(virtualFile);
        File file = new File(baseDir, "build.gradle");
        if (file.exists()) {
            gradleFile = file;
            break;
        }
    }

    if (gradleFile != null) {
        ProjectImportProvider gradleProjectImportProvider = getGradleProjectImportProvider();
        ProjectImportBuilder gradleProjectImportBuilder = gradleProjectImportProvider.getBuilder();
        AddModuleWizard wizard = new AddModuleWizard(project, gradleFile.getPath(), new ProjectImportProvider[]{gradleProjectImportProvider});
        if (wizard.getStepCount() == 0 || wizard.showAndGet()) {
            gradleProjectImportBuilder.commit(project, (ModifiableModuleModel)null, (ModulesProvider)null);
        }
    }
}
 
Example #2
Source File: PantsOpenProjectProvider.java    From intellij-pants-plugin with Apache License 2.0 6 votes vote down vote up
private AddModuleWizard openNewProjectWizard(VirtualFile projectFile) {
  PantsProjectImportProvider provider = new PantsProjectImportProvider();
  AddModuleWizard dialog = new AddModuleWizard(null, projectFile.getPath(), provider);

  ProjectImportBuilder builder = provider.getBuilder();
  builder.setUpdate(false);
  dialog.getWizardContext().setProjectBuilder(builder);

  // dialog can only be shown in a non-headless environment
  Application application = ApplicationManager.getApplication();
  if (application.isHeadlessEnvironment() || dialog.showAndGet()) {
    return dialog;
  }
  else {
    return null;
  }
}
 
Example #3
Source File: DuneProjectImportProvider.java    From reasonml-idea-plugin with MIT License 4 votes vote down vote up
@NotNull
@Override
protected ProjectImportBuilder doGetBuilder() {
    return new DuneProjectImportBuilder();
}
 
Example #4
Source File: PantsProjectImportBuilder.java    From intellij-pants-plugin with Apache License 2.0 4 votes vote down vote up
public static PantsProjectImportBuilder getInstance(){
  return ProjectImportBuilder.EXTENSIONS_POINT_NAME.findExtensionOrFail(PantsProjectImportBuilder.class);
}