本文整理汇总了Java中org.eclipse.che.ide.api.project.MutableProjectConfig类的典型用法代码示例。如果您正苦于以下问题:Java MutableProjectConfig类的具体用法?Java MutableProjectConfig怎么用?Java MutableProjectConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MutableProjectConfig类属于org.eclipse.che.ide.api.project包,在下文中一共展示了MutableProjectConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: importProject
import org.eclipse.che.ide.api.project.MutableProjectConfig; //导入依赖的package包/类
public void importProject(final CompleteCallback callback, MutableProjectConfig projectConfig) {
final Path path =
!isNullOrEmpty(projectConfig.getPath())
? Path.valueOf(projectConfig.getPath())
: !isNullOrEmpty(projectConfig.getName())
? Path.valueOf(projectConfig.getName()).makeAbsolute()
: null;
checkState(path != null, "Import path is undefined");
startImport(path, projectConfig.getSource())
.then(
project -> {
if (callback != null) {
callback.onCompleted();
}
})
.catchError(
error -> {
if (callback != null) {
callback.onFailure(error.getCause());
}
});
}
示例2: onProjectTemplateSelected
import org.eclipse.che.ide.api.project.MutableProjectConfig; //导入依赖的package包/类
@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());
}
示例3: getWizardForProjectType
import org.eclipse.che.ide.api.project.MutableProjectConfig; //导入依赖的package包/类
/** Creates or returns project wizard for the specified projectType with the given dataObject. */
private ProjectWizard getWizardForProjectType(
@NotNull ProjectTypeDto projectType, @NotNull MutableProjectConfig configDto) {
if (wizardsCache.containsKey(projectType)) {
return wizardsCache.get(projectType);
}
final Optional<ProjectWizardRegistrar> wizardRegistrar =
wizardRegistry.getWizardRegistrar(projectType.getId());
if (!wizardRegistrar.isPresent()) {
// should never occur
throw new IllegalStateException(
"WizardRegistrar for the project type " + projectType.getId() + " isn't registered.");
}
List<Provider<? extends WizardPage<MutableProjectConfig>>> pageProviders =
wizardRegistrar.get().getWizardPages();
final ProjectWizard projectWizard = createDefaultWizard(configDto, wizardMode);
for (Provider<? extends WizardPage<MutableProjectConfig>> provider : pageProviders) {
projectWizard.addPage(provider.get(), 1, false);
}
wizardsCache.put(projectType, projectWizard);
return projectWizard;
}
示例4: getWizardForImporter
import org.eclipse.che.ide.api.project.MutableProjectConfig; //导入依赖的package包/类
/** Creates or returns import wizard for the specified importer. */
private ImportWizard getWizardForImporter(@NotNull ProjectImporterDescriptor importer) {
if (wizardsCache.containsKey(importer)) {
return wizardsCache.get(importer);
}
final Optional<ImportWizardRegistrar> wizardRegistrar =
wizardRegistry.getWizardRegistrar(importer.getId());
if (!wizardRegistrar.isPresent()) {
// should never occur
throw new IllegalStateException(
"WizardRegistrar for the importer " + importer.getId() + " isn't registered.");
}
List<Provider<? extends WizardPage<MutableProjectConfig>>> pageProviders =
wizardRegistrar.get().getWizardPages();
final ImportWizard importWizard = createDefaultWizard();
for (Provider<? extends WizardPage<MutableProjectConfig>> provider : pageProviders) {
importWizard.addPage(provider.get(), 1, false);
}
wizardsCache.put(importer, importWizard);
return importWizard;
}
示例5: onImporterSelected
import org.eclipse.che.ide.api.project.MutableProjectConfig; //导入依赖的package包/类
@Override
public void onImporterSelected(ProjectImporterDescriptor importer) {
final MutableProjectConfig prevData = wizard.getDataObject();
wizard = getWizardForImporter(importer);
final MutableProjectConfig dataObject = wizard.getDataObject();
dataObject.getSource().setType(importer.getId());
// some values should be shared between wizards for different project types
dataObject.setName(prevData.getName());
dataObject.setDescription(prevData.getDescription());
WizardPage<MutableProjectConfig> firstPage = wizard.navigateToFirst();
if (firstPage != null) {
firstPage.init(dataObject);
}
WizardPage<MutableProjectConfig> importerPage = wizard.navigateToNext();
importerPage.go(mainPage.getImporterPanel());
}
示例6: asDto
import org.eclipse.che.ide.api.project.MutableProjectConfig; //导入依赖的package包/类
private NewProjectConfigDto asDto(MutableProjectConfig config) {
final SourceStorage source = config.getSource();
final SourceStorageDto sourceStorageDto =
dtoFactory
.createDto(SourceStorageDto.class)
.withType(source.getType())
.withLocation(source.getLocation())
.withParameters(source.getParameters());
return dtoFactory
.createDto(NewProjectConfigDto.class)
.withName(config.getName())
.withPath(config.getPath())
.withDescription(config.getDescription())
.withSource(sourceStorageDto)
.withType(config.getType())
.withMixins(config.getMixins())
.withAttributes(config.getAttributes())
.withOptions(config.getOptions());
}
示例7: actionPerformed
import org.eclipse.che.ide.api.project.MutableProjectConfig; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
Resource folder = getSelectedItem();
if (folder == null) {
return;
}
Path location = folder.getLocation();
if (location == null) {
return;
}
MutableProjectConfig mutableProjectConfig = new MutableProjectConfig();
mutableProjectConfig.setPath(location.toString());
mutableProjectConfig.setName(folder.getName());
projectConfigWizard.show(mutableProjectConfig);
}
示例8: updateProject
import org.eclipse.che.ide.api.project.MutableProjectConfig; //导入依赖的package包/类
/** Updates the specified {@code project} with the given {@code commands}. */
private Promise<Void> updateProject(Project project, List<CommandImpl> commands) {
MutableProjectConfig config = new MutableProjectConfig(project);
Map<String, List<String>> attributes = config.getAttributes();
List<String> attrValue = new ArrayList<>(attributes.size());
for (CommandImpl command : commands) {
CommandDto commandDto =
dtoFactory
.createDto(CommandDto.class)
.withName(command.getName())
.withType(command.getType())
.withCommandLine(command.getCommandLine())
.withAttributes(command.getAttributes());
attrValue.add(dtoFactory.toJson(commandDto));
}
attributes.put(COMMANDS_ATTRIBUTE_NAME, attrValue);
return project.update().withBody(config).send().then((Function<Project, Void>) arg -> null);
}
示例9: addMixin
import org.eclipse.che.ide.api.project.MutableProjectConfig; //导入依赖的package包/类
private Promise<Project> addMixin(final Project project) {
final VcsService vcsService = vcsServiceProvider.getVcsService(project);
if (vcsService == null || project.getMixins().contains(CONTRIBUTION_PROJECT_TYPE_ID)) {
return promiseProvider.resolve(project);
}
return vcsService
.getBranchName(project)
.thenPromise(
branchName -> {
MutableProjectConfig mutableConfig = new MutableProjectConfig(project);
mutableConfig.getMixins().add(CONTRIBUTION_PROJECT_TYPE_ID);
mutableConfig
.getAttributes()
.put(CONTRIBUTE_TO_BRANCH_VARIABLE_NAME, singletonList(branchName));
return project.update().withBody(mutableConfig).send();
});
}
示例10: init
import org.eclipse.che.ide.api.project.MutableProjectConfig; //导入依赖的package包/类
@Override
public void init(MutableProjectConfig dataObject) {
super.init(dataObject);
// this page may be reused so need to init it only once
if (initialized) {
return;
}
initialized = true;
final ProjectWizardMode wizardMode = ProjectWizardMode.parse(context.get(WIZARD_MODE_KEY));
originParent = Path.valueOf(dataObject.getPath()).parent();
view.setParentPath(originParent);
if (CREATE == wizardMode) {
// set pre-selected project type
final String preSelectedProjectTypeId;
if (dataObject.getType() != null) {
preSelectedProjectTypeId = dataObject.getType();
} else {
preSelectedProjectTypeId = preSelectedProjectTypeManager.getPreSelectedProjectTypeId();
}
if (wizardRegistry.getWizardRegistrar(preSelectedProjectTypeId).isPresent()) {
dataObject.setType(preSelectedProjectTypeId);
}
}
view.updateCategories(CREATE == wizardMode);
}
示例11: ProjectWizard
import org.eclipse.che.ide.api.project.MutableProjectConfig; //导入依赖的package包/类
@Inject
public ProjectWizard(
@Assisted MutableProjectConfig dataObject,
@Assisted ProjectWizardMode mode,
AppContext appContext,
CommandManager commandManager) {
super(dataObject);
this.mode = mode;
this.appContext = appContext;
this.commandManager = commandManager;
context.put(WIZARD_MODE_KEY, mode.toString());
context.put(PROJECT_NAME_KEY, dataObject.getName());
}
示例12: show
import org.eclipse.che.ide.api.project.MutableProjectConfig; //导入依赖的package包/类
/** Open the project wizard with given mode. */
public void show(Path parent) {
resetState();
this.wizardMode = CREATE;
MutableProjectConfig config = new MutableProjectConfig();
config.setPath(parent.toString());
showDialog(config);
}
示例13: showDialog
import org.eclipse.che.ide.api.project.MutableProjectConfig; //导入依赖的package包/类
private void showDialog(@Nullable MutableProjectConfig dataObject) {
wizard = createDefaultWizard(dataObject, wizardMode);
final WizardPage<MutableProjectConfig> firstPage = wizard.navigateToFirst();
if (firstPage != null) {
showPage(firstPage);
view.showDialog(wizardMode);
}
}
示例14: onProjectTypeSelected
import org.eclipse.che.ide.api.project.MutableProjectConfig; //导入依赖的package包/类
@Override
public void onProjectTypeSelected(ProjectTypeDto projectType) {
final MutableProjectConfig prevData = wizard.getDataObject();
wizard = getWizardForProjectType(projectType, prevData);
wizard.navigateToFirst();
final MutableProjectConfig newProject = wizard.getDataObject();
// some values should be shared between wizards for different project types
newProject.setPath(prevData.getPath());
newProject.setName(prevData.getName());
newProject.setDescription(prevData.getDescription());
newProject.setMixins(prevData.getMixins());
if (wizardMode == UPDATE) {
newProject.setAttributes(prevData.getAttributes());
} else {
final MutableProjectConfig.MutableSourceStorage sourceStorage = prevData.getSource();
if (sourceStorage
!= null) { // some values should be cleared when user switch between categories
sourceStorage.setLocation("");
sourceStorage.setType("");
sourceStorage.getParameters().clear();
}
prevData.getProjects().clear();
final List<AttributeDto> attributes = projectType.getAttributes();
Map<String, List<String>> prevDataAttributes = prevData.getAttributes();
Map<String, List<String>> newAttributes = new HashMap<>();
for (AttributeDto attribute : attributes) {
if (prevDataAttributes.containsKey(attribute.getName())) {
newAttributes.put(attribute.getName(), prevDataAttributes.get(attribute.getName()));
}
}
newProject.setAttributes(newAttributes);
}
// set dataObject's values from projectType
newProject.setType(projectType.getId());
}
示例15: createDefaultWizard
import org.eclipse.che.ide.api.project.MutableProjectConfig; //导入依赖的package包/类
/** Creates and returns 'default' project wizard with pre-defined pages only. */
private ProjectWizard createDefaultWizard(
@Nullable MutableProjectConfig dataObject, @NotNull ProjectWizardMode mode) {
final ProjectWizard projectWizard = projectWizardFactory.newWizard(dataObject, mode);
projectWizard.setUpdateDelegate(this);
// add pre-defined pages - first and last
projectWizard.addPage(categoriesPage);
return projectWizard;
}