Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.groups/src/org/eclipse/papyrus/uml/diagram/common/groups/commands/utlis/CommandsUtils.java')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.groups/src/org/eclipse/papyrus/uml/diagram/common/groups/commands/utlis/CommandsUtils.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.groups/src/org/eclipse/papyrus/uml/diagram/common/groups/commands/utlis/CommandsUtils.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.groups/src/org/eclipse/papyrus/uml/diagram/common/groups/commands/utlis/CommandsUtils.java
index 0287689aa67..7adc2954b92 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.groups/src/org/eclipse/papyrus/uml/diagram/common/groups/commands/utlis/CommandsUtils.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.groups/src/org/eclipse/papyrus/uml/diagram/common/groups/commands/utlis/CommandsUtils.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
+ * Copyright (c) 2010, 2023 Atos Origin.
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,6 +11,7 @@
*
* Contributors:
* Atos Origin - Initial API and implementation
+ * Pauline DEVILLE (CEA LIST) <pauline.deville@cea.fr> - Bug 582075
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.groups.commands.utlis;
@@ -349,7 +350,7 @@ public class CommandsUtils {
*/
public static ChangeModelParentCommand getUpdateChildrenModel(List<IGraphicalEditPart> directChildsToComplete, AbstractContainerNodeDescriptor descriptor, TransactionalEditingDomain editingDomain, IAdaptable parent, IGraphicalEditPart anyPart) {
ChangeModelParentCommand cmd = null;
- Map<EObject, EReference> elementToMove = new HashMap<EObject, EReference>();
+ Map<EObject, EReference> elementToMove = new HashMap<>();
if (!directChildsToComplete.isEmpty()) {
for (IGraphicalEditPart child : directChildsToComplete) {
EObject childEObject = child.resolveSemanticElement();
@@ -476,7 +477,7 @@ public class CommandsUtils {
/*
* Child visually contained in the new group which can be graphical children of this new group
*/
- List<IGraphicalEditPart> directChildsToComplete = new ArrayList<IGraphicalEditPart>();
+ List<IGraphicalEditPart> directChildsToComplete = new ArrayList<>();
/*
* Old child visually contained before the request ( used in changeBound request )
*/
@@ -491,12 +492,12 @@ public class CommandsUtils {
/*
* List of elements atomically chosen as graphical child
*/
- List<IGraphicalEditPart> newGraphicalChildren = new ArrayList<IGraphicalEditPart>();
+ List<IGraphicalEditPart> newGraphicalChildren = new ArrayList<>();
;
/*
* List of elements on which the user should be asked to choose the graphical parent
*/
- List<IGraphicalEditPart> choiceToMakeChildren = new ArrayList<IGraphicalEditPart>();
+ List<IGraphicalEditPart> choiceToMakeChildren = new ArrayList<>();
;
for (IGraphicalEditPart part : directChildsToComplete) {
if (alreadyHaveGroupGraphicalParent(part, modelParents)) {
@@ -605,7 +606,7 @@ public class CommandsUtils {
if (request instanceof ChangeBoundsRequest) {
Object _movingPart = parentAdapter.getAdapter(EditPart.class);
if (_movingPart instanceof IGraphicalEditPart) {
- List<IGraphicalEditPart> graphicalChilds = new ArrayList<IGraphicalEditPart>();
+ List<IGraphicalEditPart> graphicalChilds = new ArrayList<>();
IGraphicalEditPart movingEditPart = (IGraphicalEditPart) _movingPart;
// Look for all graphical children
graphicalChilds = getGraphicalChild(movingEditPart);
@@ -767,7 +768,7 @@ public class CommandsUtils {
}
}
// List of all model parent available (except the compartment edit part)
- List<IGraphicalEditPart> modelParents = new ArrayList<IGraphicalEditPart>();
+ List<IGraphicalEditPart> modelParents = new ArrayList<>();
EObject childEObject = graphicalChild.resolveSemanticElement();
// Does the child have already a valid model parent
boolean alreadyHaveValideModelParent = false;
@@ -885,7 +886,7 @@ public class CommandsUtils {
viewer = parentEditPart.getViewer();
if (viewer != null) {
IGraphicalEditPart compartmentEditPart = (IGraphicalEditPart) Utils.getCompartementEditPartFromMainEditPart(viewer.getEditPartRegistry(), parentEditPart);
- result = new ArrayList<IGraphicalEditPart>();
+ result = new ArrayList<>();
for (Object child : compartmentEditPart.getChildren()) {
if (child instanceof IGraphicalEditPart && GroupContainmentRegistry.isNodeConcerned((IGraphicalEditPart) child)) {
result.add((IGraphicalEditPart) child);
@@ -922,7 +923,7 @@ public class CommandsUtils {
} else if (request instanceof ChangeBoundsRequest) {
Object _parentEditPart = parentAdapter.getAdapter(IGraphicalEditPart.class);
if (_parentEditPart instanceof IGraphicalEditPart) {
- oldDirectChildsToComplete = new ArrayList<IGraphicalEditPart>();
+ oldDirectChildsToComplete = new ArrayList<>();
Utils.createComputedListsOfVisuallyRelatedElements(directChildsToComplete, (ChangeBoundsRequest) request, (IGraphicalEditPart) _parentEditPart, descriptor, true);
Utils.createComputedListsOfVisuallyRelatedElements(oldDirectChildsToComplete, (ChangeBoundsRequest) request, (IGraphicalEditPart) _parentEditPart, descriptor, false);
}
@@ -954,7 +955,7 @@ public class CommandsUtils {
private static CompositeCommand withdrawOldChildrenReferences(TransactionalEditingDomain editingDomain, IAdaptable parentAdapter, CompositeCommand cc, String handleChildrenLabel, AbstractContainerNodeDescriptor descriptor,
List<IGraphicalEditPart> directChildsToComplete, List<IGraphicalEditPart> oldDirectChildsToComplete) {
if (oldDirectChildsToComplete != null && !oldDirectChildsToComplete.isEmpty()) {
- List<IGraphicalEditPart> childToWithdraw = new ArrayList<IGraphicalEditPart>();
+ List<IGraphicalEditPart> childToWithdraw = new ArrayList<>();
for (IGraphicalEditPart child : oldDirectChildsToComplete) {
if (!directChildsToComplete.contains(child)) {
childToWithdraw.add(child);
@@ -1124,7 +1125,7 @@ public class CommandsUtils {
public static Command requestEditPartMultiplexor(ChangeBoundsRequest request, String label, IGraphicalEditPart getHost) {
CompositeCommand result = new CompositeCommand(label);
if (request.getEditParts().size() > 1) {
- for (Object part : request.getEditParts()) {
+ for (EditPart part : request.getEditParts()) {
ChangeBoundsRequest req = new ChangeBoundsRequest();
req.setEditParts(Collections.singletonList(part));
req.setMoveDelta(request.getMoveDelta());

Back to the top