diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/.ratings b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/.ratings index c97f0de641af1e2cdbbabf15709b227663c7d57e..4518ae281d5a766c54a7eaa19c75f9ff9ac640ff 100644 --- a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/.ratings +++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/.ratings @@ -7,7 +7,7 @@ DimensionUtils.java 8508de2b017f5ae76a86cdd0df7ce64a0a5f096e GREEN EllipseLayoutUtils.java e5f4f8eac4e4755c84d43a231d346ba348a5d806 GREEN LayoutDataUtils.java ee3798cb83903737f146ab1efe22ce667fbbc730 GREEN LayoutModelElementFactory.java cf1e7a5b23ae33087e0b8ccf32c37435bc3409fe GREEN -MigrationUtils.java 549105d77987a4efd5a2bdb9972875cea83aa43e GREEN +MigrationUtils.java 14f792317241963d077a0145c5fe3fe1dfcbf54c YELLOW OffsetOrientationUtils.java d7afdad0ee75667e04eb4b76e94216dd1ae93070 GREEN PointUtils.java 63c055e7c6062c564ceb5d900f3edce15384efc8 GREEN PointsUtils.java 5c134ea1a85d290b81634567def23b2f44e0f2ba GREEN diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/MigrationUtils.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/MigrationUtils.java index 539323a3c88e92e6335ffb50c8fc0f0ea0602176..31cfcf98770cc65538a21146aee8afe14a14bb25 100644 --- a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/MigrationUtils.java +++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/MigrationUtils.java @@ -21,9 +21,11 @@ import static org.fortiss.tooling.kernel.utils.EcoreUtils.copy; import org.eclipse.emf.common.util.BasicEList; import org.eclipse.emf.common.util.EList; import org.fortiss.tooling.base.model.base.ConnectorBase; +import org.fortiss.tooling.base.model.base.HierarchicElementBase; import org.fortiss.tooling.base.model.element.IAnnotatedSpecification; import org.fortiss.tooling.base.model.element.IConnection; import org.fortiss.tooling.base.model.element.IConnector; +import org.fortiss.tooling.base.model.element.IHierarchicElement; import org.fortiss.tooling.base.model.element.IModelElement; import org.fortiss.tooling.base.model.element.IModelElementReference; import org.fortiss.tooling.base.model.element.IModelElementSpecification; @@ -66,6 +68,30 @@ public class MigrationUtils { // NO_UCD delete(oldConnectorBase); } + /** + * Migrates an {@code oldConnectorBase} (of an (old) concrete sub-type of {@link ConnectorBase}) + * to a {@code newConnectorBase} (of another (new) concrete sub-type of {@link ConnectorBase} ) + * that is owned by the given new {@link IHierarchicElement}, + * including all relevant attributes and children. + * + * @param oldConnectorBase + * Old {@link ConnectorBase} to be migrated. Side effect: Removed from the model and + * deleted. + * @param newConnectorBase + * New {@link ConnectorBase} which should replace {@code oldConnectorBase}. It must + * be created by the caller of this method. + * @param newElement + * Element that will own the {@code newConnectorBase}. + */ + public static void migrateConnectorBase(ConnectorBase oldConnectorBase, + ConnectorBase newConnectorBase, IHierarchicElement newElement) { + + migrateINamedCommentedElement(oldConnectorBase, newConnectorBase); + migrateILayoutedModelElement(oldConnectorBase, newConnectorBase); + migrateIModelElement(oldConnectorBase, newConnectorBase); + newElement.getConnectors().add(newConnectorBase); + } + /** * Migrates all properties defined in the {@link IConnector} interface from * {@code oldIConnector} to {@code newIConnector}. @@ -169,6 +195,14 @@ public class MigrationUtils { // NO_UCD newINamedCommentedElement.setComment(oldINamedCommentedElement.getComment()); } + /** Migrates an {@link HierarchicElementBase} to an new {@link HierarchicElementBase}. */ + public static void migrateHierarchicElementBase(HierarchicElementBase oldElement, + HierarchicElementBase newElement) { + migrateIModelElement(oldElement, newElement); + migrateILayoutedModelElement(oldElement, newElement); + migrateINamedCommentedElement(oldElement, newElement); + } + /** * Migrates all properties defined in the {@link IAnnotatedSpecification} interface from * {@code oldIAnnotatedSpecification} to {@code newIAnnotatedSpecification}.