use of com.google.idea.blaze.base.wizard2.BlazeNewProjectBuilder in project intellij by bazelbuild.
the class BlazeEditProjectViewControl method updateBuilder.
public void updateBuilder(BlazeNewProjectBuilder builder) {
String projectName = projectNameField.getText().trim();
File projectDataDirectoryFile = new File(projectDataDirField.getText().trim());
if (workspaceOption.allowProjectDataInVcs()) {
projectDataDirectoryFile = new File(projectDataDirectoryFile, BlazeDataStorage.PROJECT_DATA_SUBDIRECTORY);
}
String projectDataDirectory = projectDataDirectoryFile.getPath();
File localProjectViewFile = ProjectViewStorageManager.getLocalProjectViewFileName(builder.getBuildSystem(), new File(projectDataDirectory));
BlazeSelectProjectViewOption selectProjectViewOption = builder.getProjectViewOption();
boolean useSharedProjectView = projectViewUi.getUseSharedProjectView();
// If we're using a shared project view, synthesize a local one that imports the shared one
ProjectViewSet parseResult = projectViewUi.parseProjectView(Lists.newArrayList());
final ProjectView projectView;
final ProjectViewSet projectViewSet;
if (useSharedProjectView && selectProjectViewOption.getSharedProjectView() != null) {
projectView = ProjectView.builder().add(ScalarSection.builder(ImportSection.KEY).set(selectProjectViewOption.getSharedProjectView())).build();
projectViewSet = ProjectViewSet.builder().addAll(parseResult.getProjectViewFiles()).add(localProjectViewFile, projectView).build();
} else {
ProjectViewSet.ProjectViewFile projectViewFile = parseResult.getTopLevelProjectViewFile();
assert projectViewFile != null;
projectView = projectViewFile.projectView;
projectViewSet = parseResult;
}
builder.setProjectView(projectView).setProjectViewFile(localProjectViewFile).setProjectViewSet(projectViewSet).setProjectName(projectName).setProjectDataDirectory(projectDataDirectory);
}
Aggregations