Search in sources :

Example 1 with NewProjectConfigImpl

use of org.eclipse.che.ide.api.project.NewProjectConfigImpl in project che by eclipse.

the class ProjectWizardPresenter method onProjectTemplateSelected.

@Override
public void onProjectTemplateSelected(ProjectTemplateDescriptor projectTemplate) {
    final MutableProjectConfig dataObject = wizard.getDataObject();
    wizard = importWizard == null ? importWizard = createDefaultWizard(dataObject, IMPORT) : importWizard;
    wizard.navigateToFirst();
    // set dataObject's values from projectTemplate
    final NewProjectConfig newProjectConfig = new NewProjectConfigImpl(projectTemplate);
    dataObject.setType(newProjectConfig.getType());
    dataObject.setSource(newProjectConfig.getSource());
    dataObject.setAttributes(newProjectConfig.getAttributes());
    dataObject.setOptions(newProjectConfig.getOptions());
    dataObject.setCommands(projectTemplate.getCommands());
}
Also used : MutableProjectConfig(org.eclipse.che.ide.api.project.MutableProjectConfig) NewProjectConfigImpl(org.eclipse.che.ide.api.project.NewProjectConfigImpl) NewProjectConfig(org.eclipse.che.api.core.model.project.NewProjectConfig)

Example 2 with NewProjectConfigImpl

use of org.eclipse.che.ide.api.project.NewProjectConfigImpl in project che by eclipse.

the class CategoriesPagePresenter method updateProjectConfigs.

private void updateProjectConfigs(String newProjectPath, ProjectTemplateDescriptor projectTemplate) {
    final List<NewProjectConfigDto> configDtoList = projectTemplate.getProjects();
    if (newProjectPath.equals("/")) {
        return;
    }
    final String templatePath = projectTemplate.getPath();
    final List<NewProjectConfig> updatedConfigs = new ArrayList<>(configDtoList.size());
    for (NewProjectConfigDto configDto : configDtoList) {
        final NewProjectConfig newConfig = new NewProjectConfigImpl(configDto);
        final String projectPath = configDto.getPath();
        if (projectPath.startsWith(templatePath)) {
            final String path = projectPath.replaceFirst(templatePath, newProjectPath);
            newConfig.setPath(path);
        }
        updatedConfigs.add(newConfig);
    }
    dataObject.setProjects(updatedConfigs);
}
Also used : NewProjectConfigDto(org.eclipse.che.api.workspace.shared.dto.NewProjectConfigDto) NewProjectConfigImpl(org.eclipse.che.ide.api.project.NewProjectConfigImpl) ArrayList(java.util.ArrayList) NewProjectConfig(org.eclipse.che.api.core.model.project.NewProjectConfig)

Aggregations

NewProjectConfig (org.eclipse.che.api.core.model.project.NewProjectConfig)2 NewProjectConfigImpl (org.eclipse.che.ide.api.project.NewProjectConfigImpl)2 ArrayList (java.util.ArrayList)1 NewProjectConfigDto (org.eclipse.che.api.workspace.shared.dto.NewProjectConfigDto)1 MutableProjectConfig (org.eclipse.che.ide.api.project.MutableProjectConfig)1