Commit 040c24c3 authored by Romain Bioteau's avatar Romain Bioteau

fix(message) renaming a pool corrupts message target process (#2556)

Closes STUDIO-3722
Signed-off-by: default avatarRomain Bioteau <romain.bioteau@bonitasoft.com>
parent 3bd3cca0
......@@ -53,6 +53,7 @@ import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
......@@ -110,7 +111,7 @@ public class ProcessNamingTools {
if (!messagesToUpdate.isEmpty() || (!callActivityToUpdate.isEmpty()
&& MessageDialog.openQuestion(Display.getDefault().getActiveShell(), Messages.updateReferencesTitle,
Messages.bind(Messages.updateReferencesMsg, activitiesToUpdateMsg.toString())))) {
NLS.bind(Messages.updateReferencesMsg, activitiesToUpdateMsg.toString())))) {
IProgressService service = PlatformUI.getWorkbench().getProgressService();
try {
service.run(true, false, new IRunnableWithProgress() {
......
......@@ -21,9 +21,6 @@ import java.lang.reflect.InvocationTargetException;
import javax.inject.Inject;
import org.bonitasoft.studio.common.emf.tools.EMFModelUpdater;
import org.bonitasoft.studio.common.emf.tools.ExpressionHelper;
import org.bonitasoft.studio.common.emf.tools.ModelHelper;
import org.bonitasoft.studio.common.jface.databinding.CustomEMFEditObservables;
import org.bonitasoft.studio.common.jface.databinding.validator.ForbiddenCharactersValidator;
import org.bonitasoft.studio.common.jface.databinding.validator.UTF8InputValidator;
......@@ -32,9 +29,6 @@ import org.bonitasoft.studio.common.properties.AbstractBonitaDescriptionSection;
import org.bonitasoft.studio.common.repository.RepositoryAccessor;
import org.bonitasoft.studio.data.ui.property.section.PoolAdaptableSelectionProvider;
import org.bonitasoft.studio.diagram.custom.refactoring.ProcessNamingTools;
import org.bonitasoft.studio.model.expression.Expression;
import org.bonitasoft.studio.model.process.AbstractCatchMessageEvent;
import org.bonitasoft.studio.model.process.Message;
import org.bonitasoft.studio.model.process.Pool;
import org.bonitasoft.studio.model.process.ProcessPackage;
import org.bonitasoft.studio.properties.i18n.Messages;
......@@ -198,7 +192,6 @@ public class PoolGeneralPropertySection extends AbstractBonitaDescriptionSection
private void updateProcessName(String oldName, String newName) {
Pool pool = (Pool) selectionProvider.getAdapter(EObject.class);
processNamingTools.proceedForPools(pool, newName, oldName, pool.getVersion(), pool.getVersion());
updateMessageEvents(pool);
updatePropertyTabTitle(newName);
Display.getDefault().asyncExec(() -> {
DiagramEditor activeEditor = (DiagramEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
......@@ -207,20 +200,6 @@ public class PoolGeneralPropertySection extends AbstractBonitaDescriptionSection
});
}
private void updateMessageEvents(final Pool element) {
for (final AbstractCatchMessageEvent ev : ModelHelper.getAllCatchEvent(ModelHelper.getMainProcess(element))) {
final Message eventObject = ModelHelper.findEvent(element, ev.getEvent());
if (eventObject != null) {
EMFModelUpdater<EObject> updater = new EMFModelUpdater<>().from(eventObject.getTargetProcessExpression());
Expression newExpression = ExpressionHelper.createConstantExpression(element.getName(),
String.class.getName());
newExpression.setReturnTypeFixed(eventObject.getTargetProcessExpression().isReturnTypeFixed());
updater.editWorkingCopy(newExpression);
getEditingDomain().getCommandStack().execute(updater.createUpdateCommand(getEditingDomain()));
}
}
}
private void updatePropertyTabTitle(String poolName) {
if (poolName != null) {
TabbedPropertySheetPage tabbedPropertySheetPage = getTabbedPropertySheetPage();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment