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);
}
}
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;
}
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;
}
}
}
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;
}
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;
}
Aggregations