diff options
| author | Maxime Porhel | 2016-04-28 09:55:55 +0000 |
|---|---|---|
| committer | Maxime Porhel | 2016-05-10 14:34:21 +0000 |
| commit | a072d2c1484ee82bfb77cdd9ecdb8f92091b125b (patch) | |
| tree | 8947479fd54270a0efd1cd4a6fda61dff2d0cb7b | |
| parent | e4fd6945a5cbc9ec4e0cfdccfeb719be4a967ea5 (diff) | |
| download | org.eclipse.sirius-a072d2c1484ee82bfb77cdd9ecdb8f92091b125b.tar.gz org.eclipse.sirius-a072d2c1484ee82bfb77cdd9ecdb8f92091b125b.tar.xz org.eclipse.sirius-a072d2c1484ee82bfb77cdd9ecdb8f92091b125b.zip | |
[492634] Reduce code duplication
The updateCell method should be used handle the SetIntersection status
and create/update/remove the cells.
Bug: 492634
Change-Id: Iade7509da613ef3efafe90ecc6105e4cc3ca07e0
Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
2 files changed, 5 insertions, 26 deletions
diff --git a/plugins/org.eclipse.sirius.ecore.extender/src/org/eclipse/sirius/ecore/extender/business/api/accessor/ModelAccessor.java b/plugins/org.eclipse.sirius.ecore.extender/src/org/eclipse/sirius/ecore/extender/business/api/accessor/ModelAccessor.java index d97dc2ebac..3fc3e073a9 100644 --- a/plugins/org.eclipse.sirius.ecore.extender/src/org/eclipse/sirius/ecore/extender/business/api/accessor/ModelAccessor.java +++ b/plugins/org.eclipse.sirius.ecore.extender/src/org/eclipse/sirius/ecore/extender/business/api/accessor/ModelAccessor.java @@ -575,7 +575,7 @@ public class ModelAccessor { for (Setting setting : refs) { final EObject eObj = setting.getEObject(); final EStructuralFeature feature = setting.getEStructuralFeature(); - // For each reference to the element to deleten we check that it + // For each reference to the element to delete we check that it // can be deleted // Check 1: if the containing type of the reference is a type to // ignore, we consider that we can delete it diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableSynchronizerImpl.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableSynchronizerImpl.java index fd8750b245..5f6520198a 100644 --- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableSynchronizerImpl.java +++ b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableSynchronizerImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2007, 2016 THALES GLOBAL SERVICES and others. * 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 @@ -787,6 +787,8 @@ public class DTableSynchronizerImpl implements DTableSynchronizer { * the cross referencer to use */ private void updateCells(final IntersectionMapping iMapping, final SetIntersection<DCellCandidate> cellsToUpdate, ECrossReferenceAdapter xref) { + // Let's now create the new cells, update the kept ones and remove the + // old ones. for (final DCellCandidate toCreate : cellsToUpdate.getNewElements()) { final Option<DCell> optionalCell = createCell(toCreate.getLine(), toCreate.getColumn(), toCreate.getSemantic(), toCreate.getMapping()); if (optionalCell.some()) { @@ -896,30 +898,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer { } } - // Let's now create the new cells, update the kept ones and remove the - // old ones. - for (final DCellCandidate toCreate : status.getNewElements()) { - final Option<DCell> optionalCell = createCell(toCreate.getLine(), toCreate.getColumn(), toCreate.getSemantic(), toCreate.getMapping()); - if (optionalCell.some()) { - optionalCell.get().setIntersectionMapping(iMapping); - this.sync.refresh(optionalCell.get()); - } - - } - for (final DCellCandidate toUpdate : status.getKeptElements()) { - final DCell cell = toUpdate.getOriginalElement(); - if (cell != null) { - if (accessor.getPermissionAuthority().canEditInstance(cell)) { - cell.setTarget(toUpdate.getSemantic()); - cell.setIntersectionMapping(iMapping); - this.sync.refresh(cell); - } - } - } - for (final DCellCandidate toRemove : status.getRemovedElements()) { - final DCell cell = toRemove.getOriginalElement(); - doDeleteCell(cell, xref); - } + updateCells(iMapping, status, xref); } /** |
