use of org.talend.designer.business.diagram.custom.actions.DiagramResourceManager in project tdi-studio-se by Talend.
the class DiagramModelService method getDiagramFileAndUpdateResource.
public IFile getDiagramFileAndUpdateResource(IWorkbenchPage page, BusinessProcessItem businessProcessItem) {
DiagramResourceManager diagramResourceManager = new DiagramResourceManager(page, new NullProgressMonitor());
IFile file = diagramResourceManager.createDiagramFile();
diagramResourceManager.updateResource(businessProcessItem, file);
return file;
}
use of org.talend.designer.business.diagram.custom.actions.DiagramResourceManager in project tdi-studio-se by Talend.
the class BusinessDiagramEditor method doSave.
@Override
public void doSave(IProgressMonitor progressMonitor) {
if (repositoryEditorInput != null) {
final BusinessProcessItem businessProcessItem = (BusinessProcessItem) repositoryEditorInput.getItem();
IRepositoryService service = CorePlugin.getDefault().getRepositoryService();
IProxyRepositoryFactory repFactory = service.getProxyRepositoryFactory();
try {
repFactory.updateLockStatus();
// For TDI-23825, if not lock by user try to lock again.
boolean locked = repFactory.getStatus(businessProcessItem) == ERepositoryStatus.LOCK_BY_USER;
if (!locked) {
repFactory.lock(businessProcessItem);
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
ERepositoryStatus status = repFactory.getStatus(businessProcessItem);
if (!status.equals(ERepositoryStatus.LOCK_BY_USER) && !repFactory.getRepositoryContext().isEditableAsReadOnly()) {
MessageDialog.openWarning(getEditorSite().getShell(), //$NON-NLS-1$
Messages.getString("BusinessDiagramEditor.canNotSaveTitle"), //$NON-NLS-1$
Messages.getString("BusinessDiagramEditor.canNotSaveMessage"));
return;
}
super.doSave(progressMonitor);
DiagramResourceManager diagramResourceManager = new DiagramResourceManager();
diagramResourceManager.updateFromResource(businessProcessItem, repositoryEditorInput.getFile());
final IProxyRepositoryFactory factory = service.getProxyRepositoryFactory();
RepositoryWorkUnit rwu = new RepositoryWorkUnit("save Business") {
@Override
protected void run() throws LoginException, PersistenceException {
ProxyRepositoryFactory.getInstance().save(businessProcessItem);
}
};
rwu.setAvoidUnloadResources(true);
rwu.setAvoidSvnUpdate(true);
factory.executeRepositoryWorkUnit(rwu);
propertyIsDirty = false;
firePropertyChange(IEditorPart.PROP_DIRTY);
}
}
Aggregations