Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormvelten2013-04-25 13:49:26 +0000
committermvelten2013-04-25 13:49:26 +0000
commit438f54e700026b102ca8524a3718faa111f89f17 (patch)
treef0b1ea562267a9caae183fd41331450d6b7c1d45
parent9d76adb710cc9ead2cd5018a3c72ed75b35a3fab (diff)
downloadorg.eclipse.papyrus-438f54e700026b102ca8524a3718faa111f89f17.tar.gz
org.eclipse.papyrus-438f54e700026b102ca8524a3718faa111f89f17.tar.xz
org.eclipse.papyrus-438f54e700026b102ca8524a3718faa111f89f17.zip
402905: [Control Mode] Refactoring of the control command to be more stable
https://bugs.eclipse.org/bugs/show_bug.cgi?id=402905 add ProfileFacetSet control participant, based on the previous one. NOT TESTED since I don't know the functionality, but it should at least fix the build.
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.instance/custom-src/org/eclipse/papyrus/infra/table/instance/util/TableContentsUtils.java18
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/plugin.xml15
-rw-r--r--plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/src/org/eclipse/papyrus/uml/profilefacet/controlmode/ProfileFacetSetControlCommand.java72
-rw-r--r--plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/src/org/eclipse/papyrus/uml/profilefacet/controlmode/ProfileFacetSetControlParticipant.java57
-rw-r--r--plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/src/org/eclipse/papyrus/uml/profilefacet/controlmode/ProfileFacetSetUncontrolCommand.java61
-rw-r--r--plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/src/org/eclipse/papyrus/uml/profilefacet/utils/ProfileFacetSetMoveHelper.java60
7 files changed, 112 insertions, 174 deletions
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.instance/custom-src/org/eclipse/papyrus/infra/table/instance/util/TableContentsUtils.java b/plugins/infra/table/org.eclipse.papyrus.infra.table.instance/custom-src/org/eclipse/papyrus/infra/table/instance/util/TableContentsUtils.java
index 2931e78ee80..adb5edc4d7f 100644
--- a/plugins/infra/table/org.eclipse.papyrus.infra.table.instance/custom-src/org/eclipse/papyrus/infra/table/instance/util/TableContentsUtils.java
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.instance/custom-src/org/eclipse/papyrus/infra/table/instance/util/TableContentsUtils.java
@@ -179,4 +179,22 @@ public class TableContentsUtils {
return result;
}
+
+ /**
+ *
+ * @param selection
+ * the current selection
+ * @return
+ * the list of the papyrus table instance which have the selection has context
+ */
+ public static Collection<PapyrusTableInstance> getPapyrusTableInstances(final EObject selection) {
+ final Collection<PapyrusTableInstance> pTables = new ArrayList<PapyrusTableInstance>();
+ Iterable<EObject> allDescendingPapyrusTables = createDescendantTablesIterable(selection);
+ for(EObject eObject : allDescendingPapyrusTables) {
+ if(eObject instanceof PapyrusTableInstance) {
+ pTables.add((PapyrusTableInstance)eObject);
+ }
+ }
+ return pTables;
+ }
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/META-INF/MANIFEST.MF
index bfcd7dbe8f0..62f49832b27 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/META-INF/MANIFEST.MF
+++ b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/META-INF/MANIFEST.MF
@@ -25,5 +25,6 @@ Require-Bundle: org.eclipse.core.commands,
org.eclipse.papyrus.infra.gmfdiag.commands,
org.eclipse.papyrus.infra.emf,
org.eclipse.papyrus.infra.core.log,
- org.eclipse.papyrus.infra.services.resourceloading.preferences;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.services.resourceloading.preferences;bundle-version="0.10.0",
+ org.eclipse.emf.validation.ui;bundle-version="1.7.0"
diff --git a/plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/plugin.xml b/plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/plugin.xml
index 7782fcc7291..b8b515f2c62 100644
--- a/plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/plugin.xml
+++ b/plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/plugin.xml
@@ -11,15 +11,6 @@
class="org.eclipse.papyrus.uml.profilefacet.listener.ReapplyProfileTriggerListener">
</listener>
</extension>
- <extension
- point="org.eclipse.papyrus.infra.services.controlmode.customControlCommand">
- <customControlCommand
- controlCommand="org.eclipse.papyrus.uml.profilefacet.controlmode.ProfileFacetSetControlCommand">
- </customControlCommand>
- <customUncontrolCommand
- uncontrolCommand="org.eclipse.papyrus.uml.profilefacet.controlmode.ProfileFacetSetUncontrolCommand">
- </customUncontrolCommand>
- </extension>
<extension
point="org.eclipse.gmf.runtime.emf.type.core.elementTypes">
<metamodel
@@ -41,4 +32,10 @@
</elementType>
</binding>
</extension>
+ <extension
+ point="org.eclipse.papyrus.infra.services.controlmode.participant">
+ <participant
+ class="org.eclipse.papyrus.uml.profilefacet.controlmode.ProfileFacetSetControlParticipant">
+ </participant>
+ </extension>
</plugin>
diff --git a/plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/src/org/eclipse/papyrus/uml/profilefacet/controlmode/ProfileFacetSetControlCommand.java b/plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/src/org/eclipse/papyrus/uml/profilefacet/controlmode/ProfileFacetSetControlCommand.java
deleted file mode 100644
index 16b9f5b24db..00000000000
--- a/plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/src/org/eclipse/papyrus/uml/profilefacet/controlmode/ProfileFacetSetControlCommand.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 Atos.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Olivier Melois (ATOS) olivier.melois@atos.net - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.profilefacet.controlmode;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.common.command.CompoundCommand;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel;
-import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr;
-import org.eclipse.papyrus.infra.services.controlmode.commands.IControlCommand;
-import org.eclipse.papyrus.uml.profilefacet.utils.ProfileFacetSetMoveHelper;
-
-
-
-/**
- * ControlCommand in charge of moving the tables when controlling a package.
- *
- */
-public class ProfileFacetSetControlCommand implements IControlCommand {
-
- /**
- * {@inheritDoc}
- */
- public void control(EditingDomain domain, EObject selection, STATE_CONTROL state, Resource source, Resource target, CompoundCommand commandToModify) {
- switch(state) {
- case POST_NOTATION:
- ProfileFacetSetMoveHelper.addAllFacetSetMoveCommands(domain, selection, source, target, commandToModify);
- break;
-// case POST_DI:
-// TableMoveHelper.addAllTableMoveCommands(domain, selection, source, target, commandToModify);
-// //FIXME : it should exist a best way to get the SashWindowsMngr
-// SashWindowsMngr windowsMngr = null;
-// final Iterator<Adapter> iter = selection.eAdapters().iterator();
-// while(iter.hasNext() && windowsMngr == null) {
-// final Adapter current = iter.next();
-// if(current.isAdapterForType(SashWindowsMngr.class)) {
-// windowsMngr = (SashWindowsMngr)current.getTarget();
-// }
-// }
-// if(windowsMngr != null) {
-// TableMoveHelper.addAllPageRefTableMoveCommands((TransactionalEditingDomain)domain, selection, source, target, windowsMngr, commandToModify);
-// }
-// break;
- default:
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean provides(EObject selection, STATE_CONTROL state, Resource source, Resource target) {
- return /*DiModel.DI_FILE_EXTENSION.equals(target.getURI().fileExtension()) ||*/ state == STATE_CONTROL.POST_NOTATION;
- }
-
-
-}
diff --git a/plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/src/org/eclipse/papyrus/uml/profilefacet/controlmode/ProfileFacetSetControlParticipant.java b/plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/src/org/eclipse/papyrus/uml/profilefacet/controlmode/ProfileFacetSetControlParticipant.java
new file mode 100644
index 00000000000..bec00a68b7b
--- /dev/null
+++ b/plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/src/org/eclipse/papyrus/uml/profilefacet/controlmode/ProfileFacetSetControlParticipant.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Atos.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mathieu Velten <a href="mailto:mathieu.velten@atos.net"> - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.papyrus.uml.profilefacet.controlmode;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel;
+import org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest;
+import org.eclipse.papyrus.infra.services.controlmode.participants.IControlCommandParticipant;
+import org.eclipse.papyrus.infra.services.controlmode.participants.IUncontrolCommandParticipant;
+import org.eclipse.papyrus.uml.profilefacet.utils.ProfileFacetSetMoveHelper;
+
+
+public class ProfileFacetSetControlParticipant implements IControlCommandParticipant, IUncontrolCommandParticipant {
+
+ public String getID() {
+ return "org.eclipse.papyrus.uml.profilefacet.controlmode.ProfileFacetSetControlParticipant";
+ }
+
+ public int getPriority() {
+ return 20;
+ }
+
+ public boolean provideUnControlCommand(ControlModeRequest request) {
+ return request.getTargetObject() instanceof EObject;
+ }
+
+ public boolean provideControlCommand(ControlModeRequest request) {
+ return request.getTargetObject() instanceof EObject;
+ }
+
+ public ICommand getPreUncontrolCommand(ControlModeRequest request) {
+ return ProfileFacetSetMoveHelper.getMoveAllFacetSetsCommand(request.getEditingDomain(), request.getTargetObject(), request.getSourceResource(SashModel.MODEL_FILE_EXTENSION), request.getTargetResource(SashModel.MODEL_FILE_EXTENSION));
+
+ }
+
+ public ICommand getPostUncontrolCommand(ControlModeRequest request) {
+ return null;
+ }
+
+ public ICommand getPreControlCommand(ControlModeRequest request) {
+ return null;
+ }
+
+ public ICommand getPostControlCommand(ControlModeRequest request) {
+ return ProfileFacetSetMoveHelper.getMoveAllFacetSetsCommand(request.getEditingDomain(), request.getTargetObject(), request.getSourceResource(SashModel.MODEL_FILE_EXTENSION), request.getTargetResource(SashModel.MODEL_FILE_EXTENSION));
+ }
+
+}
diff --git a/plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/src/org/eclipse/papyrus/uml/profilefacet/controlmode/ProfileFacetSetUncontrolCommand.java b/plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/src/org/eclipse/papyrus/uml/profilefacet/controlmode/ProfileFacetSetUncontrolCommand.java
deleted file mode 100644
index 5c83824b3fc..00000000000
--- a/plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/src/org/eclipse/papyrus/uml/profilefacet/controlmode/ProfileFacetSetUncontrolCommand.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 Atos.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Olivier Melois (ATOS) olivier.melois@atos.net - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.profilefacet.controlmode;
-
-import org.eclipse.emf.common.command.CompoundCommand;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel;
-import org.eclipse.papyrus.infra.services.controlmode.commands.IUncontrolCommand;
-import org.eclipse.papyrus.uml.profilefacet.utils.ProfileFacetSetMoveHelper;
-
-
-/**
- * Does the exact same thing as PapyrusTableControlCommand, but moves the tables back
- * to the resource they were initially created in.
- *
- */
-public class ProfileFacetSetUncontrolCommand implements IUncontrolCommand {
-
- /**
- * {@inheritDoc}
- */
- public void uncontrol(EditingDomain domain, EObject selection, STATE_CONTROL state, Resource source, Resource target, CompoundCommand commandToModify) {
- switch(state) {
- case POST_NOTATION:
- ProfileFacetSetMoveHelper.addAllFacetSetMoveCommands(domain, selection, source, target, commandToModify);
- //FIXME : the control mode should provides POST_DI for uncontrol action
-// final ModelSet set = (ModelSet)source.getResourceSet();
-// final Resource sourceDi = set.getAssociatedResource(source, DiModel.MODEL_FILE_EXTENSION);
-// final Resource targetDi = set.getAssociatedResource(target, DiModel.MODEL_FILE_EXTENSION);
-// TableMoveHelper.addAllTableMoveCommands(domain, selection, sourceDi, targetDi, commandToModify);
- break;
- default:
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean provides(EObject selection, STATE_CONTROL state, Resource source, Resource target) {
- if(state == STATE_CONTROL.POST_NOTATION) {//FIXME : the control mode should allow to uncontrol di file
- return true;
- }
- return false;
-// return DiModel.DI_FILE_EXTENSION.equals(target.getURI().fileExtension());
- }
-
-}
diff --git a/plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/src/org/eclipse/papyrus/uml/profilefacet/utils/ProfileFacetSetMoveHelper.java b/plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/src/org/eclipse/papyrus/uml/profilefacet/utils/ProfileFacetSetMoveHelper.java
index c66029b2a3e..d6fc2362924 100644
--- a/plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/src/org/eclipse/papyrus/uml/profilefacet/utils/ProfileFacetSetMoveHelper.java
+++ b/plugins/uml/profilefacet/org.eclipse.papyrus.uml.profilefacet/src/org/eclipse/papyrus/uml/profilefacet/utils/ProfileFacetSetMoveHelper.java
@@ -25,8 +25,6 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EStructuralFeature.Setting;
@@ -35,7 +33,6 @@ import org.eclipse.emf.ecore.util.ECrossReferenceAdapter;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.EcoreUtil.Copier;
import org.eclipse.emf.ecore.xmi.XMIResource;
-import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.facet.infra.facet.Facet;
import org.eclipse.emf.facet.infra.facet.FacetSet;
import org.eclipse.emf.facet.infra.query.ModelQuerySet;
@@ -47,9 +44,9 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.table.controlmode.helpers.TableMoveHelper;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
import org.eclipse.papyrus.infra.table.instance.papyrustableinstance.PapyrusTableInstance;
+import org.eclipse.papyrus.infra.table.instance.util.TableContentsUtils;
import org.eclipse.papyrus.uml.profilefacet.metamodel.profilefacet.StereotypePropertyElement;
/**
@@ -232,8 +229,9 @@ public final class ProfileFacetSetMoveHelper {
// return result;
// }
- public static void addAllFacetSetMoveCommands(EditingDomain domain, EObject selection, Resource source, final Resource target, CompoundCommand commandToModify) {
- final Collection<PapyrusTableInstance> pTables = TableMoveHelper.getPapyrusTableInstances(selection);
+ public static ICommand getMoveAllFacetSetsCommand(TransactionalEditingDomain domain, EObject selection, Resource source, final Resource target) {
+ CompositeTransactionalCommand cc = new CompositeTransactionalCommand(domain, "Move facet sets");
+ final Collection<PapyrusTableInstance> pTables = TableContentsUtils.getPapyrusTableInstances(selection);
if(!pTables.isEmpty()) {
final Set<Facet> facetsUsed = new HashSet<Facet>();
for(PapyrusTableInstance papyrusTableInstance : pTables) {
@@ -263,9 +261,9 @@ public final class ProfileFacetSetMoveHelper {
} else if(additionalEPackageSource != null) {
if(moveAdditionalFacetSet) {
if(additionalEPackageTarget != null) {
- Command tmp = getMergeAdditionalContentsEPackageCommand((TransactionalEditingDomain)domain, (XMIResource)source, (XMIResource)target, pTables, facetsets, facetsets, additionalEPackageSource, additionalEPackageTarget);
+ ICommand tmp = getMergeAdditionalContentsEPackageCommand((TransactionalEditingDomain)domain, (XMIResource)source, (XMIResource)target, pTables, facetsets, facetsets, additionalEPackageSource, additionalEPackageTarget);
if(tmp != null) {
- commandToModify.append(tmp);
+ cc.add(tmp);
}
} else {
//we should copy the AdditionalContentsEPackage
@@ -297,19 +295,20 @@ public final class ProfileFacetSetMoveHelper {
return CommandResult.newOKCommandResult();
}
};
- commandToModify.append(new GMFtoEMFCommandWrapper(addToResource));
+ cc.add(addToResource);
- Command tmp2 = getUpdateFacetElementReferencesCommand((TransactionalEditingDomain)domain, pTables, copier);
+ ICommand tmp2 = getUpdateFacetElementReferencesCommand((TransactionalEditingDomain)domain, pTables, copier);
if(tmp2 != null) {
- commandToModify.append(tmp2);
+ cc.add(tmp2);
}
- commandToModify.append(getCopyXMI_IDCommand((TransactionalEditingDomain)domain, copier));
+ cc.add(getCopyXMI_IDCommand((TransactionalEditingDomain)domain, copier));
}
}
}
}
}
+ return cc;
}
/**
@@ -334,8 +333,8 @@ public final class ProfileFacetSetMoveHelper {
* the command to merge the contents of the Epakche source into the EPackage target AND duplicating the required ModelQuerySet referenced
* by the source FacetSets
*/
- private static Command getMergeAdditionalContentsEPackageCommand(final TransactionalEditingDomain domain, final XMIResource sourceResource, final XMIResource targetResource, final Collection<PapyrusTableInstance> tables, final Collection<FacetSet> sourceFacetSets, Collection<FacetSet> targetFacetSets, EPackage source, final EPackage target) {
- final CompoundCommand compoundCommand = new CompoundCommand("Merge additional epackage contents"); //$NON-NLS-1$
+ private static ICommand getMergeAdditionalContentsEPackageCommand(final TransactionalEditingDomain domain, final XMIResource sourceResource, final XMIResource targetResource, final Collection<PapyrusTableInstance> tables, final Collection<FacetSet> sourceFacetSets, Collection<FacetSet> targetFacetSets, EPackage source, final EPackage target) {
+ CompositeTransactionalCommand cc = new CompositeTransactionalCommand(domain, "Merge additional epackage contents");
//1. we init the maps
final Map<ModelQuerySet, ModelQuerySet> sourceVSTargetModelQuerySet = new HashMap<ModelQuerySet, ModelQuerySet>();
final Map<String, FacetSet> sourceMap = new HashMap<String, FacetSet>();
@@ -369,7 +368,7 @@ public final class ProfileFacetSetMoveHelper {
return CommandResult.newOKCommandResult();
}
};
- compoundCommand.append(new GMFtoEMFCommandWrapper(addModelQuerySetToResource));
+ cc.add(addModelQuerySetToResource);
}
copier.copyReferences();
@@ -382,18 +381,18 @@ public final class ProfileFacetSetMoveHelper {
return CommandResult.newOKCommandResult();
}
};
- compoundCommand.append(new GMFtoEMFCommandWrapper(addFacetSetToAdditionalContentsFacetSet));
- compoundCommand.append(getCopyXMI_IDCommand(domain, copier));
- final Command tmp = getUpdateFacetElementReferencesCommand(domain, tables, copier);
+ cc.add(addFacetSetToAdditionalContentsFacetSet);
+ cc.add(getCopyXMI_IDCommand(domain, copier));
+ ICommand tmp = getUpdateFacetElementReferencesCommand(domain, tables, copier);
if(tmp != null) {
- compoundCommand.append(tmp);
+ cc.add(tmp);
}
}
}
- if(compoundCommand.isEmpty()) {
+ if(cc.isEmpty()) {
return null;
} else {
- return compoundCommand;
+ return cc;
}
}
@@ -424,8 +423,8 @@ public final class ProfileFacetSetMoveHelper {
* @return the copy xm i_ id command
* the command set the XMI_ID of the source eobject to the target eobject
*/
- private static Command getCopyXMI_IDCommand(final TransactionalEditingDomain domain, final Map<EObject, EObject> map) {
- final ICommand copyXMI_ID_Command = new AbstractTransactionalCommand(domain, "Copy XMI_ID Command", null) { //$NON-NLS-1$
+ private static ICommand getCopyXMI_IDCommand(final TransactionalEditingDomain domain, final Map<EObject, EObject> map) {
+ return new AbstractTransactionalCommand(domain, "Copy XMI_ID Command", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -443,7 +442,6 @@ public final class ProfileFacetSetMoveHelper {
return CommandResult.newOKCommandResult();
}
};
- return new GMFtoEMFCommandWrapper(copyXMI_ID_Command);
}
/**
@@ -459,8 +457,8 @@ public final class ProfileFacetSetMoveHelper {
* the command to replace each call to source element by a call to target element in the managed tables or <code>null</code> if there is
* nothing to do
*/
- private static Command getUpdateFacetElementReferencesCommand(final TransactionalEditingDomain domain, final Collection<PapyrusTableInstance> papyrusTables, final Map<EObject, EObject> sourceToTarget) {
- final CompoundCommand updateCommand = new CompoundCommand("Update References To facet Element Command"); //$NON-NLS-1$
+ private static ICommand getUpdateFacetElementReferencesCommand(final TransactionalEditingDomain domain, final Collection<PapyrusTableInstance> papyrusTables, final Map<EObject, EObject> sourceToTarget) {
+ CompositeTransactionalCommand cc = new CompositeTransactionalCommand(domain, "Update References To facet Element Command");
final Collection<TableInstance2> tableInstances = new ArrayList<TableInstance2>();
for(final PapyrusTableInstance pTable : papyrusTables) {
tableInstances.add(pTable.getTable());
@@ -483,7 +481,7 @@ public final class ProfileFacetSetMoveHelper {
return CommandResult.newOKCommandResult();
}
};
- updateCommand.append(new GMFtoEMFCommandWrapper(cmd));
+ cc.add(cmd);
}
}
}
@@ -500,16 +498,16 @@ public final class ProfileFacetSetMoveHelper {
return CommandResult.newOKCommandResult();
}
};
- updateCommand.append(new GMFtoEMFCommandWrapper(cmd));
+ cc.add(cmd);
}
}
}
}
}
- if(updateCommand.isEmpty()) {
+ if(cc.isEmpty()) {
return null;
}
- return updateCommand;
+ return cc;
}

Back to the top