Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-09-09 12:07:05 +0000
committerCamille Letavernier2014-09-11 10:30:31 +0000
commitc4aeefd87cbce46a32403c956e8abf2aa766e63b (patch)
tree2a837c7c26f9d6f4142b3d8bf4e025b4386edc97 /plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence
parent338728c2e4790a097ee4053df7d8078d90b861e2 (diff)
downloadorg.eclipse.papyrus-c4aeefd87cbce46a32403c956e8abf2aa766e63b.tar.gz
org.eclipse.papyrus-c4aeefd87cbce46a32403c956e8abf2aa766e63b.tar.xz
org.eclipse.papyrus-c4aeefd87cbce46a32403c956e8abf2aa766e63b.zip
443799: [Code Quality] Cleanup code according to FindBugs results
https://bugs.eclipse.org/bugs/show_bug.cgi?id=443799 - Clean up uml.diagram.common
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomLifelineEditPart.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomPackageEditPart.java15
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/CommandHelper.java18
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineEditPartUtil.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineHeadUtil.java18
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineMessageCreateHelper.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/MessageAnchorRepairer.java10
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java26
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceDeleteHelper.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceLinkMappingHelper.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceUtil.java11
11 files changed, 64 insertions, 82 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomLifelineEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomLifelineEditPart.java
index 340ba73e06e..2255fbcc38e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomLifelineEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomLifelineEditPart.java
@@ -80,8 +80,8 @@ import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.gmf.runtime.notation.datatype.GradientData;
+import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.command.wrappers.GEFtoEMFCommandWrapper;
import org.eclipse.papyrus.uml.diagram.common.commands.PreserveAnchorsPositionCommand;
import org.eclipse.papyrus.uml.diagram.common.draw2d.anchors.LifelineAnchor;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy;
@@ -482,9 +482,9 @@ public class CustomLifelineEditPart extends LifelineEditPart {
// only allow Lifeline creation for PartDecomposition.
if (request instanceof CreateViewRequest) {
CreateViewRequest req = (CreateViewRequest) request;
- Iterator iter = req.getViewDescriptors().iterator();
+ Iterator<? extends CreateViewRequest.ViewDescriptor> iter = req.getViewDescriptors().iterator();
while (iter.hasNext()) {
- CreateViewRequest.ViewDescriptor viewDescriptor = (CreateViewRequest.ViewDescriptor) iter.next();
+ CreateViewRequest.ViewDescriptor viewDescriptor = iter.next();
String semanticHint = viewDescriptor.getSemanticHint();
if (!UMLVisualIDRegistry.getType(VISUAL_ID).equals(semanticHint)) {
return UnexecutableCommand.INSTANCE;
@@ -503,7 +503,7 @@ public class CustomLifelineEditPart extends LifelineEditPart {
}
private Command getMoveResizeCommand(ChangeBoundsRequest request) {
- List changeEditParts = request.getEditParts();
+ List<?> changeEditParts = request.getEditParts();
if (changeEditParts != null && changeEditParts.size() > 0) {
TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
CompositeTransactionalCommand composite = new CompositeTransactionalCommand(editingDomain, null);
@@ -979,7 +979,7 @@ public class CustomLifelineEditPart extends LifelineEditPart {
CommandHelper.executeCommandWithoutHistory(editingDomain, RemoveCommand.create(editingDomain, lifeline, UMLPackage.eINSTANCE.getLifeline_CoveredBy(), oldValue), true);
}
} else if (Notification.REMOVE_MANY == notification.getEventType()) {
- List oldValue = (List) notification.getOldValue();
+ List<?> oldValue = (List<?>) notification.getOldValue();
for (Object object : oldValue) {
if (coveredBys.contains(object)) {
CommandHelper.executeCommandWithoutHistory(editingDomain, RemoveCommand.create(editingDomain, lifeline, UMLPackage.eINSTANCE.getLifeline_CoveredBy(), object), true);
@@ -1039,7 +1039,7 @@ public class CustomLifelineEditPart extends LifelineEditPart {
public boolean ignoreRequest(Request request) { // moving editpart causing to add child
if (request instanceof ChangeBoundsRequest && (request.getType().equals(org.eclipse.gef.RequestConstants.REQ_ADD) || request.getType().equals(RequestConstants.REQ_DROP))) {
- List parts = ((ChangeBoundsRequest) request).getEditParts();
+ List<?> parts = ((ChangeBoundsRequest) request).getEditParts();
if (parts != null) {
for (Object obj : parts) {
if (obj instanceof CommentEditPart || obj instanceof ConstraintEditPart || obj instanceof TimeObservationEditPart || obj instanceof CombinedFragmentEditPart) {
@@ -1075,7 +1075,7 @@ public class CustomLifelineEditPart extends LifelineEditPart {
// return true;
// }
// }
- List models = super.getModelChildren();
+ List<?> models = super.getModelChildren();
for (Object o : models) {
if (o instanceof View) {
View view = (View) o;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomPackageEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomPackageEditPart.java
index d9341042b04..4332f968093 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomPackageEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomPackageEditPart.java
@@ -13,8 +13,6 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.commands.Command;
@@ -26,7 +24,6 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.diagram.common.providers.BaseViewInfo;
import org.eclipse.papyrus.uml.diagram.common.providers.ViewInfo;
-import org.eclipse.papyrus.uml.diagram.common.util.MDTUtil;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.semantic.CustomPackageItemSemanticEditPolicy;
import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
@@ -83,18 +80,6 @@ public class CustomPackageEditPart extends PackageEditPart {
}
@Override
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
- if (event.getNotifier() instanceof EAnnotation) {
- EAnnotation eAnnotation = (EAnnotation) event.getNotifier();
- if (eAnnotation.getSource() != null && eAnnotation.getSource().equals(MDTUtil.FilterViewAndLabelsSource)) {
- // modification form MOSKitt approach, canonical policies are not called
- MDTUtil.filterDiagramViews(this.getDiagramView());
- }
- }
- }
-
- @Override
public Object getAdapter(Class adapter) {
if (adapter != null && adapter.equals(ViewInfo.class)) {
return getDiagramViewInfo();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/CommandHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/CommandHelper.java
index d449676a36a..ce9d261b12b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/CommandHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/CommandHelper.java
@@ -33,8 +33,6 @@ import org.eclipse.emf.transaction.RollbackException;
import org.eclipse.emf.transaction.Transaction;
import org.eclipse.emf.transaction.TransactionalCommandStack;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain;
-import org.eclipse.emf.transaction.impl.TransactionalCommandStackImpl;
import org.eclipse.gef.EditDomain;
import org.eclipse.gef.Tool;
import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
@@ -46,6 +44,8 @@ import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.infra.core.editor.CoreMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
+import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.papyrus.uml.diagram.common.util.MessageDirection;
import org.eclipse.papyrus.uml.diagram.sequence.CustomMessages;
import org.eclipse.papyrus.uml.diagram.sequence.SequencePaletteFactory.AspectUnspecifiedTypeConnectionToolEx;
@@ -510,15 +510,13 @@ public class CommandHelper {
* The command
* @param flag
*/
- public static void executeCommandWithoutHistory(EditingDomain editingDomain, org.eclipse.emf.common.command.Command command, boolean flag) {
- TransactionalCommandStackImpl stack = new TransactionalCommandStackImpl();
- stack.setEditingDomain((InternalTransactionalEditingDomain) editingDomain);
+ public static void executeCommandWithoutHistory(TransactionalEditingDomain editingDomain, org.eclipse.emf.common.command.Command command, boolean flag) {
try {
- stack.execute(command, Collections.singletonMap(Transaction.OPTION_UNPROTECTED, Boolean.TRUE));
- } catch (InterruptedException e) {
- e.printStackTrace();
- } catch (RollbackException e) {
- e.printStackTrace();
+ GMFUnsafe.write(editingDomain, command);
+ } catch (RollbackException ex) {
+ Activator.log.error(ex);
+ } catch (InterruptedException ex) {
+ Activator.log.error(ex);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineEditPartUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineEditPartUtil.java
index cde04babf35..a3c557a0e3d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineEditPartUtil.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineEditPartUtil.java
@@ -78,7 +78,7 @@ public class LifelineEditPartUtil {
return null;
}
IFigure contentPane = lifelineEditPart.getContentPane();
- NodeFigure centerFigure = null;
+
if (contentPane instanceof LifelineDotLineCustomFigure) {
return ((LifelineDotLineCustomFigure) contentPane).getDashLineRectangle();
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineHeadUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineHeadUtil.java
index 12f293e2303..83ec2e7a949 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineHeadUtil.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineHeadUtil.java
@@ -69,7 +69,7 @@ public class LifelineHeadUtil {
public static int computeLifelineVerticalPosition(final EditPart parent) {
if (parent instanceof GraphicalEditPart) {
- List children = parent.getChildren();
+ List<?> children = parent.getChildren();
int bottom = -1;
for (Object object : children) {
if (!(object instanceof LifelineEditPart)) {
@@ -113,7 +113,7 @@ public class LifelineHeadUtil {
while (parent instanceof LifelineEditPart) {
parent = parent.getParent();
}
- List childrenList = parent.getChildren();
+ List<?> childrenList = parent.getChildren();
for (Object object : childrenList) {
if (toMovedLifelines.contains(object) || !(object instanceof LifelineEditPart)) {
continue;
@@ -192,7 +192,7 @@ public class LifelineHeadUtil {
Command cmd = getVerticalMoveShapeCommand((ShapeNodeEditPart) ep, moveDelta, false);
commands.appendIfCanExecute(cmd);
movedEditParts.add(ep);
- List children = ep.getChildren();
+ List<?> children = ep.getChildren();
for (Object object : children) {
if (movedEditParts.contains(object)) {
continue;
@@ -228,7 +228,7 @@ public class LifelineHeadUtil {
while (parent instanceof LifelineEditPart) {
parent = parent.getParent();
}
- List childrenList = parent.getChildren();
+ List<?> childrenList = parent.getChildren();
for (Object object : childrenList) {
if (toMovedLifelines.contains(object) || !(object instanceof LifelineEditPart)) {
continue;
@@ -244,7 +244,7 @@ public class LifelineHeadUtil {
}
private static void fillMoveDownMessageEnds(CompoundCommand commands, GraphicalEditPart editPart, int moveDelta, List<EditPart> movedEditParts) {
- List sourceConnections = editPart.getSourceConnections();
+ List<?> sourceConnections = editPart.getSourceConnections();
for (Object object : sourceConnections) {
ConnectionEditPart conn = (ConnectionEditPart) object;
EditPart target = conn.getTarget();
@@ -257,7 +257,7 @@ public class LifelineHeadUtil {
commands.appendIfCanExecute(command);
}
}
- List targetConnections = editPart.getTargetConnections();
+ List<?> targetConnections = editPart.getTargetConnections();
for (Object object : targetConnections) {
ConnectionEditPart conn = (ConnectionEditPart) object;
if (conn instanceof Message7EditPart) {
@@ -311,7 +311,7 @@ public class LifelineHeadUtil {
return;
}
// 1. links from current lifeline
- List sourceConnections = editPart.getSourceConnections();
+ List<?> sourceConnections = editPart.getSourceConnections();
for (Object object : sourceConnections) {
ConnectionEditPart conn = (ConnectionEditPart) object;
LifelineEditPart target = getLifeline(conn.getTarget());
@@ -322,7 +322,7 @@ public class LifelineHeadUtil {
}
// 2. links to current lifeline.
- List targetConnections = editPart.getTargetConnections();
+ List<?> targetConnections = editPart.getTargetConnections();
for (Object object : targetConnections) {
ConnectionEditPart conn = (ConnectionEditPart) object;
LifelineEditPart source = getLifeline(conn.getSource());
@@ -333,7 +333,7 @@ public class LifelineHeadUtil {
}
if (editPart instanceof CustomLifelineEditPart && ((CustomLifelineEditPart) editPart).isInlineMode()) {
- List children = ((CustomLifelineEditPart) editPart).getChildren();
+ List<?> children = ((CustomLifelineEditPart) editPart).getChildren();
for (Object object : children) {
if (object instanceof LifelineEditPart) {
collectLifelines(toMovedLifelines, (LifelineEditPart) object);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineMessageCreateHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineMessageCreateHelper.java
index d5a69fe5e59..9202d2d4140 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineMessageCreateHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineMessageCreateHelper.java
@@ -115,7 +115,7 @@ public class LifelineMessageCreateHelper {
// when a lifleine is deleted, move its created lifelines up
public static Command restoreLifelineOnDelete(Command command, LifelineEditPart part) {
- List list = part.getSourceConnections();
+ List<?> list = part.getSourceConnections();
if (list != null && list.size() > 0) {
for (Object l : list) {
if (l instanceof Message4EditPart) {
@@ -136,7 +136,7 @@ public class LifelineMessageCreateHelper {
}
public static boolean hasMessageCreate(GraphicalEditPart sourceEditPart, EditPart targetEditPart) {
- List list = sourceEditPart.getSourceConnections();
+ List<?> list = sourceEditPart.getSourceConnections();
for (Object o : list) {
if (o instanceof Message4EditPart && targetEditPart.equals(((Message4EditPart) o).getTarget())) {
return true;
@@ -149,14 +149,14 @@ public class LifelineMessageCreateHelper {
return getIncomingMessageCreate(target).size() > 0;
}
- public static List getIncomingMessageCreate(EditPart target) {
- List create = new ArrayList();
+ public static List<?> getIncomingMessageCreate(EditPart target) {
+ List<EditPart> create = new ArrayList<EditPart>();
if (target instanceof LifelineEditPart) {
- List list = ((LifelineEditPart) target).getTargetConnections();
+ List<?> list = ((LifelineEditPart) target).getTargetConnections();
if (list != null && list.size() > 0) {
for (Object l : list) {
if (l instanceof Message4EditPart) {
- create.add(l);
+ create.add((Message4EditPart) l);
}
}
}
@@ -222,7 +222,7 @@ public class LifelineMessageCreateHelper {
// move all lifelines which has incoming create link from part
public static Command moveCascadeLifeline(LifelineEditPart part, Command command, int dy) {
- List list = part.getSourceConnections();
+ List<?> list = part.getSourceConnections();
if (list != null && list.size() > 0) {
for (Object l : list) {
if (l instanceof Message4EditPart) {
@@ -251,7 +251,7 @@ public class LifelineMessageCreateHelper {
public static boolean canMoveLifelineVertical(LifelineEditPart child, Rectangle newBounds) {
int halfHeight = child.getPrimaryShape().getFigureLifelineNameContainerFigure().getBounds().height / 2;
// check outgoing links
- List list = child.getSourceConnections();
+ List<?> list = child.getSourceConnections();
if (list != null && list.size() > 0) {
for (Object l : list) {
if (l instanceof Message4EditPart && ((Message4EditPart) l).getTarget() instanceof LifelineEditPart) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/MessageAnchorRepairer.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/MessageAnchorRepairer.java
index 55f9a6deba9..7c3838823bf 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/MessageAnchorRepairer.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/MessageAnchorRepairer.java
@@ -20,7 +20,7 @@ import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.PrecisionPoint;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.common.command.AbstractCommand;
-import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.NodeEditPart;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
@@ -95,8 +95,8 @@ public class MessageAnchorRepairer {
if (oldHeight == newHeight) {
return;
}
- EditingDomain editingDomain = ((GraphicalEditPart) editPart).getEditingDomain();
- List sourceConnections = editPart.getSourceConnections();
+ TransactionalEditingDomain editingDomain = ((GraphicalEditPart) editPart).getEditingDomain();
+ List<?> sourceConnections = editPart.getSourceConnections();
for (Object object : sourceConnections) {
if (!(object instanceof AbstractMessageEditPart)) {
continue;
@@ -106,7 +106,7 @@ public class MessageAnchorRepairer {
final IdentityAnchor anchor = (IdentityAnchor) edge.getSourceAnchor();
updateAnchorTerminal(editingDomain, anchor, oldHeight, newHeight);
}
- List targetConnections = editPart.getTargetConnections();
+ List<?> targetConnections = editPart.getTargetConnections();
for (Object object : targetConnections) {
if (!(object instanceof AbstractMessageEditPart)) {
continue;
@@ -118,7 +118,7 @@ public class MessageAnchorRepairer {
}
}
- private static void updateAnchorTerminal(EditingDomain editingDomain, final IdentityAnchor anchor, int oldHeight, int newHeight) {
+ private static void updateAnchorTerminal(TransactionalEditingDomain editingDomain, final IdentityAnchor anchor, int oldHeight, int newHeight) {
final String oldTerminal = anchor.getId();
PrecisionPoint pp = BaseSlidableAnchor.parseTerminalString(oldTerminal);
int yPos = (int) Math.round(oldHeight * pp.preciseY());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java
index d9b8b405fe4..36a58ea83bb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java
@@ -113,7 +113,7 @@ public class OperandBoundsComputeHelper {
*/
public static InteractionOperandEditPart findFirstIOEP(CombinedFragmentCombinedFragmentCompartmentEditPart compartEP) {
InteractionOperandEditPart firstIOEP = null;
- List children = compartEP.getChildren();
+ List<?> children = compartEP.getChildren();
for (int i = 0; i < children.size(); i++) {
if (children.get(i) instanceof InteractionOperandEditPart) {
firstIOEP = (InteractionOperandEditPart) children.get(i);
@@ -131,7 +131,7 @@ public class OperandBoundsComputeHelper {
*/
public static InteractionOperandEditPart findLastIOEP(CombinedFragmentCombinedFragmentCompartmentEditPart compartEP) {
InteractionOperandEditPart lastIOEP = null;
- List children = compartEP.getChildren();
+ List<?> children = compartEP.getChildren();
for (int i = children.size() - 1; i >= 0; i--) {
if (children.get(i) instanceof InteractionOperandEditPart) {
lastIOEP = (InteractionOperandEditPart) children.get(i);
@@ -150,7 +150,7 @@ public class OperandBoundsComputeHelper {
*/
public static InteractionOperandEditPart findPreviousIOEP(CombinedFragmentCombinedFragmentCompartmentEditPart compartEP, InteractionOperandEditPart currentIOEP) {
InteractionOperandEditPart previousIOEP = null;
- List children = compartEP.getChildren();
+ List<?> children = compartEP.getChildren();
for (int i = 0; i < children.size() - 1; i++) {
if (children.get(i) instanceof InteractionOperandEditPart) {
if (children.get(i) == currentIOEP) {
@@ -172,7 +172,7 @@ public class OperandBoundsComputeHelper {
*/
public static InteractionOperandEditPart findLatterIOEP(CombinedFragmentCombinedFragmentCompartmentEditPart compartEP, InteractionOperandEditPart currentIOEP) {
InteractionOperandEditPart latterIOEP = null;
- List children = compartEP.getChildren();
+ List<?> children = compartEP.getChildren();
for (int i = children.size() - 1; i > 0; i--) {
if (children.get(i) instanceof InteractionOperandEditPart) {
if (children.get(i) == currentIOEP) {
@@ -792,13 +792,13 @@ public class OperandBoundsComputeHelper {
private static ICommand getMoveAnchorCommand(int yDelta, Rectangle figureBounds, IdentityAnchor gmfAnchor) {
String oldTerminal = gmfAnchor.getId();
PrecisionPoint pp = BaseSlidableAnchor.parseTerminalString(oldTerminal);
- int yPos = (int) Math.round(figureBounds.height * pp.preciseY);
+ int yPos = (int) Math.round(figureBounds.height * pp.preciseY());
yPos += yDelta;
- pp.preciseY = (double) yPos / figureBounds.height;
- if (pp.preciseY > 1.0) {
- pp.preciseY = 1.0;
- } else if (pp.preciseY < 0.0) {
- pp.preciseY = 0.0;
+ pp.setPreciseY((double) yPos / figureBounds.height);
+ if (pp.preciseY() > 1.0) {
+ pp.setPreciseY(1.0);
+ } else if (pp.preciseY() < 0.0) {
+ pp.setPreciseY(0.0);
}
String newTerminal = (new BaseSlidableAnchor(null, pp)).getTerminal();
return new SetValueCommand(new SetRequest(gmfAnchor, NotationPackage.Literals.IDENTITY_ANCHOR__ID, newTerminal));
@@ -939,7 +939,7 @@ public class OperandBoundsComputeHelper {
* @param command
*/
public static void addUpdateBoundsForIOCreationCommand(CombinedFragmentCombinedFragmentCompartmentEditPart compartment, ViewDescriptor viewDescriptor, CompositeCommand command) {
- List children = compartment.getChildren();
+ List<?> children = compartment.getChildren();
if (children != null && children.size() > 0) {
InteractionOperandEditPart lastOperandEP = OperandBoundsComputeHelper.findLastIOEP(compartment);
// update bounds
@@ -1551,7 +1551,7 @@ public class OperandBoundsComputeHelper {
SetBoundsCommand cmd = new SetBoundsCommand(getEditingDomain(), getLabel(), child, newBounds);
moveCommand.add(new ICommandProxy(cmd));
moveCommand = OccurrenceSpecificationMoveHelper.completeMoveExecutionSpecificationCommand(moveCommand, child, newBounds, new ChangeBoundsRequest());
- List targetConnections = child.getTargetConnections();
+ List<?> targetConnections = child.getTargetConnections();
for (Object object : targetConnections) {
if (!(object instanceof AbstractMessageEditPart)) {
continue;
@@ -1572,7 +1572,7 @@ public class OperandBoundsComputeHelper {
}
}
}
- List sourceConnections = child.getSourceConnections();
+ List<?> sourceConnections = child.getSourceConnections();
for (Object object : sourceConnections) {
if (!(object instanceof AbstractMessageEditPart)) {
continue;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceDeleteHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceDeleteHelper.java
index b6d36d43e52..14993637e92 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceDeleteHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceDeleteHelper.java
@@ -306,7 +306,7 @@ public class SequenceDeleteHelper {
destroyMessageEvents(deleteElementsCommand, host.getTargetConnections(), transactionalEditingDomain);
}
- static void destroyMessageEvents(CompoundCommand deleteElementsCommand, List list, TransactionalEditingDomain transactionalEditingDomain) {
+ static void destroyMessageEvents(CompoundCommand deleteElementsCommand, List<?> list, TransactionalEditingDomain transactionalEditingDomain) {
for (Object o : list) {
if (o instanceof ConnectionEditPart) {
EObject model = ((ConnectionEditPart) o).resolveSemanticElement();
@@ -402,7 +402,7 @@ public class SequenceDeleteHelper {
List<TimeObservationLabelEditPart> timeObservationEditParts = SequenceUtil.findOccurenceSpecificationRelatedTimeObservationPart(srcLifelinePart, oss);
for (final TimeObservationLabelEditPart timeObservationEditPart : timeObservationEditParts) {
View view = (View) timeObservationEditPart.getModel();
- EList sourceEdges = view.getSourceEdges();
+ List<?> sourceEdges = view.getSourceEdges();
for (Object sourceEdge : sourceEdges) {
Command deleteTimeViewCommand = new ICommandProxy(new DeleteCommand(editingDomain, (View) sourceEdge));
deleteViewsCmd.add(deleteTimeViewCommand);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceLinkMappingHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceLinkMappingHelper.java
index 7ec62c53163..f74405a172c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceLinkMappingHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceLinkMappingHelper.java
@@ -81,8 +81,8 @@ public class SequenceLinkMappingHelper implements ILinkMappingHelper {
} else {
return Collections.singletonList(object.getInteraction());
}
- return Collections.EMPTY_LIST;
- };
+ return Collections.emptyList();
+ }
@Override
public Collection<?> caseGeneralOrdering(GeneralOrdering object) {
@@ -90,7 +90,7 @@ public class SequenceLinkMappingHelper implements ILinkMappingHelper {
OccurrenceSpecification before = object.getBefore();
return before.getCovereds();
}
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
});
}
@@ -116,8 +116,8 @@ public class SequenceLinkMappingHelper implements ILinkMappingHelper {
} else {
return Collections.singletonList(object.getInteraction());
}
- return Collections.EMPTY_LIST;
- };
+ return Collections.emptyList();
+ }
@Override
public Collection<?> caseGeneralOrdering(GeneralOrdering object) {
@@ -125,7 +125,7 @@ public class SequenceLinkMappingHelper implements ILinkMappingHelper {
OccurrenceSpecification after = object.getAfter();
return after.getCovereds();
}
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
});
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceUtil.java
index e8520fc6e21..c8c275c8f99 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceUtil.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceUtil.java
@@ -42,7 +42,6 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature.Setting;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.edit.command.SetCommand;
-import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.commands.Command;
@@ -474,8 +473,8 @@ public class SequenceUtil {
String oldTerminal = ((IdentityAnchor) idAnchor).getId();
PrecisionPoint pp = BaseSlidableAnchor.parseTerminalString(oldTerminal);
if (pp.preciseX() <= 1 && pp.preciseX() >= 0 && pp.preciseY() >= 0 && pp.preciseY() <= 1) {
- int xPos = linkedPartBounds.x + delta.width + (int) Math.round(anchorOwningFigure.getBounds().width * pp.preciseX);
- int yPos = linkedPartBounds.y + delta.height + (int) Math.round(anchorOwningFigure.getBounds().height * pp.preciseY);
+ int xPos = linkedPartBounds.x + delta.width + (int) Math.round(anchorOwningFigure.getBounds().width * pp.preciseX());
+ int yPos = linkedPartBounds.y + delta.height + (int) Math.round(anchorOwningFigure.getBounds().height * pp.preciseY());
return new Point(xPos, yPos);
}
}
@@ -980,7 +979,7 @@ public class SequenceUtil {
return elements;
}
- public static void handleMessageSortChange(EditingDomain editingDomain, Notification notification, Message message, MessageSort expectedMessageSort) {
+ public static void handleMessageSortChange(TransactionalEditingDomain editingDomain, Notification notification, Message message, MessageSort expectedMessageSort) {
// This restriction isn't needed anymore, as the Property View offers a refactoring
// facility for the MessageSort. The refactoring is only available for AsynchCall to
// AsynchSignal and vice-versa.
@@ -1560,7 +1559,7 @@ public class SequenceUtil {
* @return boolean
*/
public static boolean isCreateMessageEndLifeline(LifelineEditPart lifelineEP) {
- List<Object> targetConnections = lifelineEP.getTargetConnections();
+ List<?> targetConnections = lifelineEP.getTargetConnections();
if (targetConnections != null && targetConnections.size() > 0) {
for (int i = 0; i < targetConnections.size(); i++) {
Object connection = targetConnections.get(i);
@@ -1624,7 +1623,7 @@ public class SequenceUtil {
* @param targetClass
* @return EditPart
*/
- public static EditPart getEditPart(EditPart editPart, EObject targetElement, Class targetClass) {
+ public static EditPart getEditPart(EditPart editPart, EObject targetElement, Class<?> targetClass) {
if (editPart == null || targetElement == null || targetClass == null) {
return null;
}

Back to the top