Search in sources :

Example 1 with ModelUploadDialog

use of org.eclipse.vorto.perspective.view.ModelUploadDialog 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);
    }
}
Also used : IModelElement(org.eclipse.vorto.core.ui.model.IModelElement) ModelUploadDialog(org.eclipse.vorto.perspective.view.ModelUploadDialog) UploadResult(org.eclipse.vorto.core.api.repository.UploadResult)

Aggregations

UploadResult (org.eclipse.vorto.core.api.repository.UploadResult)1 IModelElement (org.eclipse.vorto.core.ui.model.IModelElement)1 ModelUploadDialog (org.eclipse.vorto.perspective.view.ModelUploadDialog)1