use of org.talend.mdm.repository.core.command.ICommand 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;
}
use of org.talend.mdm.repository.core.command.ICommand in project tmdm-studio-se by Talend.
the class UpdateLastServerService method updateLastServerDefInfo.
public void updateLastServerDefInfo(Object serverDef, IRepositoryViewObject ViewObject) {
if (serverDef == null || ViewObject == null || !(serverDef instanceof MDMServerDef)) {
return;
}
CommandManager cmdManager = CommandManager.getInstance();
DeployService deployService = DeployService.getInstance();
ICommand deployCmd = cmdManager.getNewCommand(ICommand.CMD_MODIFY);
deployCmd.init(ViewObject);
// $NON-NLS-1$ //$NON-NLS-2$
MultiStatus mStatus = new MultiStatus("PLUGIN_ID", Status.OK, "", null);
// $NON-NLS-1$
DeployStatus deployStatus = DeployStatus.getOKStatus(deployCmd, "");
mStatus.add(deployStatus);
cmdManager.removeCommandStack(deployCmd, ICommand.PHASE_DEPLOY);
deployService.pushRestoreCommand(cmdManager, deployCmd, (MDMServerDef) serverDef);
deployService.updateLastServer(mStatus, new NullProgressMonitor());
}
use of org.talend.mdm.repository.core.command.ICommand in project tmdm-studio-se by Talend.
the class RemoveFromServerAction method doRun.
protected void doRun() {
SelectServerDefDialog dialog = new SelectServerDefDialog(getShell());
if (dialog.open() == IDialogConstants.OK_ID) {
// save editors
LockedDirtyObjectDialog lockDirtyDialog = new LockedDirtyObjectDialog(getShell(), Messages.AbstractDeployAction_promptToSaveEditors, getSelectedRepositoryViewObject());
if (lockDirtyDialog.needShowDialog() && lockDirtyDialog.open() == IDialogConstants.CANCEL_ID) {
return;
}
lockDirtyDialog.saveDirtyObjects();
// remove
MDMServerDef serverDef = dialog.getSelectedServerDef();
List<AbstractDeployCommand> commands = new LinkedList<AbstractDeployCommand>();
CommandManager commandManager = CommandManager.getInstance();
for (Object obj : getSelectedObject()) {
IRepositoryViewObject viewObj = (IRepositoryViewObject) obj;
ICommand deleteCommand = commandManager.getNewCommand(ICommand.CMD_DELETE);
deleteCommand.init(viewObj);
commands.add((AbstractDeployCommand) deleteCommand);
}
//
IStatus status = DeployService.getInstance().runCommands(commands, serverDef);
if (status.isMultiStatus()) {
showDeployStatus(status);
}
}
}
use of org.talend.mdm.repository.core.command.ICommand in project tmdm-studio-se by Talend.
the class DeployService method runCommands.
public IStatus runCommands(List<AbstractDeployCommand> commands, MDMServerDef serverDef) {
reorderCommandObjects(commands);
CommandManager manager = CommandManager.getInstance();
List<ICommand> compundCommands = manager.convertToDeployCompundCommands(commands, serverDef);
manager.arrangeForJobCommands(compundCommands);
//
try {
IProgressService progressService = null;
if (PlatformUI.isWorkbenchRunning()) {
progressService = PlatformUI.getWorkbench().getProgressService();
} else {
progressService = ConsoleProgressService.getInstance();
}
DeployProcess runnable = new DeployProcess(compundCommands);
progressService.run(true, true, runnable);
return runnable.getStatus();
} catch (InvocationTargetException e) {
log.error(e.getMessage(), e);
} catch (InterruptedException e) {
}
return Status.CANCEL_STATUS;
}
use of org.talend.mdm.repository.core.command.ICommand in project tmdm-studio-se by Talend.
the class DeployService method generateValidationFailedDeployStatus.
public void generateValidationFailedDeployStatus(IStatus mainStatus, List<IRepositoryViewObject> cancelViewObjs) {
for (IRepositoryViewObject viewObj : cancelViewObjs) {
ICommand cancelCmd = CommandManager.getInstance().getNewCommand(ICommand.CMD_NOP);
cancelCmd.updateViewObject(viewObj);
DeployStatus cancelStatus = DeployStatus.getInfoStatus(cancelCmd, Messages.bind(Messages.Deploy_cancel_text, viewObj.getLabel()));
((MultiStatus) mainStatus).add(cancelStatus);
}
}
Aggregations