Search in sources :

Example 1 with CommandStack

use of org.talend.mdm.repository.core.command.CommandStack in project tmdm-studio-se by Talend.

the class RestoreAction method executeRestoreCommand.

protected void executeRestoreCommand(IRepositoryViewObject viewObj) {
    CommandManager manager = CommandManager.getInstance();
    String id = viewObj.getId();
    CommandStack stack = manager.findCommandStack(id);
    if (stack != null) {
        List<ICommand> deployCommands = stack.getCommands(ICommand.PHASE_DEPLOY);
        if (deployCommands.size() > 0) {
            manager.pushCommand(ICommand.CMD_RESTORE, viewObj);
        }
        IProgressMonitor monitor = new NullProgressMonitor();
        List<ICommand> commands = stack.getCommands(ICommand.PHASE_RESTORE);
        for (ICommand cmd : commands) {
            cmd.updateViewObject(viewObj);
            cmd.execute(null, monitor);
        }
        manager.removeCommandStack(id, ICommand.PHASE_RESTORE);
    }
}
Also used : CommandStack(org.talend.mdm.repository.core.command.CommandStack) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) CommandManager(org.talend.mdm.repository.core.command.CommandManager) ICommand(org.talend.mdm.repository.core.command.ICommand)

Example 2 with CommandStack

use of org.talend.mdm.repository.core.command.CommandStack in project tmdm-studio-se by Talend.

the class WaitToDeployDialog method needShowObject.

private boolean needShowObject(IRepositoryViewObject viewObj) {
    String id = viewObj.getId();
    CommandStack commandStack = CommandManager.getInstance().findCommandStack(id);
    if (commandStack != null) {
        ICommand validCommand = commandStack.getValidDeployCommand();
        if (validCommand instanceof AbstractDeployCommand) {
            if (validCommand.getCommandType() == ICommand.CMD_DELETE) {
                return RepositoryResourceUtil.getLastServerDef(viewObj) != null;
            }
            return true;
        }
    }
    return false;
}
Also used : CommandStack(org.talend.mdm.repository.core.command.CommandStack) ICommand(org.talend.mdm.repository.core.command.ICommand) AbstractDeployCommand(org.talend.mdm.repository.core.command.deploy.AbstractDeployCommand)

Example 3 with CommandStack

use of org.talend.mdm.repository.core.command.CommandStack in project tmdm-studio-se by Talend.

the class MDMServerDecorator method decorateModifiedObject.

private void decorateModifiedObject(IRepositoryViewObject viewObj, IDecoration decoration) {
    CommandStack stack = CommandManager.getInstance().findCommandStack(viewObj.getId());
    if (stack != null) {
        ICommand command = stack.getValidDeployCommand();
        switch(command.getCommandType()) {
            case ICommand.CMD_ADD:
                decoration.addOverlay(IMG_NEW, IDecoration.BOTTOM_RIGHT);
                return;
            case ICommand.CMD_DELETE:
                decoration.addOverlay(IMG_DELETE, IDecoration.BOTTOM_RIGHT);
                return;
            case ICommand.CMD_MODIFY:
            case ICommand.CMD_RENAME:
                // $NON-NLS-1$
                decoration.addPrefix("> ");
                decoration.addOverlay(IMG_MODIFY, IDecoration.BOTTOM_RIGHT);
                return;
        }
    }
}
Also used : CommandStack(org.talend.mdm.repository.core.command.CommandStack) ICommand(org.talend.mdm.repository.core.command.ICommand)

Example 4 with CommandStack

use of org.talend.mdm.repository.core.command.CommandStack in project tmdm-studio-se by Talend.

the class ViewMainPage2 method isReferedViewObjModified.

private boolean isReferedViewObjModified() {
    XObjectEditorInput2 editorInput2 = (XObjectEditorInput2) getEditor().getEditorInput();
    IRepositoryViewObject viewObj = editorInput2.getViewObject();
    CommandStack stack = CommandManager.getInstance().findCommandStack(viewObj.getId());
    if (stack != null) {
        ICommand command = stack.getValidDeployCommand();
        if (command.getCommandType() == ICommand.CMD_MODIFY) {
            return true;
        }
    }
    return false;
}
Also used : CommandStack(org.talend.mdm.repository.core.command.CommandStack) ICommand(org.talend.mdm.repository.core.command.ICommand) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Example 5 with CommandStack

use of org.talend.mdm.repository.core.command.CommandStack in project tmdm-studio-se by Talend.

the class TransformerMainPage2 method isReferedViewObjModified.

private boolean isReferedViewObjModified() {
    IEditorInput editorInput = editor2.getEditorInput();
    if (editorInput instanceof XObjectEditorInput2) {
        XObjectEditorInput2 editorInput2 = (XObjectEditorInput2) editorInput;
        IRepositoryViewObject viewObj = editorInput2.getViewObject();
        CommandStack stack = CommandManager.getInstance().findCommandStack(viewObj.getId());
        if (stack != null) {
            ICommand command = stack.getValidDeployCommand();
            if (command.getCommandType() == ICommand.CMD_MODIFY) {
                return true;
            }
        }
    }
    return false;
}
Also used : CommandStack(org.talend.mdm.repository.core.command.CommandStack) ICommand(org.talend.mdm.repository.core.command.ICommand) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IEditorInput(org.eclipse.ui.IEditorInput)

Aggregations

CommandStack (org.talend.mdm.repository.core.command.CommandStack)6 ICommand (org.talend.mdm.repository.core.command.ICommand)6 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)3 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 CommandManager (org.talend.mdm.repository.core.command.CommandManager)2 AbstractDeployCommand (org.talend.mdm.repository.core.command.deploy.AbstractDeployCommand)2 ArrayList (java.util.ArrayList)1 IStatus (org.eclipse.core.runtime.IStatus)1 IEditorInput (org.eclipse.ui.IEditorInput)1 DeployService (org.talend.mdm.repository.core.service.DeployService)1 MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)1 DeployStatusDialog (org.talend.mdm.repository.ui.dialogs.deploy.DeployStatusDialog)1 SelectServerDefDialog (org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog)1