use of org.eclipse.vorto.core.api.repository.UploadResult in project vorto by eclipse.
the class UploadResultViewToUploadResult method apply.
@Override
public UploadResult apply(UploadResultView input) {
UploadResult result = new UploadResult();
result.setHandleId(input.getHandleId());
result.setErrorMessage(input.getErrorMessage());
result.setValid(input.isValid());
result.setModelResource(converter.apply(input.getModelResource()));
result.setUnresolvedReferences(input.getUnresolvedReferences());
return result;
}
use of org.eclipse.vorto.core.api.repository.UploadResult in project vorto by eclipse.
the class ShareModelAction method run.
@Override
public void run() {
IModelElement modelElement = getSelectedElement();
try {
UploadResult uploadResult = modelRepo.upload(modelElement.getModelFile().getName(), ByteStreams.toByteArray(modelElement.getModelFile().getContents()));
ModelUploadDialog uploadDialog = new ModelUploadDialog(getViewer().getControl().getShell(), uploadResult);
uploadDialog.create();
int result = uploadDialog.open();
if (uploadResult.statusOk() && result == Window.OK) {
modelRepo.commit(uploadResult.getHandleId());
MessageDisplayFactory.getMessageDisplay().displaySuccess("Model " + modelElement.getModelFile().getName() + " saved to repository.");
}
} catch (Exception e) {
ExceptionHandlerFactory.getHandler().handle(e);
}
}
Aggregations