Search in sources :

Example 1 with SelectVersionDialog

use of org.talend.mdm.repository.ui.dialogs.SelectVersionDialog in project tmdm-studio-se by Talend.

the class DeployAnotherVersionAction method doRun.

@Override
protected void doRun() {
    boolean checkMissingJar = MissingJarService.getInstance().checkMissingJar(true);
    if (!checkMissingJar) {
        return;
    }
    List<IRepositoryViewObject> viewObjs = getSelectedRepositoryViewObject();
    if (viewObjs.size() == 0) {
        return;
    }
    String originVersion = viewObjs.get(0).getProperty().getVersion();
    // open the version dialog
    SelectVersionDialog versionDialog = new SelectVersionDialog(getShell(), Messages.DeployAnotherVersionAction_selectAnother, viewObjs.get(0));
    versionDialog.create();
    if (versionDialog.open() == IDialogConstants.OK_ID) {
        if (versionDialog.getSelection() != null) {
            viewObjs = new ArrayList<IRepositoryViewObject>();
            IRepositoryViewObject modelviewObj = versionDialog.getSelection();
            viewObjs.add(modelviewObj);
            viewObjs.addAll(getAssociatedObjects(modelviewObj));
        }
        SelectServerDefDialog dialog = new SelectServerDefDialog(getShell());
        if (dialog.open() == IDialogConstants.OK_ID) {
            // save editors
            LockedDirtyObjectDialog lockDirtyDialog = new LockedDirtyObjectDialog(getShell(), Messages.AbstractDeployAction_promptToSaveEditors, viewObjs);
            if (lockDirtyDialog.needShowDialog() && lockDirtyDialog.open() == IDialogConstants.CANCEL_ID) {
                return;
            }
            lockDirtyDialog.saveDirtyObjects();
            // deploy
            MDMServerDef serverDef = dialog.getSelectedServerDef();
            if (doCheckServerConnection(serverDef)) {
                IStatus status = DeployService.getInstance().deployAnotherVersion(serverDef, viewObjs);
                if (status.isMultiStatus()) {
                    showDeployStatus(status);
                }
                if (isLatestVersion(viewObjs.get(0), originVersion)) {
                    updateChangedStatus(status);
                    updateLastServer(status, new NullProgressMonitor());
                }
            }
        }
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IStatus(org.eclipse.core.runtime.IStatus) LockedDirtyObjectDialog(org.talend.mdm.repository.ui.dialogs.lock.LockedDirtyObjectDialog) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef) SelectVersionDialog(org.talend.mdm.repository.ui.dialogs.SelectVersionDialog)

Aggregations

IStatus (org.eclipse.core.runtime.IStatus)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)1 SelectVersionDialog (org.talend.mdm.repository.ui.dialogs.SelectVersionDialog)1 LockedDirtyObjectDialog (org.talend.mdm.repository.ui.dialogs.lock.LockedDirtyObjectDialog)1 SelectServerDefDialog (org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog)1