Search in sources :

Example 1 with BlazeSelectProjectViewOption

use of com.google.idea.blaze.base.wizard2.BlazeSelectProjectViewOption 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);
}
Also used : ProjectViewSet(com.google.idea.blaze.base.projectview.ProjectViewSet) ProjectView(com.google.idea.blaze.base.projectview.ProjectView) BlazeSelectProjectViewOption(com.google.idea.blaze.base.wizard2.BlazeSelectProjectViewOption) ProjectViewFile(com.google.idea.blaze.base.projectview.ProjectViewSet.ProjectViewFile) File(java.io.File) ProjectViewFile(com.google.idea.blaze.base.projectview.ProjectViewSet.ProjectViewFile)

Aggregations

ProjectView (com.google.idea.blaze.base.projectview.ProjectView)1 ProjectViewSet (com.google.idea.blaze.base.projectview.ProjectViewSet)1 ProjectViewFile (com.google.idea.blaze.base.projectview.ProjectViewSet.ProjectViewFile)1 BlazeSelectProjectViewOption (com.google.idea.blaze.base.wizard2.BlazeSelectProjectViewOption)1 File (java.io.File)1