use of org.eclipse.che.api.machine.shared.dto.MachineLimitsDto in project che by eclipse.
the class SshCategoryPresenter method connect.
/**
* Opens a connection to the selected target.
* Starts a machine based on the selected recipe.
*/
private void connect() {
sshView.setConnectButtonText(null);
connectTargetName = selectedTarget.getName();
connectNotification = notificationManager.notify(machineLocale.targetsViewConnectProgress(selectedTarget.getName()), PROGRESS, FLOAT_MODE);
String recipeURL = selectedTarget.getRecipe().getLink("get recipe script").getHref();
MachineLimitsDto limitsDto = dtoFactory.createDto(MachineLimitsDto.class).withRam(1024);
MachineSourceDto sourceDto = dtoFactory.createDto(MachineSourceDto.class).withType("ssh-config").withLocation(recipeURL);
MachineConfigDto configDto = dtoFactory.createDto(MachineConfigDto.class).withDev(false).withName(selectedTarget.getName()).withSource(sourceDto).withLimits(limitsDto).withType(getCategory());
Promise<Void> machinePromise = workspaceServiceClient.createMachine(appContext.getWorkspaceId(), configDto);
machinePromise.then(new Operation<Void>() {
@Override
public void apply(Void arg) throws OperationException {
}
});
machinePromise.catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError promiseError) throws OperationException {
onConnectingFailed(null);
}
});
}
Aggregations