Search in sources :

Example 6 with LockedDirtyObjectDialog

use of org.talend.mdm.repository.ui.dialogs.lock.LockedDirtyObjectDialog 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

LockedDirtyObjectDialog (org.talend.mdm.repository.ui.dialogs.lock.LockedDirtyObjectDialog)6 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)5 IStatus (org.eclipse.core.runtime.IStatus)4 MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)4 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)3 SelectServerDefDialog (org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog)3 LinkedList (java.util.LinkedList)2 AbstractDeployCommand (org.talend.mdm.repository.core.command.deploy.AbstractDeployCommand)2 XtentisException (com.amalto.workbench.utils.XtentisException)1 HashSet (java.util.HashSet)1 WebServiceException (javax.xml.ws.WebServiceException)1 IFile (org.eclipse.core.resources.IFile)1 IProject (org.eclipse.core.resources.IProject)1 IResource (org.eclipse.core.resources.IResource)1 Project (org.talend.core.model.general.Project)1 Item (org.talend.core.model.properties.Item)1 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)1 CommandManager (org.talend.mdm.repository.core.command.CommandManager)1 ICommand (org.talend.mdm.repository.core.command.ICommand)1 ICommandParameter (org.talend.mdm.repository.core.command.param.ICommandParameter)1