diff options
Diffstat (limited to 'plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal')
72 files changed, 453 insertions, 1439 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/RangeHelper.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/RangeHelper.java index 5a40b191e9..011d842925 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/RangeHelper.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/RangeHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014 Obeo. + * Copyright (c) 2014, 2021 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,13 +13,13 @@ package org.eclipse.sirius.diagram.sequence.business.internal; import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.sirius.diagram.sequence.util.Range; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import com.google.common.base.Function; import com.google.common.collect.Ordering; /** - * Helper functions and orderings for the Range type. + * Helper functions and orderings for the Range type. * * @author pcdavid */ @@ -27,6 +27,7 @@ public final class RangeHelper { private RangeHelper() { // Prevent instanciation } + /** * A function to obtain the lower bound of a range. * @@ -84,8 +85,7 @@ public final class RangeHelper { } /** - * Returns a range representing the horizontal range occupied by a - * rectangle. + * Returns a range representing the horizontal range occupied by a rectangle. * * @param rect * the rectangle. @@ -101,6 +101,7 @@ public final class RangeHelper { private enum LowerBoundFunction implements Function<Range, Integer> { INSTANCE; + @Override public Integer apply(Range from) { return from.getLowerBound(); } @@ -117,6 +118,7 @@ public final class RangeHelper { private enum UpperBoundFunction implements Function<Range, Integer> { INSTANCE; + @Override public Integer apply(Range from) { return from.getUpperBound(); } @@ -133,6 +135,7 @@ public final class RangeHelper { private enum WidthFunction implements Function<Range, Integer> { INSTANCE; + @Override public Integer apply(Range from) { return from.width(); } diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/VerticalPositionFunction.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/VerticalPositionFunction.java index 48ecdf9d81..57813a281b 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/VerticalPositionFunction.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/VerticalPositionFunction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -15,26 +15,24 @@ package org.eclipse.sirius.diagram.sequence.business.internal; import org.eclipse.emf.ecore.EObject; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.sequence.SequenceDDiagram; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceElementAccessor; import org.eclipse.sirius.diagram.sequence.business.internal.ordering.EventEndHelper; import org.eclipse.sirius.diagram.sequence.ordering.CompoundEventEnd; import org.eclipse.sirius.diagram.sequence.ordering.EventEnd; import org.eclipse.sirius.diagram.sequence.ordering.SingleEventEnd; -import org.eclipse.sirius.diagram.sequence.util.Range; import com.google.common.base.Function; import com.google.common.collect.Iterables; /** - * A function which computes the vertical position (in absolute, normalized - * coordinates) of an {@link EventEnd}. + * A function which computes the vertical position (in absolute, normalized coordinates) of an {@link EventEnd}. * * @author pcdavid */ public class VerticalPositionFunction implements Function<EventEnd, Integer> { /** - * The value returned by the function to indicate an invalid input from - * which a position can not be determined. + * The value returned by the function to indicate an invalid input from which a position can not be determined. */ public static final int INVALID_POSITION = Integer.MAX_VALUE; @@ -51,15 +49,14 @@ public class VerticalPositionFunction implements Function<EventEnd, Integer> { } /** - * Returns the vertical position of the specified end as it appears on the - * diagram associated to this function, or <code>INVALID_POSITION</code> if - * the end is invalid or is not part of the diagram. + * Returns the vertical position of the specified end as it appears on the diagram associated to this function, or + * <code>INVALID_POSITION</code> if the end is invalid or is not part of the diagram. * * @param end * the end for which to compute the position. - * @return the vertical position of the end, or - * <code>INVALID_POSITION</code>. + * @return the vertical position of the end, or <code>INVALID_POSITION</code>. */ + @Override public Integer apply(EventEnd end) { Integer result; SingleEventEnd see = null; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/VerticalRangeFunction.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/VerticalRangeFunction.java index 70f9073f33..33b43ba4e5 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/VerticalRangeFunction.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/VerticalRangeFunction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,16 +13,15 @@ package org.eclipse.sirius.diagram.sequence.business.internal; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceElementAccessor; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceEvent; -import org.eclipse.sirius.diagram.sequence.util.Range; import org.eclipse.sirius.ext.base.Option; import com.google.common.base.Function; /** - * Computes the absolute vertical range occupied by an element of a sequence - * diagram, from its GMF View. + * Computes the absolute vertical range occupied by an element of a sequence diagram, from its GMF View. * * @author pcdavid */ @@ -35,6 +34,7 @@ public enum VerticalRangeFunction implements Function<View, Range> { /** * {@inheritDoc} */ + @Override public Range apply(View view) { Range result = Range.emptyRange(); Option<ISequenceEvent> iSequenceEvent = ISequenceElementAccessor.getISequenceEvent(view); diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/color/DefaultColorStyleDescription.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/color/DefaultColorStyleDescription.java deleted file mode 100644 index 7944f52715..0000000000 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/color/DefaultColorStyleDescription.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 THALES GLOBAL SERVICES. - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.diagram.sequence.business.internal.color; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.sirius.diagram.sequence.template.TExecutionStyle; -import org.eclipse.sirius.diagram.sequence.template.TLifelineStyle; -import org.eclipse.sirius.diagram.sequence.template.TMessageStyle; -import org.eclipse.sirius.diagram.sequence.template.util.TemplateSwitch; -import org.eclipse.sirius.tools.api.ui.color.EnvironmentSystemColorFactory; - -/** - * Class responsible for setting default color values on style descriptions. - * - * @author mporhel - * - */ -public class DefaultColorStyleDescription extends TemplateSwitch<EObject> { - - private static final String BLACK = "black"; //$NON-NLS-1$ - - private static final String GRAY = "gray"; //$NON-NLS-1$ - - /** - * Set the default color descriptions on the given EObject. - * - * @param theEObject - * the object to update. - */ - public void setDefaultColors(final EObject theEObject) { - doSwitch(theEObject); - } - - /** - * {@inheritDoc} - */ - @Override - public EObject caseTLifelineStyle(TLifelineStyle object) { - object.setLifelineColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription(BLACK)); - return super.caseTLifelineStyle(object); - } - - /** - * {@inheritDoc} - */ - @Override - public EObject caseTExecutionStyle(TExecutionStyle object) { - object.setBorderColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription(BLACK)); - object.setBackgroundColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription(GRAY)); - return super.caseTExecutionStyle(object); - } - - /** - * {@inheritDoc} - */ - @Override - public EObject caseTMessageStyle(TMessageStyle object) { - object.setStrokeColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription(BLACK)); - return super.caseTMessageStyle(object); - } -} diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/SequenceDiagramMetamodelsProvider.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/dialect/SequenceDiagramMetamodelsProvider.java index 8f39dfca34..616253d740 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/SequenceDiagramMetamodelsProvider.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/dialect/SequenceDiagramMetamodelsProvider.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2015 Obeo + * Copyright (c) 2015, 2021 Obeo * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -11,7 +11,7 @@ * Obeo - initial API and implementation * */ -package org.eclipse.sirius.diagram.sequence.business.internal.metamodel; +package org.eclipse.sirius.diagram.sequence.business.internal.dialect; import java.util.Collection; import java.util.LinkedHashSet; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/AbstractFrame.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/AbstractFrame.java index aa4d58cc11..d1f34f248e 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/AbstractFrame.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/AbstractFrame.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -29,13 +29,13 @@ import org.eclipse.sirius.common.tools.api.profiler.ProfilerTask; import org.eclipse.sirius.common.tools.api.util.StringUtil; import org.eclipse.sirius.diagram.DDiagramElement; import org.eclipse.sirius.diagram.description.DiagramElementMapping; -import org.eclipse.sirius.diagram.sequence.Messages; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.util.CacheHelper; import org.eclipse.sirius.diagram.sequence.business.internal.util.EventFinder; import org.eclipse.sirius.diagram.sequence.business.internal.util.ParentOperandFinder; import org.eclipse.sirius.diagram.sequence.description.DescriptionPackage; import org.eclipse.sirius.diagram.sequence.description.FrameMapping; -import org.eclipse.sirius.diagram.sequence.util.Range; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.base.Options; import org.eclipse.sirius.tools.api.interpreter.InterpreterUtil; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/AbstractNodeEvent.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/AbstractNodeEvent.java index 00ca0f5a7d..6ccb0a5654 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/AbstractNodeEvent.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/AbstractNodeEvent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -24,13 +24,13 @@ import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.DDiagramElement; -import org.eclipse.sirius.diagram.sequence.Messages; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.query.SequenceNodeQuery; import org.eclipse.sirius.diagram.sequence.business.internal.util.CacheHelper; import org.eclipse.sirius.diagram.sequence.business.internal.util.ParentOperandFinder; import org.eclipse.sirius.diagram.sequence.business.internal.util.RangeSetter; import org.eclipse.sirius.diagram.sequence.description.DescriptionPackage; -import org.eclipse.sirius.diagram.sequence.util.Range; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.ext.base.Option; import com.google.common.base.Preconditions; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/AbstractSequenceElement.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/AbstractSequenceElement.java index 4586b409eb..fedb31ae18 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/AbstractSequenceElement.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/AbstractSequenceElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -12,6 +12,8 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.sequence.business.internal.elements; +import java.util.Objects; + import org.eclipse.emf.common.notify.impl.AdapterImpl; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; @@ -20,13 +22,11 @@ import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.DDiagramElement; import org.eclipse.sirius.diagram.business.api.query.DiagramElementMappingQuery; import org.eclipse.sirius.diagram.description.DiagramElementMapping; -import org.eclipse.sirius.diagram.sequence.Messages; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.base.Options; import org.eclipse.sirius.viewpoint.DSemanticDecorator; -import com.google.common.base.Preconditions; - /** * Partial abstract implementation of {@link ISequenceElement}. * @@ -50,7 +50,7 @@ public abstract class AbstractSequenceElement extends AdapterImpl implements ISe * the underlying GMF View. */ AbstractSequenceElement(View view) { - this.view = Preconditions.checkNotNull(view); + this.view = Objects.requireNonNull(view); } /** @@ -67,7 +67,7 @@ public abstract class AbstractSequenceElement extends AdapterImpl implements ISe * @return true is element is a sequence diagram element */ protected static final boolean isSequenceDiagramElement(DDiagramElement element, EClass mappingType) { - Preconditions.checkNotNull(mappingType); + Objects.requireNonNull(mappingType); boolean result = false; if (element != null) { DiagramElementMapping mapping = element.getDiagramElementMapping(); diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/CombinedFragment.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/CombinedFragment.java index 7d9fd1dcb9..9ce6b20f9d 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/CombinedFragment.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/CombinedFragment.java @@ -20,13 +20,13 @@ import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.DDiagramElement; -import org.eclipse.sirius.diagram.sequence.Messages; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.RangeHelper; import org.eclipse.sirius.diagram.sequence.business.internal.query.SequenceNodeQuery; import org.eclipse.sirius.diagram.sequence.business.internal.util.CacheHelper; import org.eclipse.sirius.diagram.sequence.business.internal.util.RangeSetter; import org.eclipse.sirius.diagram.sequence.description.DescriptionPackage; -import org.eclipse.sirius.diagram.sequence.util.Range; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.base.Options; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/EndOfLife.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/EndOfLife.java index fee445935c..5e3d7f3ae2 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/EndOfLife.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/EndOfLife.java @@ -20,8 +20,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.sirius.diagram.DDiagramElement; -import org.eclipse.sirius.diagram.sequence.Messages; import org.eclipse.sirius.diagram.sequence.description.DescriptionPackage; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.base.Options; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Execution.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Execution.java index fba1d656cb..ed52b47caa 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Execution.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Execution.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -24,7 +24,7 @@ import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.DDiagramElement; -import org.eclipse.sirius.diagram.sequence.Messages; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.layout.LayoutConstants; import org.eclipse.sirius.diagram.sequence.business.internal.ordering.EventEndHelper; import org.eclipse.sirius.diagram.sequence.business.internal.query.ISequenceEventQuery; @@ -34,7 +34,7 @@ import org.eclipse.sirius.diagram.sequence.description.DescriptionPackage; import org.eclipse.sirius.diagram.sequence.ordering.CompoundEventEnd; import org.eclipse.sirius.diagram.sequence.ordering.EventEnd; import org.eclipse.sirius.diagram.sequence.ordering.SingleEventEnd; -import org.eclipse.sirius.diagram.sequence.util.Range; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.base.Options; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/ISequenceEvent.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/ISequenceEvent.java index ac54dbe3f4..5cb39ec7b3 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/ISequenceEvent.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/ISequenceEvent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -16,16 +16,16 @@ import java.util.Collection; import java.util.List; import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.sirius.diagram.sequence.util.Range; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.ext.base.Option; import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.base.Predicates; + /** - * Common interface for all the elements of a sequence diagram which represent - * an event associated to a (logical) time interval and thus a range of vertical - * coordinates. This includes lifelines (considered as a special case of + * Common interface for all the elements of a sequence diagram which represent an event associated to a (logical) time + * interval and thus a range of vertical coordinates. This includes lifelines (considered as a special case of * executions), executions and messages. * * @author mporhel @@ -43,26 +43,23 @@ public interface ISequenceEvent extends ISequenceElement { * A function to compute the vertical range a sequence event. */ Function<ISequenceEvent, Range> VERTICAL_RANGE = new Function<ISequenceEvent, Range>() { + @Override public Range apply(ISequenceEvent from) { return from.getVerticalRange(); } }; /** - * Tests whether this event should be considered logically to be - * instantaneous. Depending on its graphical representation, it may still - * cover a significant vertical space. + * Tests whether this event should be considered logically to be instantaneous. Depending on its graphical + * representation, it may still cover a significant vertical space. * - * @return <code>true</code> if this event should be considered - * instantaneous. + * @return <code>true</code> if this event should be considered instantaneous. */ boolean isLogicallyInstantaneous(); /** - * Returns the vertical range of coordinates this event covers. The - * coordinates are normalized y coordinates (relative to the origin of the - * logical plane, whatever the scroll state is, and independent of the zoom - * level). + * Returns the vertical range of coordinates this event covers. The coordinates are normalized y coordinates + * (relative to the origin of the logical plane, whatever the scroll state is, and independent of the zoom level). * * @return the vertical range of coordinates this event covers. */ @@ -79,61 +76,53 @@ public interface ISequenceEvent extends ISequenceElement { void setVerticalRange(Range range) throws IllegalStateException; /** - * Returns the parent event of this event (from a business point of view), - * if any. Returns <code>null</code> for top-level events, i.e. lifelines. + * Returns the parent event of this event (from a business point of view), if any. Returns <code>null</code> for + * top-level events, i.e. lifelines. * * @return the parent event of this event, if any. */ ISequenceEvent getParentEvent(); /** - * Returns the hierarchical parent event of this event (from a Notation - * point of view), if any. Returns <code>null</code> for top-level events - * i.e. lifelines / frames / messages. + * Returns the hierarchical parent event of this event (from a Notation point of view), if any. Returns + * <code>null</code> for top-level events i.e. lifelines / frames / messages. * * @return the hierarchical parent event of this event, if any. */ ISequenceEvent getHierarchicalParentEvent(); /** - * Returns the list of direct sub-events of this event, in chronological - * (and thus also graphical) order. This includes both events which are - * directly owned by this event (e.g. the messages sent by an execution) and - * events not owned but connected to this event (e.g. the messages received - * by an execution). + * Returns the list of direct sub-events of this event, in chronological (and thus also graphical) order. This + * includes both events which are directly owned by this event (e.g. the messages sent by an execution) and events + * not owned but connected to this event (e.g. the messages received by an execution). * - * @return the list of direct sub-events of this event, in chronological - * order. + * @return the list of direct sub-events of this event, in chronological order. */ List<ISequenceEvent> getSubEvents(); /** - * Returns the vertical range of coordinates inside which direct sub-events - * of this event can be. The coordinates are normalized y coordinates. The - * range returned is guaranteed to be a sub-range of - * {@link #getVerticalRange()} or the empty range for events which can not - * have children. + * Returns the vertical range of coordinates inside which direct sub-events of this event can be. The coordinates + * are normalized y coordinates. The range returned is guaranteed to be a sub-range of {@link #getVerticalRange()} + * or the empty range for events which can not have children. * * @return the vertical range in */ Range getValidSubEventsRange(); /** - * Tests whether a given child can be placed anywhere in the specified - * vertical range. + * Tests whether a given child can be placed anywhere in the specified vertical range. * * @param child * the child. * @param range * the vertical range to test. - * @return <code>true</code> if the child can be placed anywhere inside the - * specified vertical range (including occupying the whole range). + * @return <code>true</code> if the child can be placed anywhere inside the specified vertical range (including + * occupying the whole range). */ boolean canChildOccupy(ISequenceEvent child, Range range); /** - * Tests whether a given child can be placed anywhere in the specified - * vertical range. + * Tests whether a given child can be placed anywhere in the specified vertical range. * * @param child * the child. @@ -143,16 +132,16 @@ public interface ISequenceEvent extends ISequenceElement { * the list of events to ignore while computing canChildOccupy. * @param lifelines * lifelines to inspect. - * @return <code>true</code> if the child can be placed anywhere inside the - * specified vertical range (including occupying the whole range). + * @return <code>true</code> if the child can be placed anywhere inside the specified vertical range (including + * occupying the whole range). */ boolean canChildOccupy(ISequenceEvent child, Range range, List<ISequenceEvent> eventsToIgnore, Collection<Lifeline> lifelines); /** * Calculate the maximal occupied range of this event. * - * @return the maximal range occupied by children of this event, from the - * beginning of the first sub-event to the end of the last one. + * @return the maximal range occupied by children of this event, from the beginning of the first sub-event to the + * end of the last one. */ Range getOccupiedRange(); diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/InstanceRole.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/InstanceRole.java index 5c0f1a6309..c6a9fbe862 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/InstanceRole.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/InstanceRole.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -22,8 +22,8 @@ import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.DDiagramElement; import org.eclipse.sirius.diagram.DNode; import org.eclipse.sirius.diagram.business.api.query.NodeStyleQuery; -import org.eclipse.sirius.diagram.sequence.Messages; import org.eclipse.sirius.diagram.sequence.description.DescriptionPackage; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.base.Options; import org.eclipse.sirius.viewpoint.DRepresentationElement; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/InteractionUse.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/InteractionUse.java index 80ddbcaef9..72109c5577 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/InteractionUse.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/InteractionUse.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -20,11 +20,11 @@ import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.DDiagramElement; -import org.eclipse.sirius.diagram.sequence.Messages; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.query.SequenceNodeQuery; import org.eclipse.sirius.diagram.sequence.business.internal.util.RangeSetter; import org.eclipse.sirius.diagram.sequence.description.DescriptionPackage; -import org.eclipse.sirius.diagram.sequence.util.Range; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import com.google.common.base.Preconditions; import com.google.common.base.Predicate; @@ -38,14 +38,12 @@ public class InteractionUse extends AbstractFrame { /** * The visual ID. Same as a normal bordered node. * - * see org.eclipse.sirius.diagram.internal.edit.parts. - * DNodeContainerEditPart.VISUAL_ID + * see org.eclipse.sirius.diagram.internal.edit.parts. DNodeContainerEditPart.VISUAL_ID */ public static final int VISUAL_ID = 2002; /** - * Predicate to check whether a Sirius DDiagramElement represents an - * execution. + * Predicate to check whether a Sirius DDiagramElement represents an execution. */ private enum SiriusElementPredicate implements Predicate<DDiagramElement> { INSTANCE; @@ -78,11 +76,9 @@ public class InteractionUse extends AbstractFrame { } /** - * Returns a predicate to check whether a Sirius DDiagramElement - * represents an execution. + * Returns a predicate to check whether a Sirius DDiagramElement represents an execution. * - * @return a predicate to check whether a Sirius DDiagramElement - * represents an execution. + * @return a predicate to check whether a Sirius DDiagramElement represents an execution. */ public static Predicate<DDiagramElement> viewpointElementPredicate() { return SiriusElementPredicate.INSTANCE; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Lifeline.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Lifeline.java index 046ba9257e..e79b80e9bb 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Lifeline.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Lifeline.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -22,7 +22,7 @@ import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.DDiagramElement; -import org.eclipse.sirius.diagram.sequence.Messages; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.layout.LayoutConstants; import org.eclipse.sirius.diagram.sequence.business.internal.query.ISequenceEventQuery; import org.eclipse.sirius.diagram.sequence.business.internal.query.SequenceNodeQuery; @@ -30,7 +30,7 @@ import org.eclipse.sirius.diagram.sequence.business.internal.util.ParentOperandF import org.eclipse.sirius.diagram.sequence.business.internal.util.RangeSetter; import org.eclipse.sirius.diagram.sequence.business.internal.util.SubEventsHelper; import org.eclipse.sirius.diagram.sequence.description.DescriptionPackage; -import org.eclipse.sirius.diagram.sequence.util.Range; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.base.Options; @@ -53,8 +53,7 @@ public class Lifeline extends AbstractSequenceNode implements ISequenceEvent { public static final int VISUAL_ID = 3001; /** - * Predicate to check whether a Sirius DDiagramElement represents a - * lifeline. + * Predicate to check whether a Sirius DDiagramElement represents a lifeline. */ private enum SiriusElementPredicate implements Predicate<DDiagramElement> { INSTANCE; @@ -87,11 +86,9 @@ public class Lifeline extends AbstractSequenceNode implements ISequenceEvent { } /** - * Returns a predicate to check whether a Sirius DDiagramElement represents - * a lifeline. + * Returns a predicate to check whether a Sirius DDiagramElement represents a lifeline. * - * @return a predicate to check whether a Sirius DDiagramElement represents - * a lifeline. + * @return a predicate to check whether a Sirius DDiagramElement represents a lifeline. */ public static Predicate<DDiagramElement> viewpointElementPredicate() { return SiriusElementPredicate.INSTANCE; @@ -117,10 +114,9 @@ public class Lifeline extends AbstractSequenceNode implements ISequenceEvent { } /** - * Returns the0 EOL marker for this lifeline, if any. Note that the mere - * presence of an EOL does not mean this lifeline is explicitly destroyed, - * as EOLs can be used just to serve as visual hints of the end of lifelines - * and convenient resize handles. + * Returns the0 EOL marker for this lifeline, if any. Note that the mere presence of an EOL does not mean this + * lifeline is explicitly destroyed, as EOLs can be used just to serve as visual hints of the end of lifelines and + * convenient resize handles. * * @return the EOL marker for this lifeline, if any. */ @@ -210,11 +206,10 @@ public class Lifeline extends AbstractSequenceNode implements ISequenceEvent { } /** - * Tests whether the lifeline is explicitly destroyed by a destruction - * message, or if it goes until the end of the sequence. + * Tests whether the lifeline is explicitly destroyed by a destruction message, or if it goes until the end of the + * sequence. * - * @return <code>true</code> if the lifeline is explicitly destroyed by a - * destruction message. + * @return <code>true</code> if the lifeline is explicitly destroyed by a destruction message. */ public boolean isExplicitlyDestroyed() { Option<EndOfLife> optEOL = getEndOfLife(); @@ -226,11 +221,10 @@ public class Lifeline extends AbstractSequenceNode implements ISequenceEvent { } /** - * Tests whether the lifeline is explicitly created by a creation message, - * or if it starts from the beginning of the sequence. + * Tests whether the lifeline is explicitly created by a creation message, or if it starts from the beginning of the + * sequence. * - * @return <code>true</code> if the lifeline is explicitly created by a - * creation message. + * @return <code>true</code> if the lifeline is explicitly created by a creation message. */ public boolean isExplicitlyCreated() { InstanceRole opt = getInstanceRole(); diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/LostMessageEnd.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/LostMessageEnd.java index dabf515e4b..d2d5d45c23 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/LostMessageEnd.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/LostMessageEnd.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2012 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -23,7 +23,7 @@ import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.DDiagramElement; import org.eclipse.sirius.diagram.EdgeTarget; -import org.eclipse.sirius.diagram.sequence.Messages; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.base.Options; @@ -31,10 +31,10 @@ import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.base.Predicates; import com.google.common.collect.Iterables; + /** - * Represents the LostMEssageEnd marker which can appear at at the end of a - * message. This element can be present if a message do not have a starting end - * or a finishing end. + * Represents the LostMEssageEnd marker which can appear at at the end of a message. This element can be present if a + * message do not have a starting end or a finishing end. * * @author mporhel */ @@ -42,14 +42,12 @@ public class LostMessageEnd extends AbstractSequenceNode { /** * The visual ID. Same as a standard node. * - * see org.eclipse.sirius.diagram.internal.edit.parts.DNodeEditPart. - * VISUAL_ID + * see org.eclipse.sirius.diagram.internal.edit.parts.DNodeEditPart. VISUAL_ID */ public static final int VISUAL_ID = 2001; /** - * Predicate to check whether a Sirius DDiagramElement represents an Lost - * Message End. + * Predicate to check whether a Sirius DDiagramElement represents an Lost Message End. */ private enum SiriusElementPredicate implements Predicate<DDiagramElement> { INSTANCE; @@ -86,22 +84,18 @@ public class LostMessageEnd extends AbstractSequenceNode { } /** - * Returns a predicate to check whether a GMF View represents an Lost - * Message End. + * Returns a predicate to check whether a GMF View represents an Lost Message End. * - * @return a predicate to check whether a GMF View represents an Lost - * Message End. + * @return a predicate to check whether a GMF View represents an Lost Message End. */ public static Predicate<View> notationPredicate() { return new NotationPredicate(NotationPackage.eINSTANCE.getNode(), VISUAL_ID, LostMessageEnd.viewpointElementPredicate()); } /** - * Returns a predicate to check whether a Sirius DDiagramElement represents - * an EndOfLife. + * Returns a predicate to check whether a Sirius DDiagramElement represents an EndOfLife. * - * @return a predicate to check whether a Sirius DDiagramElement represents - * an EndOfLife. + * @return a predicate to check whether a Sirius DDiagramElement represents an EndOfLife. */ public static Predicate<DDiagramElement> viewpointElementPredicate() { return SiriusElementPredicate.INSTANCE; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Message.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Message.java index 55b5da145d..65a7538497 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Message.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Message.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -26,7 +26,7 @@ import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.DDiagramElement; import org.eclipse.sirius.diagram.DEdge; -import org.eclipse.sirius.diagram.sequence.Messages; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.RangeHelper; import org.eclipse.sirius.diagram.sequence.business.internal.layout.LayoutConstants; import org.eclipse.sirius.diagram.sequence.business.internal.ordering.EventEndHelper; @@ -39,7 +39,7 @@ import org.eclipse.sirius.diagram.sequence.ordering.CompoundEventEnd; import org.eclipse.sirius.diagram.sequence.ordering.EventEnd; import org.eclipse.sirius.diagram.sequence.ordering.EventEndsOrdering; import org.eclipse.sirius.diagram.sequence.ordering.SingleEventEnd; -import org.eclipse.sirius.diagram.sequence.util.Range; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.base.Options; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/NotationPredicate.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/NotationPredicate.java index 7ffff94cd1..b5416d6a7d 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/NotationPredicate.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/NotationPredicate.java @@ -12,17 +12,18 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.sequence.business.internal.elements; +import java.util.Objects; + import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.DDiagramElement; -import com.google.common.base.Preconditions; import com.google.common.base.Predicate; /** * Predicate to check whether a GMF View represents an EndOfLife. - * + * * @author pcdavid */ public class NotationPredicate implements Predicate<View> { @@ -34,7 +35,7 @@ public class NotationPredicate implements Predicate<View> { /** * Constructor. - * + * * @param viewType * the expected type of GMF View. * @param visualId @@ -43,14 +44,12 @@ public class NotationPredicate implements Predicate<View> { * the test to apply to the underlying DDiagramElement. */ public NotationPredicate(EClass viewType, int visualId, Predicate<DDiagramElement> viewpointElementPredicate) { - this.viewType = Preconditions.checkNotNull(viewType); + this.viewType = Objects.requireNonNull(viewType); this.visualId = visualId; - this.viewpointElementPredicate = Preconditions.checkNotNull(viewpointElementPredicate); + this.viewpointElementPredicate = Objects.requireNonNull(viewpointElementPredicate); } - /** - * {@inheritDoc} - */ + @Override public boolean apply(View input) { if (viewType.isInstance(input) && viewHasType(input, visualId)) { EObject element = input.getElement(); diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/ObservationPoint.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/ObservationPoint.java index e39380f289..00aadc86d8 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/ObservationPoint.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/ObservationPoint.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2012, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -20,9 +20,9 @@ import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.DDiagramElement; -import org.eclipse.sirius.diagram.sequence.Messages; import org.eclipse.sirius.diagram.sequence.description.DescriptionPackage; import org.eclipse.sirius.diagram.sequence.ordering.EventEnd; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.base.Options; @@ -30,8 +30,7 @@ import com.google.common.base.Preconditions; import com.google.common.base.Predicate; /** - * Represents the ObservationPoint marker which can appear to represent a - * EventEnd location. + * Represents the ObservationPoint marker which can appear to represent a EventEnd location. * * @author mporhel */ @@ -39,14 +38,12 @@ public class ObservationPoint extends AbstractSequenceNode { /** * The visual ID. Same as a standard node. * - * see org.eclipse.sirius.diagram.internal.edit.parts.DNodeEditPart. - * VISUAL_ID + * see org.eclipse.sirius.diagram.internal.edit.parts.DNodeEditPart. VISUAL_ID */ public static final int VISUAL_ID = 2001; /** - * Predicate to check whether a Sirius DDiagramElement represents an - * ObservationPoint. + * Predicate to check whether a Sirius DDiagramElement represents an ObservationPoint. */ private enum SiriusElementPredicate implements Predicate<DDiagramElement> { INSTANCE; @@ -69,22 +66,18 @@ public class ObservationPoint extends AbstractSequenceNode { } /** - * Returns a predicate to check whether a GMF View represents an - * ObservationPoint. + * Returns a predicate to check whether a GMF View represents an ObservationPoint. * - * @return a predicate to check whether a GMF View represents an - * ObservationPoint. + * @return a predicate to check whether a GMF View represents an ObservationPoint. */ public static Predicate<View> notationPredicate() { return new NotationPredicate(NotationPackage.eINSTANCE.getNode(), VISUAL_ID, ObservationPoint.viewpointElementPredicate()); } /** - * Returns a predicate to check whether a Sirius DDiagramElement - * represents an ObservationPoint. + * Returns a predicate to check whether a Sirius DDiagramElement represents an ObservationPoint. * - * @return a predicate to check whether a Sirius DDiagramElement - * represents an ObservationPoint. + * @return a predicate to check whether a Sirius DDiagramElement represents an ObservationPoint. */ public static Predicate<DDiagramElement> viewpointElementPredicate() { return SiriusElementPredicate.INSTANCE; @@ -106,9 +99,8 @@ public class ObservationPoint extends AbstractSequenceNode { } /** - * Look in its diagram'semantic ordering for the observed eventEnd: and - * event end whose semantic end is the observation point semantic target - * element. + * Look in its diagram'semantic ordering for the observed eventEnd: and event end whose semantic end is the + * observation point semantic target element. * * @return the observed EventEnd if valid. */ @@ -125,8 +117,7 @@ public class ObservationPoint extends AbstractSequenceNode { } /** - * Get the observed logical location (ie: it corresponds to the center of - * the logical bounds). + * Get the observed logical location (ie: it corresponds to the center of the logical bounds). * * @return the observed logical location. */ diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Operand.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Operand.java index 814b32299b..136394c0f1 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Operand.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Operand.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2022 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -22,8 +22,9 @@ import org.eclipse.gmf.runtime.notation.Bounds; import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.sirius.common.tools.api.query.IllegalStateExceptionQuery; import org.eclipse.sirius.diagram.DDiagramElement; -import org.eclipse.sirius.diagram.sequence.Messages; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.layout.LayoutConstants; import org.eclipse.sirius.diagram.sequence.business.internal.ordering.EventEndHelper; import org.eclipse.sirius.diagram.sequence.business.internal.query.ISequenceEventQuery; @@ -33,7 +34,7 @@ import org.eclipse.sirius.diagram.sequence.business.internal.util.RangeSetter; import org.eclipse.sirius.diagram.sequence.business.internal.util.SubEventsHelper; import org.eclipse.sirius.diagram.sequence.description.DescriptionPackage; import org.eclipse.sirius.diagram.sequence.ordering.EventEnd; -import org.eclipse.sirius.diagram.sequence.util.Range; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.base.Options; @@ -179,7 +180,17 @@ public class Operand extends AbstractSequenceNode implements ISequenceEvent { combinedFragment = CacheHelper.getOperandToCombinedFragmentCache().get(this); } if (combinedFragment == null) { - EObject viewContainer = this.view.eContainer(); + EObject viewContainer = null; + try { + viewContainer = this.view.eContainer(); + } catch (IllegalStateException e) { + if (new IllegalStateExceptionQuery(e).isAConnectionLostException()) { + // Nothing to log here, this can happen if the resource is not accessible anymore (distant + // resource). + } else { + throw e; + } + } if (viewContainer instanceof View) { View parentView = (View) viewContainer; Option<CombinedFragment> parentElement = ISequenceElementAccessor.getCombinedFragment(parentView); diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/SequenceDiagram.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/SequenceDiagram.java index 49490b911c..b806374c1a 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/SequenceDiagram.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/SequenceDiagram.java @@ -28,12 +28,12 @@ import org.eclipse.gmf.runtime.notation.Edge; import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.DDiagram; -import org.eclipse.sirius.diagram.sequence.Messages; import org.eclipse.sirius.diagram.sequence.SequenceDDiagram; import org.eclipse.sirius.diagram.sequence.business.internal.RangeHelper; import org.eclipse.sirius.diagram.sequence.business.internal.ordering.EventEndHelper; import org.eclipse.sirius.diagram.sequence.description.DescriptionPackage; import org.eclipse.sirius.diagram.sequence.ordering.EventEnd; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.base.Options; import org.eclipse.sirius.ext.emf.AllContents; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/State.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/State.java index a42561c9ff..a6c950e162 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/State.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/State.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -20,11 +20,11 @@ import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.DDiagramElement; -import org.eclipse.sirius.diagram.sequence.Messages; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.ordering.EventEndHelper; import org.eclipse.sirius.diagram.sequence.description.DescriptionPackage; import org.eclipse.sirius.diagram.sequence.ordering.EventEnd; -import org.eclipse.sirius.diagram.sequence.util.Range; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import com.google.common.base.Preconditions; import com.google.common.base.Predicate; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/package-info.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/package-info.java deleted file mode 100644 index 332b554297..0000000000 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/package-info.java +++ /dev/null @@ -1,14 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 THALES GLOBAL SERVICES. - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.diagram.sequence.business.internal.elements; - diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/layout/EventEndToPositionFunction.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/layout/EventEndToPositionFunction.java index 3beb031db6..5eb8c97f47 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/layout/EventEndToPositionFunction.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/layout/EventEndToPositionFunction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -16,6 +16,7 @@ import java.util.Collection; import java.util.Iterator; import org.eclipse.sirius.diagram.DDiagramElement; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractFrame; import org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractNodeEvent; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceEvent; @@ -25,7 +26,6 @@ import org.eclipse.sirius.diagram.sequence.business.internal.query.ISequenceElem import org.eclipse.sirius.diagram.sequence.ordering.CompoundEventEnd; import org.eclipse.sirius.diagram.sequence.ordering.EventEnd; import org.eclipse.sirius.diagram.sequence.ordering.SingleEventEnd; -import org.eclipse.sirius.diagram.sequence.util.Range; import org.eclipse.sirius.ext.base.Option; import com.google.common.base.Function; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/layout/horizontal/LostMessageEndHorizontalLayoutHelper.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/layout/horizontal/LostMessageEndHorizontalLayoutHelper.java index 69b39335e6..9048d032e7 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/layout/horizontal/LostMessageEndHorizontalLayoutHelper.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/layout/horizontal/LostMessageEndHorizontalLayoutHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -23,6 +23,7 @@ import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.emf.ecore.EObject; import org.eclipse.sirius.diagram.DEdge; import org.eclipse.sirius.diagram.EdgeTarget; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceEvent; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceNode; import org.eclipse.sirius.diagram.sequence.business.internal.elements.InstanceRole; @@ -34,7 +35,6 @@ import org.eclipse.sirius.diagram.sequence.business.internal.elements.Operand; import org.eclipse.sirius.diagram.sequence.business.internal.elements.SequenceDiagram; import org.eclipse.sirius.diagram.sequence.business.internal.layout.AbstractSequenceLayout; import org.eclipse.sirius.diagram.sequence.business.internal.layout.LayoutConstants; -import org.eclipse.sirius.diagram.sequence.util.Range; import org.eclipse.sirius.ext.base.Option; import com.google.common.base.Predicate; @@ -428,7 +428,7 @@ public class LostMessageEndHorizontalLayoutHelper { int deltaWithLifeline = lostEndsDelta.get(lostSource); Rectangle bounds = lostSource.getProperLogicalBounds().getCopy(); - bounds.x = newLifelineX + deltaWithLifeline; + bounds.setX(newLifelineX + deltaWithLifeline); lostMessageEndMoves.put(lostSource, bounds); } } diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/layout/horizontal/SequenceHorizontalLayout.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/layout/horizontal/SequenceHorizontalLayout.java index a358d8cdc4..6d9880685b 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/layout/horizontal/SequenceHorizontalLayout.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/layout/horizontal/SequenceHorizontalLayout.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -32,6 +32,7 @@ import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.RelativeBendpoints; import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint; import org.eclipse.sirius.diagram.sequence.SequenceDDiagram; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractFrame; import org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractNodeEvent; import org.eclipse.sirius.diagram.sequence.business.internal.elements.CombinedFragment; @@ -46,7 +47,6 @@ import org.eclipse.sirius.diagram.sequence.business.internal.elements.SequenceDi import org.eclipse.sirius.diagram.sequence.business.internal.layout.AbstractSequenceOrderingLayout; import org.eclipse.sirius.diagram.sequence.business.internal.layout.LayoutConstants; import org.eclipse.sirius.diagram.sequence.business.internal.query.ISequenceElementQuery; -import org.eclipse.sirius.diagram.sequence.util.Range; import org.eclipse.sirius.ext.base.Option; import com.google.common.base.Function; @@ -361,7 +361,7 @@ public class SequenceHorizontalLayout extends AbstractSequenceOrderingLayout<ISe Range verticalRange = frame.getVerticalRange(); int irWidth = getInstanceRoleBounds(rightLifeline.getInstanceRole(), irMoves).width; int lifelineRightGap = getLifelineRightGap(rightLifeline, verticalRange, irWidth, lostEndsDelta); - newBounds.width += Math.max(lifelineRightGap, frameDepthGap); + newBounds.setWidth(newBounds.width + Math.max(lifelineRightGap, frameDepthGap)); } if (leftLifeline != null) { @@ -370,8 +370,8 @@ public class SequenceHorizontalLayout extends AbstractSequenceOrderingLayout<ISe int lifelineLeftGap = getLifelineLeftGap(rightLifeline, verticalRange, irWidth, lostEndsDelta); lifelineLeftGap = Math.max(lifelineLeftGap, frameDepthGap); - newBounds.x -= lifelineLeftGap; - newBounds.width += lifelineLeftGap; + newBounds.setX(newBounds.x - lifelineLeftGap); + newBounds.setWidth(newBounds.width + lifelineLeftGap); } frameMoves.put(frame, newBounds); @@ -431,13 +431,13 @@ public class SequenceHorizontalLayout extends AbstractSequenceOrderingLayout<ISe Rectangle newBounds = oldBounds.getCopy(); if (pack) { - newBounds.x = newMinX; + newBounds.setX(newMinX); } else { // shift the current instancerole to the right ? // don't reduce previous delta with known/flagged predecessor int deltaStablePosition = getDeltaStablePosition(newMinX, instanceRole, Maps.transformValues(computedMoves, RECT_TO_X)); - newBounds.x = Math.max(newMinX, Math.max(newBounds.x, deltaStablePosition)); + newBounds.setX(Math.max(newMinX, Math.max(newBounds.x, deltaStablePosition))); } // Store computed move @@ -462,7 +462,7 @@ public class SequenceHorizontalLayout extends AbstractSequenceOrderingLayout<ISe final Map<Message, Rectangle> computedMoves = new HashMap<Message, Rectangle>(); for (Entry<Message, Integer> msg : reflexiveMessagesToLayout.entrySet()) { Rectangle properLogicalBounds = msg.getKey().getProperLogicalBounds(); - properLogicalBounds.width = msg.getValue(); + properLogicalBounds.setWidth(msg.getValue()); computedMoves.put(msg.getKey(), properLogicalBounds); } return computedMoves; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/layout/vertical/SequenceVerticalLayout.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/layout/vertical/SequenceVerticalLayout.java index 9d2c7536c6..b5b26158de 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/layout/vertical/SequenceVerticalLayout.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/layout/vertical/SequenceVerticalLayout.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -31,6 +31,7 @@ import org.eclipse.gmf.runtime.notation.Size; import org.eclipse.sirius.diagram.DDiagramElement; import org.eclipse.sirius.diagram.DNode; import org.eclipse.sirius.diagram.sequence.SequenceDDiagram; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.RangeHelper; import org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractNodeEvent; import org.eclipse.sirius.diagram.sequence.business.internal.elements.CombinedFragment; @@ -57,7 +58,6 @@ import org.eclipse.sirius.diagram.sequence.business.internal.query.SequenceMessa import org.eclipse.sirius.diagram.sequence.ordering.CompoundEventEnd; import org.eclipse.sirius.diagram.sequence.ordering.EventEnd; import org.eclipse.sirius.diagram.sequence.ordering.SingleEventEnd; -import org.eclipse.sirius.diagram.sequence.util.Range; import org.eclipse.sirius.diagram.ui.business.internal.query.DNodeQuery; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.base.Options; @@ -1002,7 +1002,7 @@ public class SequenceVerticalLayout extends AbstractSequenceOrderingLayout<ISequ } else { if (flaggedAbsoluteBounds.height == -1) { // Correct auto-size - flaggedAbsoluteBounds.height = 0; + flaggedAbsoluteBounds.setHeight(0); } oldFlaggedLayoutData.put(ise, flaggedAbsoluteBounds); flagged = true; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/SequenceDDiagramSpec.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/SequenceDDiagramSpec.java deleted file mode 100644 index 7a9ab00258..0000000000 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/SequenceDDiagramSpec.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES and others. - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.diagram.sequence.business.internal.metamodel; - -import java.util.Collection; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.util.EcoreEList; -import org.eclipse.sirius.business.internal.query.DModelElementInternalQuery; -import org.eclipse.sirius.diagram.DDiagramElement; -import org.eclipse.sirius.diagram.DDiagramElementContainer; -import org.eclipse.sirius.diagram.DEdge; -import org.eclipse.sirius.diagram.DNode; -import org.eclipse.sirius.diagram.DNodeListElement; -import org.eclipse.sirius.diagram.DiagramPackage; -import org.eclipse.sirius.diagram.business.internal.query.DDiagramInternalQuery; -import org.eclipse.sirius.diagram.description.DragAndDropTargetDescription; -import org.eclipse.sirius.diagram.description.filter.FilterDescription; -import org.eclipse.sirius.diagram.sequence.impl.SequenceDDiagramImpl; -import org.eclipse.sirius.viewpoint.DRepresentationElement; -import org.eclipse.sirius.viewpoint.ViewpointPackage; -import org.eclipse.sirius.viewpoint.description.DAnnotation; - -/** - * Implementation of <code>SequenceDDiagram</code>. - * - * @author pcdavid - */ -public class SequenceDDiagramSpec extends SequenceDDiagramImpl { - - @Override - public EList<DRepresentationElement> getOwnedRepresentationElements() { - final Collection<DDiagramElement> result = getOwnedDiagramElements(); - return new EcoreEList.UnmodifiableEList<DRepresentationElement>(eInternalContainer(), ViewpointPackage.eINSTANCE.getDRepresentation_OwnedRepresentationElements(), result.size(), - result.toArray()); - } - - @Override - public EList<DRepresentationElement> getRepresentationElements() { - final Collection<DDiagramElement> result = getDiagramElements(); - return new EcoreEList.UnmodifiableEList<DRepresentationElement>(eInternalContainer(), ViewpointPackage.eINSTANCE.getDRepresentation_RepresentationElements(), result.size(), result.toArray()); - } - - @Override - public EList<DDiagramElement> getDiagramElements() { - final Collection<DDiagramElement> result = new DDiagramInternalQuery(this).getDiagramElements(); - return new EcoreEList.UnmodifiableEList<DDiagramElement>(eInternalContainer(), DiagramPackage.eINSTANCE.getDDiagram_DiagramElements(), result.size(), result.toArray()); - } - - @Override - public DAnnotation getDAnnotation(String source) { - return new DModelElementInternalQuery(this).getDAnnotation(source); - } - - /* - * Behavior inherited from DDiagramSpec - */ - - @Override - public EList<DEdge> getEdges() { - final Collection<DEdge> result = new DDiagramInternalQuery(this).getEdges(); - return new EcoreEList.UnmodifiableEList<DEdge>(eInternalContainer(), DiagramPackage.eINSTANCE.getDDiagram_Edges(), result.size(), result.toArray()); - } - - @Override - public EList<DNode> getNodes() { - final Collection<DNode> result = new DDiagramInternalQuery(this).getNodes(); - return new EcoreEList.UnmodifiableEList<DNode>(eInternalContainer(), DiagramPackage.eINSTANCE.getDDiagram_Nodes(), result.size(), result.toArray()); - } - - @Override - public EList<DNodeListElement> getNodeListElements() { - final Collection<DNodeListElement> result = new DDiagramInternalQuery(this).getNodeListElements(); - return new EcoreEList.UnmodifiableEList<DNodeListElement>(eInternalContainer(), DiagramPackage.eINSTANCE.getDDiagram_NodeListElements(), result.size(), result.toArray()); - } - - @Override - public EList<DDiagramElementContainer> getContainers() { - final Collection<DDiagramElementContainer> result = new DDiagramInternalQuery(this).getContainers(); - return new EcoreEList.UnmodifiableEList<DDiagramElementContainer>(eInternalContainer(), DiagramPackage.eINSTANCE.getDDiagram_Containers(), result.size(), result.toArray()); - - } - - @Override - public EList<FilterDescription> getAllFilters() { - final Collection<FilterDescription> result = new DDiagramInternalQuery(this).getAllFilters(); - return new EcoreEList.UnmodifiableEList<FilterDescription>(eInternalContainer(), DiagramPackage.eINSTANCE.getDDiagram_AllFilters(), result.size(), result.toArray()); - } - - @Override - public DragAndDropTargetDescription getDragAndDropDescription() { - return new DDiagramInternalQuery(this).getDragAndDropDescription(); - } -} diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/CombinedFragmentMappingSpec.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/CombinedFragmentMappingSpec.java deleted file mode 100644 index 0fa385b7e5..0000000000 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/CombinedFragmentMappingSpec.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES. - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.diagram.sequence.business.internal.metamodel.description; - -import java.util.HashMap; -import java.util.Map; -import java.util.WeakHashMap; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.sirius.common.tools.api.util.EObjectCouple; -import org.eclipse.sirius.diagram.DDiagramElement; -import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.IContainerMappingExt; -import org.eclipse.sirius.diagram.business.internal.metamodel.helper.ContainerMappingWithInterpreterHelper; -import org.eclipse.sirius.diagram.sequence.description.impl.CombinedFragmentMappingImpl; -import org.eclipse.sirius.viewpoint.DSemanticDecorator; - -/** - * Implementation of CombinedFragmentMapping. - * - * @author pcdavid - */ -public class CombinedFragmentMappingSpec extends CombinedFragmentMappingImpl implements IContainerMappingExt { - - private final Map<EObject, EList<DSemanticDecorator>> viewContainerDone = new HashMap<EObject, EList<DSemanticDecorator>>(); - - private final Map<EObjectCouple, EList<EObject>> candidatesCache = new WeakHashMap<EObjectCouple, EList<EObject>>(); - - @Override - public Map<EObject, EList<DSemanticDecorator>> getViewContainerDone() { - return viewContainerDone; - } - - @Override - public Map<EObjectCouple, EList<EObject>> getCandidatesCache() { - return candidatesCache; - } - - - @Override - public EList<DDiagramElement> findDNodeFromEObject(final EObject object) { - return ContainerMappingWithInterpreterHelper.findDNodeFromEObject(this, object); - } - - @Override - public String toString() { - return new StringBuffer(getClass().getName()).append(" ").append(getName()).toString(); //$NON-NLS-1$ - } -} diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/EndOfLifeMappingSpec.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/EndOfLifeMappingSpec.java deleted file mode 100644 index 5942b9bff2..0000000000 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/EndOfLifeMappingSpec.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES. - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.diagram.sequence.business.internal.metamodel.description; - -import java.util.HashMap; -import java.util.Map; -import java.util.WeakHashMap; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.sirius.common.tools.api.util.EObjectCouple; -import org.eclipse.sirius.diagram.DDiagramElement; -import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.INodeMappingExt; -import org.eclipse.sirius.diagram.business.internal.metamodel.helper.NodeMappingHelper; -import org.eclipse.sirius.diagram.sequence.description.impl.EndOfLifeMappingImpl; -import org.eclipse.sirius.viewpoint.DSemanticDecorator; - -/** - * Implementation of <code>EndOfLifeMapping</code>. - * - * @author pcdavid - */ -public class EndOfLifeMappingSpec extends EndOfLifeMappingImpl implements INodeMappingExt { - - private final Map<EObject, EList<DSemanticDecorator>> viewNodesDone = new HashMap<EObject, EList<DSemanticDecorator>>(); - - private final Map<EObjectCouple, EList<EObject>> candidatesCache = new WeakHashMap<EObjectCouple, EList<EObject>>(); - - @Override - public Map<EObject, EList<DSemanticDecorator>> getViewNodesDone() { - return viewNodesDone; - } - - @Override - public Map<EObjectCouple, EList<EObject>> getCandidatesCache() { - return candidatesCache; - } - - @Override - public EList<DDiagramElement> findDNodeFromEObject(final EObject object) { - return NodeMappingHelper.findDNodeFromEObject(this, object); - } - - - @Override - public String toString() { - return new StringBuffer(getClass().getName()).append(" ").append(getName()).toString(); //$NON-NLS-1$ - } - - -} diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/ExecutionMappingSpec.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/ExecutionMappingSpec.java deleted file mode 100644 index f494af29d4..0000000000 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/ExecutionMappingSpec.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES. - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.diagram.sequence.business.internal.metamodel.description; - -import java.util.HashMap; -import java.util.Map; -import java.util.WeakHashMap; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.sirius.common.tools.api.util.EObjectCouple; -import org.eclipse.sirius.diagram.DDiagramElement; -import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.INodeMappingExt; -import org.eclipse.sirius.diagram.business.internal.metamodel.helper.NodeMappingHelper; -import org.eclipse.sirius.diagram.sequence.description.impl.ExecutionMappingImpl; -import org.eclipse.sirius.viewpoint.DSemanticDecorator; - -/** - * Implementation of <code>ExecutionMapping</code>. - * - * @author pcdavid - */ -public class ExecutionMappingSpec extends ExecutionMappingImpl implements INodeMappingExt { - - private final Map<EObject, EList<DSemanticDecorator>> viewNodesDone = new HashMap<EObject, EList<DSemanticDecorator>>(); - - private final Map<EObjectCouple, EList<EObject>> candidatesCache = new WeakHashMap<EObjectCouple, EList<EObject>>(); - - @Override - public Map<EObject, EList<DSemanticDecorator>> getViewNodesDone() { - return viewNodesDone; - } - - @Override - public Map<EObjectCouple, EList<EObject>> getCandidatesCache() { - return candidatesCache; - } - - - @Override - public EList<DDiagramElement> findDNodeFromEObject(final EObject object) { - return NodeMappingHelper.findDNodeFromEObject(this, object); - } - - - @Override - public String toString() { - return new StringBuffer(getClass().getName()).append(" ").append(getName()).toString(); //$NON-NLS-1$ - } - - -} diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/InstanceRoleMappingSpec.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/InstanceRoleMappingSpec.java deleted file mode 100644 index ce879b673c..0000000000 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/InstanceRoleMappingSpec.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES. - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.diagram.sequence.business.internal.metamodel.description; - -import java.util.HashMap; -import java.util.Map; -import java.util.WeakHashMap; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.sirius.common.tools.api.util.EObjectCouple; -import org.eclipse.sirius.diagram.DDiagramElement; -import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.INodeMappingExt; -import org.eclipse.sirius.diagram.business.internal.metamodel.helper.NodeMappingHelper; -import org.eclipse.sirius.diagram.sequence.description.impl.InstanceRoleMappingImpl; -import org.eclipse.sirius.viewpoint.DSemanticDecorator; - -/** - * Implementation of <code>InstanceRoleMapping</code>. - * - * @author pcdavid - */ -public class InstanceRoleMappingSpec extends InstanceRoleMappingImpl implements INodeMappingExt { - - private final Map<EObject, EList<DSemanticDecorator>> viewNodesDone = new HashMap<EObject, EList<DSemanticDecorator>>(); - - private final Map<EObjectCouple, EList<EObject>> candidatesCache = new WeakHashMap<EObjectCouple, EList<EObject>>(); - - @Override - public Map<EObject, EList<DSemanticDecorator>> getViewNodesDone() { - return viewNodesDone; - } - - @Override - public Map<EObjectCouple, EList<EObject>> getCandidatesCache() { - return candidatesCache; - } - - - @Override - public EList<DDiagramElement> findDNodeFromEObject(final EObject object) { - return NodeMappingHelper.findDNodeFromEObject(this, object); - } - - @Override - public String toString() { - return new StringBuffer(getClass().getName()).append(" ").append(getName()).toString(); //$NON-NLS-1$ - } - -} diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/InteractionUseMappingSpec.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/InteractionUseMappingSpec.java deleted file mode 100644 index c8eb692f67..0000000000 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/InteractionUseMappingSpec.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES. - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.diagram.sequence.business.internal.metamodel.description; - -import java.util.HashMap; -import java.util.Map; -import java.util.WeakHashMap; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.sirius.common.tools.api.util.EObjectCouple; -import org.eclipse.sirius.diagram.DDiagramElement; -import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.IContainerMappingExt; -import org.eclipse.sirius.diagram.business.internal.metamodel.helper.ContainerMappingWithInterpreterHelper; -import org.eclipse.sirius.diagram.sequence.description.impl.InteractionUseMappingImpl; -import org.eclipse.sirius.viewpoint.DSemanticDecorator; - -/** - * Implementation of InteractionUseMapping. - * - * @author pcdavid - */ -public class InteractionUseMappingSpec extends InteractionUseMappingImpl implements IContainerMappingExt { - - private final Map<EObject, EList<DSemanticDecorator>> viewContainerDone = new HashMap<EObject, EList<DSemanticDecorator>>(); - - private final Map<EObjectCouple, EList<EObject>> candidatesCache = new WeakHashMap<EObjectCouple, EList<EObject>>(); - - @Override - public Map<EObject, EList<DSemanticDecorator>> getViewContainerDone() { - return viewContainerDone; - } - - @Override - public Map<EObjectCouple, EList<EObject>> getCandidatesCache() { - return candidatesCache; - } - - - @Override - public EList<DDiagramElement> findDNodeFromEObject(final EObject object) { - return ContainerMappingWithInterpreterHelper.findDNodeFromEObject(this, object); - } - - - @Override - public String toString() { - return new StringBuffer(getClass().getName()).append(" ").append(getName()).toString(); //$NON-NLS-1$ - } -} diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/ObservationPointMappingSpec.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/ObservationPointMappingSpec.java deleted file mode 100644 index a2d1087778..0000000000 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/ObservationPointMappingSpec.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2018 THALES GLOBAL SERVICES. - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.diagram.sequence.business.internal.metamodel.description; - -import java.util.HashMap; -import java.util.Map; -import java.util.WeakHashMap; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.sirius.common.tools.api.util.EObjectCouple; -import org.eclipse.sirius.diagram.DDiagramElement; -import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.INodeMappingExt; -import org.eclipse.sirius.diagram.business.internal.metamodel.helper.NodeMappingHelper; -import org.eclipse.sirius.diagram.sequence.description.impl.ObservationPointMappingImpl; -import org.eclipse.sirius.viewpoint.DSemanticDecorator; - -/** - * Implementation of <code>ObservationPointMapping</code>. - * - * @author mporhel - */ -public class ObservationPointMappingSpec extends ObservationPointMappingImpl implements INodeMappingExt { - - private final Map<EObject, EList<DSemanticDecorator>> viewNodesDone = new HashMap<EObject, EList<DSemanticDecorator>>(); - - private final Map<EObjectCouple, EList<EObject>> candidatesCache = new WeakHashMap<EObjectCouple, EList<EObject>>(); - - @Override - public Map<EObject, EList<DSemanticDecorator>> getViewNodesDone() { - return viewNodesDone; - } - - @Override - public Map<EObjectCouple, EList<EObject>> getCandidatesCache() { - return candidatesCache; - } - - @Override - public EList<DDiagramElement> findDNodeFromEObject(final EObject object) { - return NodeMappingHelper.findDNodeFromEObject(this, object); - } - - - @Override - public String toString() { - return new StringBuffer(getClass().getName()).append(" ").append(getName()).toString(); //$NON-NLS-1$ - } - - -} diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/OperandMappingSpec.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/OperandMappingSpec.java deleted file mode 100644 index 9227f6deb8..0000000000 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/OperandMappingSpec.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES. - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.diagram.sequence.business.internal.metamodel.description; - -import java.util.HashMap; -import java.util.Map; -import java.util.WeakHashMap; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.sirius.common.tools.api.util.EObjectCouple; -import org.eclipse.sirius.diagram.DDiagramElement; -import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.IContainerMappingExt; -import org.eclipse.sirius.diagram.business.internal.metamodel.helper.ContainerMappingWithInterpreterHelper; -import org.eclipse.sirius.diagram.sequence.description.impl.OperandMappingImpl; -import org.eclipse.sirius.viewpoint.DSemanticDecorator; - -/** - * Implementation of OperandMapping. - * - * @author pcdavid - */ -public class OperandMappingSpec extends OperandMappingImpl implements IContainerMappingExt { - - private final Map<EObject, EList<DSemanticDecorator>> viewContainerDone = new HashMap<EObject, EList<DSemanticDecorator>>(); - - private final Map<EObjectCouple, EList<EObject>> candidatesCache = new WeakHashMap<EObjectCouple, EList<EObject>>(); - - @Override - public Map<EObject, EList<DSemanticDecorator>> getViewContainerDone() { - return viewContainerDone; - } - - @Override - public Map<EObjectCouple, EList<EObject>> getCandidatesCache() { - return candidatesCache; - } - - - @Override - public EList<DDiagramElement> findDNodeFromEObject(final EObject object) { - return ContainerMappingWithInterpreterHelper.findDNodeFromEObject(this, object); - } - - - @Override - public String toString() { - return new StringBuffer(getClass().getName()).append(" ").append(getName()).toString(); //$NON-NLS-1$ - } - -} diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/SequenceDiagramDescriptionSpec.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/SequenceDiagramDescriptionSpec.java deleted file mode 100644 index 2cdfc9d610..0000000000 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/SequenceDiagramDescriptionSpec.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 THALES GLOBAL SERVICES. - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.diagram.sequence.business.internal.metamodel.description; - -import java.util.Set; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.util.EcoreEList; -import org.eclipse.sirius.diagram.DSemanticDiagram; -import org.eclipse.sirius.diagram.business.internal.metamodel.helper.ContentHelper; -import org.eclipse.sirius.diagram.business.internal.metamodel.helper.DiagramDescriptionHelper; -import org.eclipse.sirius.diagram.description.EdgeMapping; -import org.eclipse.sirius.diagram.sequence.SequenceFactory; -import org.eclipse.sirius.diagram.sequence.description.impl.SequenceDiagramDescriptionImpl; -import org.eclipse.sirius.viewpoint.description.tool.AbstractToolDescription; - -/** - * Specialized version of <code>SequenceDiagramDescriptionImpl</code>. - * - * @author pcdavid - */ -public class SequenceDiagramDescriptionSpec extends SequenceDiagramDescriptionImpl { - /** - * {@inheritDoc} - * - * SequenceDiagramDescription produce <code>SequenceDDiagram</code>s at - * runtime. - */ - @Override - public DSemanticDiagram createDiagram() { - return SequenceFactory.eINSTANCE.createSequenceDDiagram(); - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.viewpoint.description.impl.DiagramDescriptionImpl#getAllTools() - */ - @Override - public EList<AbstractToolDescription> getAllTools() { - final Set<AbstractToolDescription> result = DiagramDescriptionHelper.getAllTools(this); - return new EcoreEList.UnmodifiableEList<AbstractToolDescription>(eInternalContainer(), org.eclipse.sirius.diagram.description.DescriptionPackage.eINSTANCE.getDiagramDescription_AllTools(), - result.size(), result.toArray()); - } - - - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.viewpoint.description.impl.DiagramDescriptionImpl#getAllEdgeMappings() - */ - @Override - public EList<EdgeMapping> getAllEdgeMappings() { - return ContentHelper.getAllEdgeMappings(this, false); - } - -} diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/StateMappingSpec.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/StateMappingSpec.java deleted file mode 100644 index 064ac83352..0000000000 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/StateMappingSpec.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES. - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.diagram.sequence.business.internal.metamodel.description; - -import java.util.HashMap; -import java.util.Map; -import java.util.WeakHashMap; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.sirius.common.tools.api.util.EObjectCouple; -import org.eclipse.sirius.diagram.DDiagramElement; -import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.INodeMappingExt; -import org.eclipse.sirius.diagram.business.internal.metamodel.helper.NodeMappingHelper; -import org.eclipse.sirius.diagram.sequence.description.impl.StateMappingImpl; -import org.eclipse.sirius.viewpoint.DSemanticDecorator; - -/** - * Implementation of <code>StateMapping</code>. - * - * @author smonnier - */ -public class StateMappingSpec extends StateMappingImpl implements INodeMappingExt { - - private final Map<EObject, EList<DSemanticDecorator>> viewNodesDone = new HashMap<EObject, EList<DSemanticDecorator>>(); - - private final Map<EObjectCouple, EList<EObject>> candidatesCache = new WeakHashMap<EObjectCouple, EList<EObject>>(); - - @Override - public Map<EObject, EList<DSemanticDecorator>> getViewNodesDone() { - return viewNodesDone; - } - - @Override - public Map<EObjectCouple, EList<EObject>> getCandidatesCache() { - return candidatesCache; - } - - @Override - public EList<DDiagramElement> findDNodeFromEObject(final EObject object) { - return NodeMappingHelper.findDNodeFromEObject(this, object); - } - - - @Override - public String toString() { - return new StringBuffer(getClass().getName()).append(" ").append(getName()).toString(); //$NON-NLS-1$ - } - -} diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/ordering/CompoundEventEndSpec.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/ordering/CompoundEventEndSpec.java deleted file mode 100644 index bb3b9cb573..0000000000 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/ordering/CompoundEventEndSpec.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 THALES GLOBAL SERVICES. - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.diagram.sequence.business.internal.metamodel.ordering; - -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.sirius.diagram.sequence.ordering.CompoundEventEnd; -import org.eclipse.sirius.diagram.sequence.ordering.SingleEventEnd; -import org.eclipse.sirius.diagram.sequence.ordering.impl.CompoundEventEndImpl; - -/** - * Implementation of <code>CompoundEventEnd</code>. - * - * @author mporhel - */ -public class CompoundEventEndSpec extends CompoundEventEndImpl { - - /** - * {@inheritDoc} - */ - @Override - public EList<EObject> getSemanticEvents() { - EList<EObject> result = new BasicEList<EObject>(); - Set<EObject> semantics = new HashSet<>(); - for (SingleEventEnd see : getEventEnds()) { - semantics.add(see.getSemanticEvent()); - } - result.addAll(semantics); - return result; - } - - /** - * {@inheritDoc} - * - * @not-generated - */ - @Override - public boolean equals(Object obj) { - boolean areEquals = false; - if (this == obj) { - areEquals = true; - } else if (obj instanceof CompoundEventEnd) { - CompoundEventEnd that = (CompoundEventEnd) obj; - areEquals = this.getSemanticEnd().equals(that.getSemanticEnd()) && this.getEventEnds().size() == that.getEventEnds().size() - && this.getSemanticEvents().containsAll(that.getSemanticEvents()); - } - return areEquals; - } - - /** - * {@inheritDoc} - * - * @not-generated - */ - @Override - public int hashCode() { - int subHash = 1; - for (EObject obj : this.getSemanticEvents()) { - subHash *= obj.hashCode(); - } - return 31 * this.getSemanticEnd().hashCode() * subHash; - } - -} diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/ordering/SingleEventEndSpec.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/ordering/SingleEventEndSpec.java deleted file mode 100644 index 55e2525c2d..0000000000 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/ordering/SingleEventEndSpec.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 THALES GLOBAL SERVICES. - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.diagram.sequence.business.internal.metamodel.ordering; - -import org.eclipse.sirius.diagram.sequence.ordering.SingleEventEnd; -import org.eclipse.sirius.diagram.sequence.ordering.impl.SingleEventEndImpl; - -/** - * Customization of the default {@link SingleEventEndImpl} implementation. - * - * @author <a href="mailto:alex.lagarde@obeo.fr">Alex Lagarde</a> - * - */ -public class SingleEventEndSpec extends SingleEventEndImpl { - - /** - * {@inheritDoc} - * - * @not-generated - */ - @Override - public boolean equals(Object obj) { - boolean equals = false; - if (this == obj) { - equals = true; - } else if (obj instanceof SingleEventEnd) { - SingleEventEnd that = (SingleEventEnd) obj; - equals = this.start == that.isStart() && this.getSemanticEnd().equals(that.getSemanticEnd()) && this.getSemanticEvent().equals(that.getSemanticEvent()); - } - return equals; - } - - /** - * {@inheritDoc} - * - * @not-generated - */ - @Override - public int hashCode() { - return 17 * this.getSemanticEnd().hashCode() * this.getSemanticEvent().hashCode(); - } -} diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/EndOfLifeMoveOperation.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/EndOfLifeMoveOperation.java index d609b12020..723991e090 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/EndOfLifeMoveOperation.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/EndOfLifeMoveOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -12,17 +12,16 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.sequence.business.internal.operation; -import org.eclipse.sirius.diagram.sequence.Messages; +import java.util.Objects; + +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.RangeHelper; import org.eclipse.sirius.diagram.sequence.business.internal.elements.Lifeline; -import org.eclipse.sirius.diagram.sequence.util.Range; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.diagram.ui.business.internal.operation.AbstractModelChangeOperation; -import com.google.common.base.Preconditions; - /** - * Modifies the vertical range of a lifeline edit part to move the end of life - * edit part. + * Modifies the vertical range of a lifeline edit part to move the end of life edit part. * * @author mporhel, smonnier */ @@ -41,7 +40,7 @@ public class EndOfLifeMoveOperation extends AbstractModelChangeOperation<Void> { */ public EndOfLifeMoveOperation(Lifeline lifeline, int rangeDeltaWidth) { super(Messages.EndOfLifeMoveOperation_operationName); - this.lifeline = Preconditions.checkNotNull(lifeline); + this.lifeline = Objects.requireNonNull(lifeline); this.rangeDeltaWidth = rangeDeltaWidth; } diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/FixGraphicalOrderingOperation.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/FixGraphicalOrderingOperation.java index ca0d9bb9bd..58942a77a7 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/FixGraphicalOrderingOperation.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/FixGraphicalOrderingOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2013, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -15,15 +15,14 @@ package org.eclipse.sirius.diagram.sequence.business.internal.operation; import java.util.ArrayList; import java.util.List; -import org.eclipse.sirius.diagram.sequence.Messages; import org.eclipse.sirius.diagram.sequence.SequenceDDiagram; import org.eclipse.sirius.diagram.sequence.ordering.EventEnd; import org.eclipse.sirius.diagram.sequence.ordering.EventEndsOrdering; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.diagram.ui.business.internal.operation.AbstractModelChangeOperation; /** - * An operation to remove the invalid ends from the graphical ordering of a - * sequence diagram. + * An operation to remove the invalid ends from the graphical ordering of a sequence diagram. * * @author pcdavid */ diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/ISequenceNodeMoveOperation.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/ISequenceNodeMoveOperation.java index 41b47ee494..9a900ce35f 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/ISequenceNodeMoveOperation.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/ISequenceNodeMoveOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -14,16 +14,15 @@ package org.eclipse.sirius.diagram.sequence.business.internal.operation; import java.util.Collection; import java.util.HashSet; +import java.util.Objects; import org.eclipse.gmf.runtime.notation.LayoutConstraint; import org.eclipse.gmf.runtime.notation.Location; import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.sirius.diagram.sequence.Messages; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceNode; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.diagram.ui.business.internal.operation.AbstractModelChangeOperation; -import com.google.common.base.Preconditions; - /** * Move an execution, interaction use of combined fragment vertically. * @@ -45,7 +44,7 @@ public class ISequenceNodeMoveOperation extends AbstractModelChangeOperation<Voi */ public ISequenceNodeMoveOperation(ISequenceNode node, int logicalShift) { super(Messages.ISequenceNodeMoveOperation_operationName); - this.seqNodes.add(Preconditions.checkNotNull(node)); + this.seqNodes.add(Objects.requireNonNull(node)); this.logicalShift = logicalShift; } @@ -59,7 +58,7 @@ public class ISequenceNodeMoveOperation extends AbstractModelChangeOperation<Voi */ public ISequenceNodeMoveOperation(Collection<ISequenceNode> nodes, int logicalShift) { super(Messages.ISequenceNodeMoveOperation_operationName); - Preconditions.checkNotNull(nodes); + Objects.requireNonNull(nodes); this.seqNodes.addAll(nodes); this.logicalShift = logicalShift; } diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/InverseRelativeNodePositionOperation.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/InverseRelativeNodePositionOperation.java index dcf25d3bf2..0ad0283802 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/InverseRelativeNodePositionOperation.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/InverseRelativeNodePositionOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -12,17 +12,16 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.sequence.business.internal.operation; +import java.util.Objects; + import org.eclipse.gmf.runtime.notation.Location; import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.sirius.diagram.sequence.Messages; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.diagram.ui.business.internal.operation.AbstractModelChangeOperation; -import com.google.common.base.Preconditions; - /** - * An operation to inverse the relative position of a node on both axes. This is - * used for labels on messages to make sure they are always above the message, - * regardless of its direction (left-to-right or right-to-left). + * An operation to inverse the relative position of a node on both axes. This is used for labels on messages to make + * sure they are always above the message, regardless of its direction (left-to-right or right-to-left). * * @author pcdavid, smonnier */ @@ -37,7 +36,7 @@ public class InverseRelativeNodePositionOperation extends AbstractModelChangeOpe */ public InverseRelativeNodePositionOperation(Node node) { super(Messages.InverseRelativeNodePositionOperation_operationName); - this.node = Preconditions.checkNotNull(node); + this.node = Objects.requireNonNull(node); } @Override diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/RefreshGraphicalOrderingOperation.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/RefreshGraphicalOrderingOperation.java index 8288d5b480..6e8734a620 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/RefreshGraphicalOrderingOperation.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/RefreshGraphicalOrderingOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -16,7 +16,6 @@ import java.util.Collections; import java.util.List; import java.util.concurrent.ExecutionException; -import org.eclipse.sirius.diagram.sequence.Messages; import org.eclipse.sirius.diagram.sequence.SequenceDDiagram; import org.eclipse.sirius.diagram.sequence.business.internal.VerticalPositionFunction; import org.eclipse.sirius.diagram.sequence.business.internal.elements.SequenceDiagram; @@ -24,6 +23,7 @@ import org.eclipse.sirius.diagram.sequence.business.internal.ordering.RefreshOrd import org.eclipse.sirius.diagram.sequence.ordering.EventEnd; import org.eclipse.sirius.diagram.sequence.ordering.EventEndsOrdering; import org.eclipse.sirius.diagram.sequence.ordering.SingleEventEnd; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.diagram.ui.business.internal.operation.AbstractModelChangeOperation; import com.google.common.base.Function; @@ -36,8 +36,7 @@ import com.google.common.collect.Lists; import com.google.common.collect.Ordering; /** - * An operation to re-compute the graphical ordering in which events appear on a - * diagram. + * An operation to re-compute the graphical ordering in which events appear on a diagram. * * <pre> * GMF View Model ------> GraphicalMessageOrdering @@ -49,8 +48,8 @@ public class RefreshGraphicalOrderingOperation extends AbstractModelChangeOperat private final SequenceDDiagram sequenceDiagram; /** - * Creates a command which updates the graphical ordering of events store in - * the model using the latest available graphical informations. + * Creates a command which updates the graphical ordering of events store in the model using the latest available + * graphical informations. * * @param sequenceDiagram * the diagram whose graphical ordering should be refreshed. @@ -83,8 +82,7 @@ public class RefreshGraphicalOrderingOperation extends AbstractModelChangeOperat * the diagram. * * @param verticalPosition - * the function to use to obtain the vertical position of the - * event ends. + * the function to use to obtain the vertical position of the event ends. */ private boolean refreshGlobalOrdering(EventEndsOrdering graphicalOrdering, VerticalPositionFunction verticalPosition) { final LoadingCache<EventEnd, Integer> positions = CacheBuilder.newBuilder().build(CacheLoader.from(verticalPosition)); @@ -116,8 +114,8 @@ public class RefreshGraphicalOrderingOperation extends AbstractModelChangeOperat /** * Returns all the event ends of the current Sequence diagram. * - * The default implementation does the computation on each call, subclasses - * may override this method to change this behavior. + * The default implementation does the computation on each call, subclasses may override this method to change this + * behavior. * * @return an Iterable with all event ends. */ @@ -126,9 +124,8 @@ public class RefreshGraphicalOrderingOperation extends AbstractModelChangeOperat } /** - * Custom vertical function which do not return the real location of an - * event end but allow to correctly order event end from logically - * instantaneous ISequenceEvent. + * Custom vertical function which do not return the real location of an event end but allow to correctly order event + * end from logically instantaneous ISequenceEvent. * * @author mPorhel */ @@ -146,11 +143,9 @@ public class RefreshGraphicalOrderingOperation extends AbstractModelChangeOperat Integer customPos = super.apply(end); if (customPos != INVALID_POSITION || customPos != -INVALID_POSITION) { /* - * Simulates a 10x zoom so that we can adjust the - * SingleEventEnds position to get the proper ordering. This - * manipulation gives us the right ordering, but the actual - * Integer values returned by the function should not be used - * for anything else than comparing relative positions. + * Simulates a 10x zoom so that we can adjust the SingleEventEnds position to get the proper ordering. + * This manipulation gives us the right ordering, but the actual Integer values returned by the function + * should not be used for anything else than comparing relative positions. */ customPos *= 10; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/RefreshSemanticOrderingsOperation.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/RefreshSemanticOrderingsOperation.java index 420954c57b..add95596cf 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/RefreshSemanticOrderingsOperation.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/RefreshSemanticOrderingsOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -17,6 +17,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EObject; @@ -26,7 +27,6 @@ import org.eclipse.sirius.common.tools.api.interpreter.IInterpreter; import org.eclipse.sirius.common.tools.api.util.StringUtil; import org.eclipse.sirius.diagram.DNode; import org.eclipse.sirius.diagram.description.DiagramDescription; -import org.eclipse.sirius.diagram.sequence.Messages; import org.eclipse.sirius.diagram.sequence.SequenceDDiagram; import org.eclipse.sirius.diagram.sequence.business.internal.elements.InstanceRole; import org.eclipse.sirius.diagram.sequence.business.internal.ordering.RefreshOrderingHelper; @@ -35,11 +35,11 @@ import org.eclipse.sirius.diagram.sequence.description.SequenceDiagramDescriptio import org.eclipse.sirius.diagram.sequence.ordering.EventEnd; import org.eclipse.sirius.diagram.sequence.ordering.EventEndsOrdering; import org.eclipse.sirius.diagram.sequence.ordering.InstanceRolesOrdering; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.diagram.ui.business.internal.operation.AbstractModelChangeOperation; import org.eclipse.sirius.tools.api.interpreter.InterpreterUtil; import com.google.common.base.Function; -import com.google.common.base.Preconditions; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; @@ -69,7 +69,7 @@ public class RefreshSemanticOrderingsOperation extends AbstractModelChangeOperat */ public RefreshSemanticOrderingsOperation(SequenceDDiagram diagram) { super(Messages.RefreshSemanticOrderingsOperation_operationName); - this.sequenceDDiagram = Preconditions.checkNotNull(diagram); + this.sequenceDDiagram = Objects.requireNonNull(diagram); } @Override diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/ReparentExecutionOperation.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/ReparentExecutionOperation.java index 642d370076..0a221d1d41 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/ReparentExecutionOperation.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/ReparentExecutionOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -12,21 +12,22 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.sequence.business.internal.operation; +import java.util.Objects; + import org.eclipse.emf.common.util.EList; import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.AbstractDNode; import org.eclipse.sirius.diagram.DNode; -import org.eclipse.sirius.diagram.sequence.Messages; import org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractNodeEvent; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceEvent; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.diagram.ui.business.internal.operation.AbstractModelChangeOperation; import com.google.common.base.Preconditions; /** - * Update the structure of DNodes and GMF Nodes to reflect that an execution has - * a new parent event. + * Update the structure of DNodes and GMF Nodes to reflect that an execution has a new parent event. * * @author pcdavid, smonnier, mporhel */ @@ -45,8 +46,8 @@ public class ReparentExecutionOperation extends AbstractModelChangeOperation<Voi */ public ReparentExecutionOperation(AbstractNodeEvent execution, ISequenceEvent finalParent) { super(Messages.ReparentExecutionOperation_operationName); - this.execution = Preconditions.checkNotNull(execution); - this.finalParent = Preconditions.checkNotNull(finalParent); + this.execution = Objects.requireNonNull(execution); + this.finalParent = Objects.requireNonNull(finalParent); Preconditions.checkArgument(execution.getNotationView().getElement() instanceof DNode); Preconditions.checkArgument(finalParent.getNotationView().getElement() instanceof AbstractDNode); } diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SequenceMessageRangeHelper.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SequenceMessageRangeHelper.java index 992a4ef781..708f904762 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SequenceMessageRangeHelper.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SequenceMessageRangeHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -20,10 +20,10 @@ import org.eclipse.gmf.runtime.notation.IdentityAnchor; import org.eclipse.gmf.runtime.notation.NotationFactory; import org.eclipse.gmf.runtime.notation.RelativeBendpoints; import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceElementAccessor; import org.eclipse.sirius.diagram.sequence.business.internal.elements.Message; import org.eclipse.sirius.diagram.sequence.business.internal.layout.LayoutConstants; -import org.eclipse.sirius.diagram.sequence.util.Range; import org.eclipse.sirius.ext.base.Option; import com.google.common.collect.Iterables; @@ -42,14 +42,11 @@ public class SequenceMessageRangeHelper { * @param edge * the edge representing the message. * @param range - * the final range of the message. In practice it is a range of - * width 1 for horizontal messages. + * the final range of the message. In practice it is a range of width 1 for horizontal messages. * @param sourceTop - * the logical vertical position of the top of the source element - * of the message. + * the logical vertical position of the top of the source element of the message. * @param targetTop - * the logical vertical position of the top of the target element - * of the message. + * the logical vertical position of the top of the target element of the message. */ public void setMessageRangeForNormalMessage(Edge edge, Range range, final int sourceTop, final int targetTop) { resetAnchors(edge); @@ -80,14 +77,11 @@ public class SequenceMessageRangeHelper { * @param edge * the edge representing the message. * @param range - * the final range of the message. In practice it is a range of - * width 1 for horizontal messages. + * the final range of the message. In practice it is a range of width 1 for horizontal messages. * @param sourceTop - * the logical vertical position of the top of the source element - * of the message. + * the logical vertical position of the top of the source element of the message. * @param targetTop - * the logical vertical position of the top of the target element - * of the message. + * the logical vertical position of the top of the target element of the message. */ public void setMessageRangeForMessageToSelf(Edge edge, Range range, final int sourceTop, final int targetTop) { resetAnchors(edge); @@ -117,15 +111,13 @@ public class SequenceMessageRangeHelper { assert targetX != null && targetX.length == 4; /* - * The vertical offsets of the two first/top bendpoints from the top of - * the source/target. + * The vertical offsets of the two first/top bendpoints from the top of the source/target. */ int topSourceDeltaY = range.getLowerBound() - sourceTop; int topTargetDeltaY = range.getLowerBound() - targetTop; /* - * The vertical offsets of the two last/bottom bendpoints from the top - * of the source/target. + * The vertical offsets of the two last/bottom bendpoints from the top of the source/target. */ int bottomSourceDeltaY = range.getUpperBound() - sourceTop; int bottomTargetDeltaY = range.getUpperBound() - targetTop; @@ -160,8 +152,8 @@ public class SequenceMessageRangeHelper { } /** - * Reset the anchors of an edge to a known, easy to handle location: the - * center of the top side of the source or target element. + * Reset the anchors of an edge to a known, easy to handle location: the center of the top side of the source or + * target element. */ private void resetAnchors(Edge edge) { edge.setSourceAnchor(createCanonicalAnchor()); diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SetMessageRangeOperation.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SetMessageRangeOperation.java index 0c73601ce0..3838b9a050 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SetMessageRangeOperation.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SetMessageRangeOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -17,8 +17,8 @@ import org.eclipse.gmf.runtime.notation.Edge; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.DEdge; import org.eclipse.sirius.diagram.EdgeTarget; -import org.eclipse.sirius.diagram.sequence.Messages; -import org.eclipse.sirius.diagram.sequence.util.Range; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.diagram.ui.business.internal.operation.AbstractModelChangeOperation; import com.google.common.base.Objects; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SetVerticalRangeOperation.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SetVerticalRangeOperation.java index 15c75888ec..39a4973fd2 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SetVerticalRangeOperation.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SetVerticalRangeOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -12,9 +12,11 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.sequence.business.internal.operation; -import org.eclipse.sirius.diagram.sequence.Messages; +import java.util.Objects; + +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceEvent; -import org.eclipse.sirius.diagram.sequence.util.Range; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.diagram.ui.business.internal.operation.AbstractModelChangeOperation; import com.google.common.base.Preconditions; @@ -39,8 +41,8 @@ public class SetVerticalRangeOperation extends AbstractModelChangeOperation<Void */ public SetVerticalRangeOperation(ISequenceEvent ise, Range newRange) { super(Messages.SetVerticalRangeOperation_operationName); - this.ise = Preconditions.checkNotNull(ise); - this.newRange = Preconditions.checkNotNull(newRange); + this.ise = Objects.requireNonNull(ise); + this.newRange = Objects.requireNonNull(newRange); Preconditions.checkArgument(!newRange.isEmpty()); } diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/ShiftDirectSubExecutionsOperation.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/ShiftDirectSubExecutionsOperation.java index 1885383409..c2fb62b2a0 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/ShiftDirectSubExecutionsOperation.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/ShiftDirectSubExecutionsOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,24 +13,23 @@ package org.eclipse.sirius.diagram.sequence.business.internal.operation; import java.text.MessageFormat; +import java.util.Objects; import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.sirius.diagram.sequence.Messages; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractNodeEvent; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceElementAccessor; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceEvent; -import org.eclipse.sirius.diagram.sequence.util.Range; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.diagram.ui.business.internal.operation.AbstractModelChangeOperation; import org.eclipse.sirius.ext.base.Option; -import com.google.common.base.Preconditions; import com.google.common.collect.Iterables; /** - * This command moves all the direct sub-executions of a given ExecutionEdipart - * vertically. It is used when an execution is resized from the top to ensure - * the sub-executions stay at the same absolute position instead of moving along - * (as they are relative to the top of the parent). + * This command moves all the direct sub-executions of a given ExecutionEdipart vertically. It is used when an execution + * is resized from the top to ensure the sub-executions stay at the same absolute position instead of moving along (as + * they are relative to the top of the parent). * * @author pcdavid, smonnier */ @@ -43,15 +42,13 @@ public class ShiftDirectSubExecutionsOperation extends AbstractModelChangeOperat * Constructor. * * @param parent - * the execution or lifeline whose direct sub-executions must be - * shifted. + * the execution or lifeline whose direct sub-executions must be shifted. * @param deltaY - * the vertical amount to shift the sub-executions (in logical - * space). + * the vertical amount to shift the sub-executions (in logical space). */ public ShiftDirectSubExecutionsOperation(ISequenceEvent parent, int deltaY) { super(MessageFormat.format(Messages.ShiftDirectSubExecutionsOperation_operationName, deltaY)); - this.parent = Preconditions.checkNotNull(parent); + this.parent = Objects.requireNonNull(parent); this.deltaY = deltaY; } diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SynchronizeGraphicalOrderingOperation.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SynchronizeGraphicalOrderingOperation.java index 0174fb6f1b..b13c2c3643 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SynchronizeGraphicalOrderingOperation.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SynchronizeGraphicalOrderingOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -12,24 +12,22 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.sequence.business.internal.operation; +import java.util.Objects; + import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.sirius.diagram.sequence.Messages; import org.eclipse.sirius.diagram.sequence.SequenceDDiagram; import org.eclipse.sirius.diagram.sequence.business.internal.elements.SequenceDiagram; import org.eclipse.sirius.diagram.sequence.business.internal.layout.SequenceLayout; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.diagram.ui.business.internal.operation.AbstractModelChangeOperation; import org.eclipse.sirius.ext.base.Option; -import com.google.common.base.Preconditions; - /** - * Refreshes the graphical locations of the elements in a sequence diagram to - * reflect the current semantic ordering. This command assumes that the - * {@link org.eclipse.sirius.diagram.sequence.ordering.GraphicalOrdering} and - * the {@link org.eclipse.sirius.diagram.sequence.ordering.SemanticOrdering} are - * up to date according to the current visual (resp. semantic) order but that - * when they do not match, the semantic ordering is the authoritative one and - * the graphical ordering should be changed to match it. + * Refreshes the graphical locations of the elements in a sequence diagram to reflect the current semantic ordering. + * This command assumes that the {@link org.eclipse.sirius.diagram.sequence.ordering.GraphicalOrdering} and the + * {@link org.eclipse.sirius.diagram.sequence.ordering.SemanticOrdering} are up to date according to the current visual + * (resp. semantic) order but that when they do not match, the semantic ordering is the authoritative one and the + * graphical ordering should be changed to match it. * * @author pcdavid, smonnier */ @@ -49,14 +47,14 @@ public class SynchronizeGraphicalOrderingOperation extends AbstractModelChangeOp */ public SynchronizeGraphicalOrderingOperation(Diagram sequenceDiagram, boolean pack) { super(Messages.SynchronizeGraphicalOrderingOperation_operationName); - this.sequenceDiagram = Preconditions.checkNotNull(sequenceDiagram); + this.sequenceDiagram = Objects.requireNonNull(sequenceDiagram); this.pack = pack; } @Override public Boolean execute() { boolean result = false; - Preconditions.checkNotNull(sequenceDiagram); + Objects.requireNonNull(sequenceDiagram); SequenceLayout sequenceLayout = new SequenceLayout(sequenceDiagram); Option<SequenceDiagram> sd = sequenceLayout.getSequenceDiagram(); diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SynchronizeISequenceEventsSemanticOrderingOperation.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SynchronizeISequenceEventsSemanticOrderingOperation.java index 44ab8d2536..62dc4903b3 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SynchronizeISequenceEventsSemanticOrderingOperation.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SynchronizeISequenceEventsSemanticOrderingOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -18,6 +18,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; +import java.util.Objects; import java.util.Set; import org.eclipse.emf.common.util.EList; @@ -26,9 +27,9 @@ import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.business.api.session.SessionManager; import org.eclipse.sirius.diagram.DDiagramElement; import org.eclipse.sirius.diagram.business.api.componentization.DiagramComponentizationManager; +import org.eclipse.sirius.diagram.business.api.query.DiagramDescriptionQuery; import org.eclipse.sirius.diagram.business.api.query.DiagramElementMappingQuery; import org.eclipse.sirius.diagram.description.DiagramElementMapping; -import org.eclipse.sirius.diagram.sequence.Messages; import org.eclipse.sirius.diagram.sequence.SequenceDDiagram; import org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractNodeEvent; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceElement; @@ -43,12 +44,11 @@ import org.eclipse.sirius.diagram.sequence.description.tool.ReorderTool; import org.eclipse.sirius.diagram.sequence.ordering.CompoundEventEnd; import org.eclipse.sirius.diagram.sequence.ordering.EventEnd; import org.eclipse.sirius.diagram.sequence.ordering.SingleEventEnd; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.diagram.ui.business.internal.operation.AbstractModelChangeOperation; import org.eclipse.sirius.tools.api.command.SiriusCommand; import org.eclipse.sirius.viewpoint.description.tool.AbstractToolDescription; -import com.google.common.base.Objects; -import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.base.Predicates; import com.google.common.collect.Iterables; @@ -56,14 +56,11 @@ import com.google.common.collect.Lists; import com.google.common.collect.Sets; /** - * Refreshes the semantic ordering of a an element of a sequence diagram to - * reflect the current graphical ordering. This command assumes that the - * <code>GraphicalMessageOrdering</code> and the - * <code>SemanticMessageOrdering</code> are up to date according to the current - * visual (resp. semantic) order but that when they do not match, the graphical - * ordering is the authoritative one and the semantic ordering should be changed - * to match it, through the appropriate use of the user-specified - * <code>ReorderTool</code>. + * Refreshes the semantic ordering of a an element of a sequence diagram to reflect the current graphical ordering. This + * command assumes that the <code>GraphicalMessageOrdering</code> and the <code>SemanticMessageOrdering</code> are up to + * date according to the current visual (resp. semantic) order but that when they do not match, the graphical ordering + * is the authoritative one and the semantic ordering should be changed to match it, through the appropriate use of the + * user-specified <code>ReorderTool</code>. * * @author pcdavid, smonnier */ @@ -92,7 +89,7 @@ public class SynchronizeISequenceEventsSemanticOrderingOperation extends Abstrac */ public SynchronizeISequenceEventsSemanticOrderingOperation(ISequenceEvent event) { super(Messages.SynchronizeISequenceEventsSemanticOrderingOperation_operationName); - this.event = Preconditions.checkNotNull(event); + this.event = Objects.requireNonNull(event); this.diagram = event.getDiagram(); this.sequenceDiagram = this.diagram.getSequenceDDiagram(); } @@ -107,7 +104,7 @@ public class SynchronizeISequenceEventsSemanticOrderingOperation extends Abstrac */ public SynchronizeISequenceEventsSemanticOrderingOperation(ISequenceEvent event, Collection<ISequenceEvent> selection) { this(event); - Preconditions.checkNotNull(selection); + Objects.requireNonNull(selection); this.selection.addAll(selection); } @@ -180,7 +177,7 @@ public class SynchronizeISequenceEventsSemanticOrderingOperation extends Abstrac } - if (!Objects.equal(startingEndPredecessorBefore, startingEndPredecessorAfter) || !Objects.equal(finishingEndPredecessorBefore, finishingEndPredecessorAfter) + if (!Objects.equals(startingEndPredecessorBefore, startingEndPredecessorAfter) || !Objects.equals(finishingEndPredecessorBefore, finishingEndPredecessorAfter) || !Iterables.elementsEqual(endsByGraphicalOrder, endsBySemanticOrder)) { applySemanticReordering(semanticElement, startingEndPredecessorAfter, finishingEndPredecessorAfter, reorderTool); applyCompoundReordering(semanticElement, ends, compoundEnds, startingEndPredecessorAfter, finishingEndPredecessorAfter, reorderTool); @@ -272,8 +269,8 @@ public class SynchronizeISequenceEventsSemanticOrderingOperation extends Abstrac } }; - final Set<EObject> semanticDescendants = Sets.newHashSet(Iterables.filter(Iterables.transform(new ISequenceEventQuery(ise).getAllDescendants(), ISequenceElement.SEMANTIC_TARGET), - Predicates.notNull())); + final Set<EObject> semanticDescendants = Sets + .newHashSet(Iterables.filter(Iterables.transform(new ISequenceEventQuery(ise).getAllDescendants(), ISequenceElement.SEMANTIC_TARGET), Predicates.notNull())); final Predicate<EObject> isSemanticSubEventEnd = new Predicate<EObject>() { @Override public boolean apply(EObject input) { @@ -321,12 +318,12 @@ public class SynchronizeISequenceEventsSemanticOrderingOperation extends Abstrac private ReorderTool findReorderTool(DDiagramElement diagramElement) { if (diagramElement != null) { - List<AbstractToolDescription> allTools; + Collection<AbstractToolDescription> allTools; Session session = SessionManager.INSTANCE.getSession(diagramElement); if (session != null) { allTools = new DiagramComponentizationManager().getAllTools(session.getSelectedViewpoints(false), sequenceDiagram.getDescription()); } else { - allTools = sequenceDiagram.getDescription().getAllTools(); + allTools = new DiagramDescriptionQuery(sequenceDiagram.getDescription()).getAllTools(); } DiagramElementMapping mappingToCheck = new DiagramElementMappingQuery(diagramElement.getDiagramElementMapping()).getRootMapping(); diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SynchronizeInstanceRoleSemanticOrderingOperation.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SynchronizeInstanceRoleSemanticOrderingOperation.java index 550336c190..ff0fd096bc 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SynchronizeInstanceRoleSemanticOrderingOperation.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/SynchronizeInstanceRoleSemanticOrderingOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -17,6 +17,7 @@ import java.util.Collection; import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; +import java.util.Objects; import java.util.Set; import org.eclipse.emf.ecore.EObject; @@ -25,7 +26,7 @@ import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.business.api.session.SessionManager; import org.eclipse.sirius.diagram.DDiagramElement; import org.eclipse.sirius.diagram.business.api.componentization.DiagramComponentizationManager; -import org.eclipse.sirius.diagram.sequence.Messages; +import org.eclipse.sirius.diagram.business.api.query.DiagramDescriptionQuery; import org.eclipse.sirius.diagram.sequence.SequenceDDiagram; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceElement; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceElementAccessor; @@ -33,25 +34,21 @@ import org.eclipse.sirius.diagram.sequence.business.internal.elements.InstanceRo import org.eclipse.sirius.diagram.sequence.business.internal.elements.SequenceDiagram; import org.eclipse.sirius.diagram.sequence.business.internal.tool.ToolCommandBuilder; import org.eclipse.sirius.diagram.sequence.description.tool.InstanceRoleReorderTool; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.diagram.ui.business.internal.operation.AbstractModelChangeOperation; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.tools.api.command.SiriusCommand; import org.eclipse.sirius.viewpoint.description.tool.AbstractToolDescription; -import com.google.common.base.Objects; -import com.google.common.base.Preconditions; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; /** - * Refreshes the semantic ordering of a an element of a sequence diagram to - * reflect the current graphical ordering. This command assumes that the - * <code>GraphicalMessageOrdering</code> and the - * <code>SemanticMessageOrdering</code> are up to date according to the current - * visual (resp. semantic) order but that when they do not match, the graphical - * ordering is the authoritative one and the semantic ordering should be changed - * to match it, through the appropriate use of the user-specified - * <code>ReorderTool</code>. + * Refreshes the semantic ordering of a an element of a sequence diagram to reflect the current graphical ordering. This + * command assumes that the <code>GraphicalMessageOrdering</code> and the <code>SemanticMessageOrdering</code> are up to + * date according to the current visual (resp. semantic) order but that when they do not match, the graphical ordering + * is the authoritative one and the semantic ordering should be changed to match it, through the appropriate use of the + * user-specified <code>ReorderTool</code>. * * @author pcdavid, smonnier */ @@ -70,12 +67,11 @@ public class SynchronizeInstanceRoleSemanticOrderingOperation extends AbstractMo * Constructor. * * @param instanceRole - * the instance role to move to its new location in the semantic - * order. + * the instance role to move to its new location in the semantic order. */ public SynchronizeInstanceRoleSemanticOrderingOperation(InstanceRole instanceRole) { super(Messages.SynchronizeInstanceRoleSemanticOrderingOperation_operationName); - this.instanceRole = Preconditions.checkNotNull(instanceRole); + this.instanceRole = Objects.requireNonNull(instanceRole); this.diagram = instanceRole.getDiagram(); this.sequenceDiagram = this.diagram.getSequenceDDiagram(); } @@ -84,15 +80,13 @@ public class SynchronizeInstanceRoleSemanticOrderingOperation extends AbstractMo * Constructor. * * @param instanceRole - * the instance role to move to its new location in the semantic - * order. + * the instance role to move to its new location in the semantic order. * @param selection * additional events to reorder */ public SynchronizeInstanceRoleSemanticOrderingOperation(InstanceRole instanceRole, Collection<InstanceRole> selection) { this(instanceRole); - Preconditions.checkNotNull(selection); - this.selection.addAll(selection); + this.selection.addAll(Objects.requireNonNull(selection)); } @Override @@ -129,7 +123,7 @@ public class SynchronizeInstanceRoleSemanticOrderingOperation extends AbstractMo // The graphical ordering contains the state after EObject predecessorAfter = findEndPredecessor(semanticElement, rolesByGraphicalOrder); - if (!rolesBySemanticOrder.isEmpty() && !Objects.equal(predecessorBefore, predecessorAfter) || !Iterables.elementsEqual(rolesBySemanticOrder, rolesByGraphicalOrder)) { + if (!rolesBySemanticOrder.isEmpty() && !Objects.equals(predecessorBefore, predecessorAfter) || !Iterables.elementsEqual(rolesBySemanticOrder, rolesByGraphicalOrder)) { applySemanticReordering(semanticElement, predecessorBefore, predecessorAfter, reorderTool); reordered.add(instanceRoleToUpdate); @@ -175,12 +169,12 @@ public class SynchronizeInstanceRoleSemanticOrderingOperation extends AbstractMo private InstanceRoleReorderTool findReorderTool(DDiagramElement diagramElement) { if (diagramElement != null) { - List<AbstractToolDescription> allTools; + Collection<AbstractToolDescription> allTools; Session session = SessionManager.INSTANCE.getSession(diagramElement); if (session != null) { allTools = new DiagramComponentizationManager().getAllTools(session.getSelectedViewpoints(false), sequenceDiagram.getDescription()); } else { - allTools = sequenceDiagram.getDescription().getAllTools(); + allTools = new DiagramDescriptionQuery(sequenceDiagram.getDescription()).getAllTools(); } // TODO Consider layers activation for (InstanceRoleReorderTool toolDesc : Iterables.filter(allTools, InstanceRoleReorderTool.class)) { diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/VerticalSpaceExpansionOrReduction.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/VerticalSpaceExpansionOrReduction.java index d6de6bcb63..81849ae369 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/VerticalSpaceExpansionOrReduction.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/VerticalSpaceExpansionOrReduction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2019 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -26,7 +26,7 @@ import org.eclipse.gmf.runtime.notation.LayoutConstraint; import org.eclipse.gmf.runtime.notation.Location; import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.Size; -import org.eclipse.sirius.diagram.sequence.Messages; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractNodeEvent; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceEvent; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceNode; @@ -36,7 +36,7 @@ import org.eclipse.sirius.diagram.sequence.business.internal.elements.Message; import org.eclipse.sirius.diagram.sequence.business.internal.elements.Operand; import org.eclipse.sirius.diagram.sequence.business.internal.elements.SequenceDiagram; import org.eclipse.sirius.diagram.sequence.business.internal.query.ISequenceEventQuery; -import org.eclipse.sirius.diagram.sequence.util.Range; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.diagram.ui.business.internal.operation.AbstractModelChangeOperation; import org.eclipse.sirius.ext.base.Option; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/ISequenceElementQuery.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/ISequenceElementQuery.java index 849bd7df9b..d84660d41b 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/ISequenceElementQuery.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/ISequenceElementQuery.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2013 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -12,12 +12,13 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.sequence.business.internal.query; +import java.util.Objects; + import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.sirius.diagram.AbsoluteBoundsFilter; import org.eclipse.sirius.diagram.DDiagramElement; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceElement; -import com.google.common.base.Preconditions; import com.google.common.collect.Iterables; /** @@ -38,7 +39,7 @@ public class ISequenceElementQuery { * the event to query. */ public ISequenceElementQuery(ISequenceElement event) { - this.event = Preconditions.checkNotNull(event); + this.event = Objects.requireNonNull(event); } /** @@ -66,10 +67,10 @@ public class ISequenceElementQuery { Iterable<AbsoluteBoundsFilter> flags = Iterables.filter(dde.getGraphicalFilters(), AbsoluteBoundsFilter.class); if (!Iterables.isEmpty(flags)) { AbsoluteBoundsFilter flag = flags.iterator().next(); - bounds.x = safeGetInt(flag.getX()); - bounds.y = safeGetInt(flag.getY()); - bounds.width = safeGetInt(flag.getWidth()); - bounds.height = safeGetInt(flag.getHeight()); + bounds.setX(safeGetInt(flag.getX())); + bounds.setY(safeGetInt(flag.getY())); + bounds.setWidth(safeGetInt(flag.getWidth())); + bounds.setHeight(safeGetInt(flag.getHeight())); } } return bounds; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/ISequenceEventQuery.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/ISequenceEventQuery.java index 52e084c0ae..8a90aa56f3 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/ISequenceEventQuery.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/ISequenceEventQuery.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -17,19 +17,19 @@ import java.util.Collection; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; +import java.util.Objects; import java.util.Set; import org.eclipse.gmf.runtime.notation.Edge; import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.elements.Execution; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceElementAccessor; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceEvent; import org.eclipse.sirius.diagram.sequence.business.internal.elements.Message; -import org.eclipse.sirius.diagram.sequence.util.Range; import org.eclipse.sirius.ext.base.Option; -import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.base.Predicates; import com.google.common.collect.Iterables; @@ -53,7 +53,7 @@ public class ISequenceEventQuery { * the event to query. */ public ISequenceEventQuery(ISequenceEvent event) { - this.event = Preconditions.checkNotNull(event); + this.event = Objects.requireNonNull(event); } /** diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/InstanceRoleQuery.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/InstanceRoleQuery.java index 249f5b893a..f23a7e6dc3 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/InstanceRoleQuery.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/InstanceRoleQuery.java @@ -12,13 +12,13 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.sequence.business.internal.query; +import java.util.Objects; + import org.eclipse.sirius.diagram.business.api.diagramtype.HeaderData; import org.eclipse.sirius.diagram.sequence.business.internal.elements.InstanceRole; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.viewpoint.RGBValues; -import com.google.common.base.Preconditions; - /** * General queries on {@link InstanceRole}s. * @@ -37,7 +37,7 @@ public class InstanceRoleQuery { * the instance role to query. */ public InstanceRoleQuery(InstanceRole instanceRole) { - this.instanceRole = Preconditions.checkNotNull(instanceRole); + this.instanceRole = Objects.requireNonNull(instanceRole); } /** diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/RangeComparator.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/RangeComparator.java index 7c186d44f3..332a212044 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/RangeComparator.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/RangeComparator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -16,16 +16,15 @@ import java.io.Serializable; import java.util.Comparator; import java.util.List; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.RangeHelper; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceElement; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceEvent; import org.eclipse.sirius.diagram.sequence.business.internal.elements.SequenceDiagram; import org.eclipse.sirius.diagram.sequence.ordering.EventEnd; -import org.eclipse.sirius.diagram.sequence.util.Range; /** - * {@link Comparator} used to order Set of {@link ISequenceElement} according to - * their {@link Range#getLowerBound()}. + * {@link Comparator} used to order Set of {@link ISequenceElement} according to their {@link Range#getLowerBound()}. * * @author <a href="mailto:esteban.dugueperoux@obeo.fr">Esteban Dugueperoux</a> */ @@ -37,11 +36,11 @@ public class RangeComparator implements Comparator<ISequenceElement>, Serializab private static final long serialVersionUID = -8968333614931292746L; /** - * Overridden to compare {@link ISequenceElement} order according to their - * {@link Range}. + * Overridden to compare {@link ISequenceElement} order according to their {@link Range}. * * {@inheritDoc} */ + @Override public int compare(ISequenceElement sequenceElement1, ISequenceElement sequenceElement2) { Range sequenceElement1Range = RangeHelper.verticalRange(sequenceElement1.getProperLogicalBounds()); Range sequenceElement2Range = RangeHelper.verticalRange(sequenceElement2.getProperLogicalBounds()); diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/ReversedRangeComparator.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/ReversedRangeComparator.java index 963b75d287..2bcbc532c2 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/ReversedRangeComparator.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/ReversedRangeComparator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -16,16 +16,15 @@ import java.io.Serializable; import java.util.Comparator; import java.util.List; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.RangeHelper; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceElement; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceEvent; import org.eclipse.sirius.diagram.sequence.business.internal.elements.SequenceDiagram; import org.eclipse.sirius.diagram.sequence.ordering.EventEnd; -import org.eclipse.sirius.diagram.sequence.util.Range; /** - * {@link Comparator} used to order Set of {@link ISequenceElement} according to - * their {@link Range#getUpperBound()}. + * {@link Comparator} used to order Set of {@link ISequenceElement} according to their {@link Range#getUpperBound()}. * * @author <a href="mailto:esteban.dugueperoux@obeo.fr">Esteban Dugueperoux</a> */ @@ -37,11 +36,11 @@ public class ReversedRangeComparator implements Comparator<ISequenceElement>, Se private static final long serialVersionUID = -962057468507177598L; /** - * Overridden to compare {@link ISequenceElement} order according to their - * range from upper to lower. + * Overridden to compare {@link ISequenceElement} order according to their range from upper to lower. * * {@inheritDoc} */ + @Override public int compare(ISequenceElement sequenceElement1, ISequenceElement sequenceElement2) { Range sequenceElement1Range = RangeHelper.verticalRange(sequenceElement1.getProperLogicalBounds()); Range sequenceElement2Range = RangeHelper.verticalRange(sequenceElement2.getProperLogicalBounds()); diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/SequenceDiagramQuery.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/SequenceDiagramQuery.java index 80f9fe17d2..1377ec8e80 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/SequenceDiagramQuery.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/SequenceDiagramQuery.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,11 +13,12 @@ package org.eclipse.sirius.diagram.sequence.business.internal.query; import java.util.Collection; +import java.util.Objects; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; -import org.eclipse.sirius.diagram.sequence.Messages; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.RangeHelper; import org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractFrame; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceEvent; @@ -26,7 +27,7 @@ import org.eclipse.sirius.diagram.sequence.business.internal.elements.Lifeline; import org.eclipse.sirius.diagram.sequence.business.internal.elements.Message; import org.eclipse.sirius.diagram.sequence.business.internal.elements.SequenceDiagram; import org.eclipse.sirius.diagram.sequence.business.internal.layout.LayoutConstants; -import org.eclipse.sirius.diagram.sequence.util.Range; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.diagram.ui.tools.api.graphical.edit.styles.IBorderItemOffsets; import org.eclipse.sirius.ext.base.Option; @@ -55,17 +56,16 @@ public class SequenceDiagramQuery { } /** - * Get all {@link ISequenceEvent} of the current {@link SequenceDiagram} - * with range's lower bound strictly inferior to timePoint. + * Get all {@link ISequenceEvent} of the current {@link SequenceDiagram} with range's lower bound strictly inferior + * to timePoint. * * @param timePoint * the timePoint from which get all lower {@link ISequenceEvent} * - * @return the set of {@link ISequenceEvent} lower timePoint, sorted by - * range from lower to upper + * @return the set of {@link ISequenceEvent} lower timePoint, sorted by range from lower to upper */ public Set<ISequenceEvent> getAllSequenceEventsLowerThan(int timePoint) { - Preconditions.checkNotNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); + Objects.requireNonNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); Preconditions.checkArgument(timePoint > 0, Messages.SequenceDiagramQuery_invalidTimePoint); Set<ISequenceEvent> sequenceEventLowers = new TreeSet<ISequenceEvent>(new RangeComparator()); @@ -79,18 +79,15 @@ public class SequenceDiagramQuery { } /** - * Get all {@link ISequenceEvent} of the current {@link SequenceDiagram} - * with range's including strictly timePoint. + * Get all {@link ISequenceEvent} of the current {@link SequenceDiagram} with range's including strictly timePoint. * * @param timePoint - * the timePoint from which get all {@link ISequenceEvent} - * including it in their range + * the timePoint from which get all {@link ISequenceEvent} including it in their range * - * @return the set of {@link ISequenceEvent} having timePoint in their - * range, sorted by range from lower to upper + * @return the set of {@link ISequenceEvent} having timePoint in their range, sorted by range from lower to upper */ public Set<ISequenceEvent> getAllSequenceEventsOn(int timePoint) { - Preconditions.checkNotNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); + Objects.requireNonNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); Preconditions.checkArgument(timePoint > 0, Messages.SequenceDiagramQuery_invalidTimePoint); Set<ISequenceEvent> sequenceEventOns = new TreeSet<ISequenceEvent>(new RangeComparator()); @@ -104,17 +101,16 @@ public class SequenceDiagramQuery { } /** - * Get all {@link ISequenceEvent} of the current {@link SequenceDiagram} - * with range's lowerbound strictly upper to timePoint. + * Get all {@link ISequenceEvent} of the current {@link SequenceDiagram} with range's lowerbound strictly upper to + * timePoint. * * @param timePoint * the timePoint from which get all upper {@link ISequenceEvent} * - * @return the set of {@link ISequenceEvent} upper timePoint, sorted by - * range from lower to upper + * @return the set of {@link ISequenceEvent} upper timePoint, sorted by range from lower to upper */ public Set<ISequenceEvent> getAllSequenceEventsUpperThan(int timePoint) { - Preconditions.checkNotNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); + Objects.requireNonNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); Preconditions.checkArgument(timePoint > 0, Messages.SequenceDiagramQuery_invalidTimePoint); Set<ISequenceEvent> sequenceEventUppers = new TreeSet<ISequenceEvent>(new RangeComparator()); @@ -130,11 +126,11 @@ public class SequenceDiagramQuery { /** * Get all {@link ISequenceEvent} of the current {@link SequenceDiagram}. * - * @return the set of {@link ISequenceEvent} of the current - * {@link SequenceDiagram}, sorted by range from lower to upper + * @return the set of {@link ISequenceEvent} of the current {@link SequenceDiagram}, sorted by range from lower to + * upper */ public Set<ISequenceEvent> getAllSequenceEvents() { - Preconditions.checkNotNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); + Objects.requireNonNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); Set<ISequenceEvent> allSequenceEvents = new TreeSet<ISequenceEvent>(new RangeComparator()); allSequenceEvents.addAll(sequenceDiagram.getAllLifelines()); @@ -148,15 +144,13 @@ public class SequenceDiagramQuery { } /** - * Get all {@link ISequenceEvent} of the current {@link SequenceDiagram} of - * the specified {@link Lifeline}. + * Get all {@link ISequenceEvent} of the current {@link SequenceDiagram} of the specified {@link Lifeline}. * * @param lifeline * the specified {@link Lifeline} * - * @return the set of {@link ISequenceEvent} of the current - * {@link SequenceDiagram} of the specified {@link Lifeline}, sorted - * by range from lower to upper + * @return the set of {@link ISequenceEvent} of the current {@link SequenceDiagram} of the specified + * {@link Lifeline}, sorted by range from lower to upper */ public Set<ISequenceEvent> getAllSequenceEventsOnLifeline(Lifeline lifeline) { Set<ISequenceEvent> allSequenceEventsOnLifeline = new TreeSet<ISequenceEvent>(new RangeComparator()); @@ -187,8 +181,7 @@ public class SequenceDiagramQuery { } /** - * Get all events having at least one bound on the given {@link Lifeline} in - * the given range. + * Get all events having at least one bound on the given {@link Lifeline} in the given range. * * @param lifeline * the lifeline to check. @@ -208,17 +201,16 @@ public class SequenceDiagramQuery { } /** - * Get all {@link ISequenceNode} of the current {@link SequenceDiagram} with - * range's lowerbound strictly lower to timePoint. + * Get all {@link ISequenceNode} of the current {@link SequenceDiagram} with range's lowerbound strictly lower to + * timePoint. * * @param timePoint * the timePoint from which get all lower {@link ISequenceNode} * - * @return the set of {@link ISequenceNode} lower timePoint, sorted by range - * from lower to upper + * @return the set of {@link ISequenceNode} lower timePoint, sorted by range from lower to upper */ public Set<ISequenceNode> getAllSequenceNodesLowerThan(int timePoint) { - Preconditions.checkNotNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); + Objects.requireNonNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); Preconditions.checkArgument(timePoint > 0, Messages.SequenceDiagramQuery_invalidTimePoint); Set<ISequenceNode> sequenceNodeLowers = new TreeSet<ISequenceNode>(new RangeComparator()); @@ -232,18 +224,15 @@ public class SequenceDiagramQuery { } /** - * Get all {@link ISequenceNode} of the current {@link SequenceDiagram} with - * range's including strictly timePoint. + * Get all {@link ISequenceNode} of the current {@link SequenceDiagram} with range's including strictly timePoint. * * @param timePoint - * the timePoint from which get all {@link ISequenceNode} - * including it in their range + * the timePoint from which get all {@link ISequenceNode} including it in their range * - * @return the set of {@link ISequenceNode} having timePoint in their range, - * sorted by range from lower to upper + * @return the set of {@link ISequenceNode} having timePoint in their range, sorted by range from lower to upper */ public Set<ISequenceNode> getAllSequenceNodesOn(int timePoint) { - Preconditions.checkNotNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); + Objects.requireNonNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); Preconditions.checkArgument(timePoint > 0, Messages.SequenceDiagramQuery_invalidTimePoint); Set<ISequenceNode> sequenceNodeUnders = new TreeSet<ISequenceNode>(new RangeComparator()); @@ -257,17 +246,16 @@ public class SequenceDiagramQuery { } /** - * Get all {@link ISequenceNode} of the current {@link SequenceDiagram} with - * range's lowerbound strictly upper to timePoint. + * Get all {@link ISequenceNode} of the current {@link SequenceDiagram} with range's lowerbound strictly upper to + * timePoint. * * @param timePoint * the timePoint from which get all upper {@link ISequenceNode} * - * @return the set of {@link ISequenceNode} upper timePoint, sorted by range - * from lower to upper + * @return the set of {@link ISequenceNode} upper timePoint, sorted by range from lower to upper */ public Set<ISequenceNode> getAllSequenceNodesUpperThan(int timePoint) { - Preconditions.checkNotNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); + Objects.requireNonNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); Preconditions.checkArgument(timePoint > 0, Messages.SequenceDiagramQuery_invalidTimePoint); Set<ISequenceNode> sequenceNodeUnders = new TreeSet<ISequenceNode>(new RangeComparator()); @@ -283,11 +271,11 @@ public class SequenceDiagramQuery { /** * Get all {@link ISequenceNode} of the current {@link SequenceDiagram}. * - * @return the set of {@link ISequenceNode} of the current - * {@link SequenceDiagram}, sorted by range from lower to upper + * @return the set of {@link ISequenceNode} of the current {@link SequenceDiagram}, sorted by range from lower to + * upper */ public Set<ISequenceNode> getAllSequenceNodes() { - Preconditions.checkNotNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); + Objects.requireNonNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); Set<ISequenceNode> allSequenceNodes = new TreeSet<ISequenceNode>(new RangeComparator()); allSequenceNodes.addAll(sequenceDiagram.getAllInstanceRoles()); @@ -301,16 +289,14 @@ public class SequenceDiagramQuery { } /** - * Get the initial time from which event ends can graphically start. This - * initial time corresponds to y coordinate of the bottom of the biggest - * InstanceRole not connected to a Create message + + * Get the initial time from which event ends can graphically start. This initial time corresponds to y coordinate + * of the bottom of the biggest InstanceRole not connected to a Create message + * {@link LayoutConstants#TIME_START_OFFSET}. * - * @return the initial time if the current {@link SequenceDiagram} contains - * {@link Lifeline}, 0 else + * @return the initial time if the current {@link SequenceDiagram} contains {@link Lifeline}, 0 else */ public int getInitialTime() { - Preconditions.checkNotNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); + Objects.requireNonNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); int initialTime = 0; for (Lifeline lifeline : sequenceDiagram.getAllLifelines()) { int initialTimeCandidate = lifeline.getVerticalRange().getLowerBound(); @@ -322,15 +308,13 @@ public class SequenceDiagramQuery { } /** - * Get the final time until which event ends can graphically end. This final - * time corresponds to y coordinate of the bottom of {@link Lifeline} - - * {@link LayoutConstants#TIME_STOP_OFFSET}. + * Get the final time until which event ends can graphically end. This final time corresponds to y coordinate of the + * bottom of {@link Lifeline} - {@link LayoutConstants#TIME_STOP_OFFSET}. * - * @return the final time if the current {@link SequenceDiagram} contains - * {@link Lifeline}, 0 else + * @return the final time if the current {@link SequenceDiagram} contains {@link Lifeline}, 0 else */ public int getFinalTime() { - Preconditions.checkNotNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); + Objects.requireNonNull(sequenceDiagram, Messages.SequenceDiagramQuery_nullSequenceDiagram); int finalTime = 0; if (!sequenceDiagram.getAllLifelines().isEmpty()) { Lifeline lifeline = sequenceDiagram.getAllLifelines().iterator().next(); diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/SequenceMessageViewQuery.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/SequenceMessageViewQuery.java index 2f004904fc..c0b9dc8db9 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/SequenceMessageViewQuery.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/SequenceMessageViewQuery.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -19,6 +19,7 @@ import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.RelativeBendpoints; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.VerticalRangeFunction; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceElement; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceElementAccessor; @@ -26,7 +27,6 @@ import org.eclipse.sirius.diagram.sequence.business.internal.elements.Lifeline; import org.eclipse.sirius.diagram.sequence.business.internal.elements.Message; import org.eclipse.sirius.diagram.sequence.business.internal.layout.LayoutConstants; import org.eclipse.sirius.diagram.sequence.business.internal.util.CacheHelper; -import org.eclipse.sirius.diagram.sequence.util.Range; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.base.Options; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/SequenceNodeQuery.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/SequenceNodeQuery.java index d3ccab68f6..110a6ae356 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/SequenceNodeQuery.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/SequenceNodeQuery.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -20,12 +20,12 @@ import org.eclipse.sirius.diagram.DDiagramElement; import org.eclipse.sirius.diagram.DNode; import org.eclipse.sirius.diagram.DNodeContainer; import org.eclipse.sirius.diagram.WorkspaceImage; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractNodeEvent; import org.eclipse.sirius.diagram.sequence.business.internal.elements.EndOfLife; import org.eclipse.sirius.diagram.sequence.business.internal.elements.Lifeline; import org.eclipse.sirius.diagram.sequence.business.internal.util.CacheHelper; import org.eclipse.sirius.diagram.sequence.business.internal.util.DecreasingRange; -import org.eclipse.sirius.diagram.sequence.util.Range; import org.eclipse.sirius.diagram.ui.business.internal.query.DNodeQuery; import org.eclipse.sirius.diagram.ui.internal.refresh.GMFHelper; import org.eclipse.sirius.diagram.ui.tools.api.graphical.edit.styles.IBorderItemOffsets; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/refresh/FixBendpointsOnCreationCommand.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/refresh/FixBendpointsOnCreationCommand.java index 57205064fc..e2f4ae107d 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/refresh/FixBendpointsOnCreationCommand.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/refresh/FixBendpointsOnCreationCommand.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -158,8 +158,8 @@ public class FixBendpointsOnCreationCommand extends RecordingCommand { if (sourceDNode.eContainer() instanceof AbstractDNode) { AbstractDNode parentDNode = (AbstractDNode) sourceDNode.eContainer(); if (parentDNode.getOwnedBorderedNodes().contains(sourceDNode)) { - sourceBounds.y += IBorderItemOffsets.DEFAULT_OFFSET.height; - sourceBounds.height += 5; + sourceBounds.setY(sourceBounds.y + IBorderItemOffsets.DEFAULT_OFFSET.height); + sourceBounds.setHeight(sourceBounds.height + 5); } } LayoutData sourceLayoutData = null; @@ -188,8 +188,8 @@ public class FixBendpointsOnCreationCommand extends RecordingCommand { if (targetDNode.eContainer() instanceof AbstractDNode) { AbstractDNode parentDNode = (AbstractDNode) targetDNode.eContainer(); if (parentDNode.getOwnedBorderedNodes().contains(targetDNode)) { - targetBounds.y += IBorderItemOffsets.DEFAULT_OFFSET.height; - targetBounds.height += 5; + targetBounds.setY(targetBounds.y + IBorderItemOffsets.DEFAULT_OFFSET.height); + targetBounds.setHeight(targetBounds.height + 5); } } LayoutData targetLayoutData = null; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/refresh/RefreshLayoutCommand.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/refresh/RefreshLayoutCommand.java index 7fdf5f8ac3..433c024301 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/refresh/RefreshLayoutCommand.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/refresh/RefreshLayoutCommand.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2020 THALES GLOBAL SERVICES and others. + * Copyright (c) 2011, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -17,7 +17,6 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.sirius.common.tools.DslCommonPlugin; import org.eclipse.sirius.common.tools.api.profiler.ProfilerTask; -import org.eclipse.sirius.diagram.sequence.Messages; import org.eclipse.sirius.diagram.sequence.SequenceDDiagram; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceElementAccessor; import org.eclipse.sirius.diagram.sequence.business.internal.elements.SequenceDiagram; @@ -27,6 +26,7 @@ import org.eclipse.sirius.diagram.sequence.business.internal.operation.Synchroni import org.eclipse.sirius.diagram.sequence.business.internal.ordering.RefreshOrderingHelper; import org.eclipse.sirius.diagram.sequence.business.internal.util.CacheHelper; import org.eclipse.sirius.diagram.sequence.ordering.EventEnd; +import org.eclipse.sirius.diagram.sequence.tool.internal.Messages; import org.eclipse.sirius.diagram.ui.business.internal.operation.AbstractModelChangeOperation; import org.eclipse.sirius.ecore.extender.business.api.permission.IPermissionAuthority; import org.eclipse.sirius.ecore.extender.business.api.permission.PermissionAuthorityRegistry; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/refresh/SequenceCanonicalSynchronizerAdapter.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/refresh/SequenceCanonicalSynchronizerAdapter.java index f102bd150a..0aa917c90d 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/refresh/SequenceCanonicalSynchronizerAdapter.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/refresh/SequenceCanonicalSynchronizerAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -43,6 +43,7 @@ import org.eclipse.sirius.diagram.DDiagramElement; import org.eclipse.sirius.diagram.DiagramPackage; import org.eclipse.sirius.diagram.business.api.query.DDiagramElementQuery; import org.eclipse.sirius.diagram.sequence.SequenceDDiagram; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.VerticalPositionFunction; import org.eclipse.sirius.diagram.sequence.business.internal.elements.CombinedFragment; import org.eclipse.sirius.diagram.sequence.business.internal.elements.Execution; @@ -58,7 +59,6 @@ import org.eclipse.sirius.diagram.sequence.business.internal.query.ISequenceElem import org.eclipse.sirius.diagram.sequence.business.internal.query.RangeComparator; import org.eclipse.sirius.diagram.sequence.business.internal.query.SequenceDiagramQuery; import org.eclipse.sirius.diagram.sequence.ordering.EventEnd; -import org.eclipse.sirius.diagram.sequence.util.Range; import org.eclipse.sirius.diagram.ui.business.api.view.SiriusLayoutDataManager; import org.eclipse.sirius.diagram.ui.business.internal.view.LayoutData; import org.eclipse.sirius.diagram.ui.internal.refresh.listeners.FilterListener; @@ -71,9 +71,8 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Sets; /** - * {@link ModelChangeTrigger} which return a {@link Command} to be executed just - * a SynchronizeGMFModelCommand to correct y location of execution (Node) and - * bendpoints of message (Edge). + * {@link ModelChangeTrigger} which return a {@link Command} to be executed just a SynchronizeGMFModelCommand to correct + * y location of execution (Node) and bendpoints of message (Edge). * * @author edugueperoux */ @@ -85,11 +84,11 @@ public class SequenceCanonicalSynchronizerAdapter implements ModelChangeTrigger public static final int SEQUENCE_CANONICAL_REFRESH_PRIORITY = FilterListener.COMPOSITE_FILTER_REFRESH_PRIORITY + 1; /** - * Overridden to return a Command to adapt CanonicalSynchronizer work for - * sequence. + * Overridden to return a Command to adapt CanonicalSynchronizer work for sequence. * * {@inheritDoc} */ + @Override public Option<Command> localChangesAboutToCommit(Collection<Notification> notifications) { Option<Command> result; CompoundCommand compoundCommand = new CompoundCommand(); @@ -250,9 +249,8 @@ public class SequenceCanonicalSynchronizerAdapter implements ModelChangeTrigger } /* - * Simple Execution creation implies that GMF Node at creation have a - * LayoutConstants.DEFAULT_EXECUTION_HEIGHT as minimum height and tries to - * take the maximum available space up to the next event. + * Simple Execution creation implies that GMF Node at creation have a LayoutConstants.DEFAULT_EXECUTION_HEIGHT as + * minimum height and tries to take the maximum available space up to the next event. */ private void expandSimpleExecution(Node newNode, Command fixSequenceNodeLowerBoundCmd, TransactionalEditingDomain domain, int y) { Option<Execution> execOption = ISequenceElementAccessor.getExecution(newNode); @@ -346,12 +344,12 @@ public class SequenceCanonicalSynchronizerAdapter implements ModelChangeTrigger } /** - * Overridden to specify a priority upper than - * {@link CollapseFilterListener#COLLAPSE_FILTER_REFRESH_PRIORITY} to be + * Overridden to specify a priority upper than {@link CollapseFilterListener#COLLAPSE_FILTER_REFRESH_PRIORITY} to be * executed after it. * * {@inheritDoc} */ + @Override public int priority() { return SEQUENCE_CANONICAL_REFRESH_PRIORITY; } diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/tool/ToolCommandBuilder.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/tool/ToolCommandBuilder.java index 59ae223f35..27632540e0 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/tool/ToolCommandBuilder.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/tool/ToolCommandBuilder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 THALES GLOBAL SERVICES. + * Copyright (c) 2012, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -64,19 +64,18 @@ import org.eclipse.sirius.diagram.sequence.ordering.SingleEventEnd; import org.eclipse.sirius.diagram.tools.internal.command.builders.NodeCreationCommandBuilder; import org.eclipse.sirius.diagram.ui.tools.internal.commands.emf.EMFCommandFactoryUI; import org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor; +import org.eclipse.sirius.tools.api.SiriusPlugin; import org.eclipse.sirius.tools.api.command.SiriusCommand; import org.eclipse.sirius.tools.api.interpreter.InterpreterUtil; import org.eclipse.sirius.tools.internal.command.builders.CommandBuilder; import org.eclipse.sirius.viewpoint.DSemanticDecorator; -import org.eclipse.sirius.viewpoint.SiriusPlugin; import org.eclipse.sirius.viewpoint.description.AbstractVariable; import org.eclipse.sirius.viewpoint.description.tool.PaneBasedSelectionWizardDescription; import org.eclipse.sirius.viewpoint.description.tool.SelectionWizardDescription; import org.eclipse.sirius.viewpoint.description.tool.ToolDescription; /** - * Helper class to build the concrete commands executing the user-specified - * tools on specific parameters. + * Helper class to build the concrete commands executing the user-specified tools on specific parameters. * * @author pcdavid */ @@ -87,8 +86,7 @@ public final class ToolCommandBuilder { } /** - * Builds the command which will execute the user-tasks specified operations - * to reorder an event. + * Builds the command which will execute the user-tasks specified operations to reorder an event. * * @param sequenceDDiagram * the DRepresentation to use for the ModelOperations @@ -97,13 +95,10 @@ public final class ToolCommandBuilder { * @param event * the semantic element of the event which was moved. * @param startingEndPredecessor - * the event end immediately preceding the reordered event's - * starting end after the move. + * the event end immediately preceding the reordered event's starting end after the move. * @param finishingEndPredecessor - * the event end immediately preceding the reordered event's - * finishing end after the move. - * @return a command which executes the user-specified operations with the - * appropriate variables set. + * the event end immediately preceding the reordered event's finishing end after the move. + * @return a command which executes the user-specified operations with the appropriate variables set. */ public static SiriusCommand buildReorderCommand(SequenceDDiagram sequenceDDiagram, ReorderTool reorderTool, EObject event, EventEnd startingEndPredecessor, EventEnd finishingEndPredecessor) { ModelAccessor modelAccessor = SiriusPlugin.getDefault().getModelAccessorRegistry().getModelAccessor(event); @@ -127,8 +122,7 @@ public final class ToolCommandBuilder { } /** - * Builds the command which will execute the user-tasks specified operations - * to reorder an instance role. + * Builds the command which will execute the user-tasks specified operations to reorder an instance role. * * @param sequenceDDiagram * the DRepresentation to use for the ModelOperations @@ -137,15 +131,12 @@ public final class ToolCommandBuilder { * @param element * the semantic element of the instance role which was moved. * @param predecessorBefore - * the semantic element corresponding to the instance role - * immediately preceding the reordered instance role before the - * move. + * the semantic element corresponding to the instance role immediately preceding the reordered instance + * role before the move. * @param predecessorAfter - * the semantic element corresponding to the instance role - * immediately preceding the reordered instance role after the - * move. - * @return a command which executes the user-specified operations with the - * appropriate variables set. + * the semantic element corresponding to the instance role immediately preceding the reordered instance + * role after the move. + * @return a command which executes the user-specified operations with the appropriate variables set. */ public static SiriusCommand buildInstanceRoleReorderCommand(SequenceDDiagram sequenceDDiagram, InstanceRoleReorderTool reorderTool, EObject element, EObject predecessorBefore, EObject predecessorAfter) { @@ -169,8 +160,7 @@ public final class ToolCommandBuilder { } /** - * Builds the command which will execute the user-specified operations to - * create a new message. + * Builds the command which will execute the user-specified operations to create a new message. * * @param source * the source of the new message to create. @@ -179,13 +169,11 @@ public final class ToolCommandBuilder { * @param tool * the tool to use to create the message. * @param startingEndBefore - * the event end which precedes graphically the source location - * of the new message, to be used by the tool do decide where to - * insert the message in the semantic model. + * the event end which precedes graphically the source location of the new message, to be used by the + * tool do decide where to insert the message in the semantic model. * @param finishingEndBefore - * the event end which precedes graphically the target location - * of the new message, to be used by the tool do decide where to - * insert the message in the semantic model. + * the event end which precedes graphically the target location of the new message, to be used by the + * tool do decide where to insert the message in the semantic model. * @return a command to create the message. */ public static Command buildCreateMessageCommand(final EdgeTarget source, final EdgeTarget target, final MessageCreationTool tool, final EventEnd startingEndBefore, @@ -209,16 +197,15 @@ public final class ToolCommandBuilder { } /** - * Builds the command which will execute the user-specified operations to - * create a new instance role. + * Builds the command which will execute the user-specified operations to create a new instance role. * * @param diagram * the sequence diagram on which to create the new instance role. * @param tool * the tool to use to create the instance role. * @param predecessor - * the semantic element corresponding to the instance role - * graphically preceding the x location of the new instance role. + * the semantic element corresponding to the instance role graphically preceding the x location of the + * new instance role. * @param location * the clicked location. * @return a command to create the instance role. @@ -229,19 +216,16 @@ public final class ToolCommandBuilder { } /** - * Builds the command which will execute the user-specified operations to - * create a new execution. + * Builds the command which will execute the user-specified operations to create a new execution. * * @param node * the node on which to create the new execution. * @param tool * the tool to use to create the execution. * @param startingEndPredecessor - * the event end graphically preceding the starting position of - * the new execution. + * the event end graphically preceding the starting position of the new execution. * @param finishingEndPredecessor - * the event end graphically preceding the finishing position of - * the new execution. + * the event end graphically preceding the finishing position of the new execution. * @param location * the clicked location. * @return a command to create the execution. @@ -254,19 +238,16 @@ public final class ToolCommandBuilder { } /** - * Builds the command which will execute the user-specified operations to - * create a new observation point. + * Builds the command which will execute the user-specified operations to create a new observation point. * * @param diagramElement * the clicked diagram element. * @param tool * the tool to use to create the execution. * @param startingEndPredecessor - * the event end graphically preceding the starting position of - * the new execution. + * the event end graphically preceding the starting position of the new execution. * @param finishingEndPredecessor - * the event end graphically preceding the finishing position of - * the new execution. + * the event end graphically preceding the finishing position of the new execution. * @return a command to create the execution. */ public static Command buildCreateObservationPointCommandFromTool(final DDiagramElement diagramElement, final ObservationPointCreationTool tool, final EventEnd startingEndPredecessor, @@ -277,19 +258,16 @@ public final class ToolCommandBuilder { } /** - * Builds the command which will execute the user-specified operations to - * create a new observation point. + * Builds the command which will execute the user-specified operations to create a new observation point. * * @param diagram * the diagram on which to create the new execution. * @param tool * the tool to use to create the execution. * @param startingEndPredecessor - * the event end graphically preceding the starting position of - * the new execution. + * the event end graphically preceding the starting position of the new execution. * @param finishingEndPredecessor - * the event end graphically preceding the finishing position of - * the new execution. + * the event end graphically preceding the finishing position of the new execution. * @return a command to create the execution. */ public static Command buildCreateObservationPointCommandFromTool(final DDiagram diagram, final ObservationPointCreationTool tool, final EventEnd startingEndPredecessor, @@ -299,19 +277,16 @@ public final class ToolCommandBuilder { } /** - * Builds the command which will execute the user-specified operations to - * create a new state. + * Builds the command which will execute the user-specified operations to create a new state. * * @param node * the node on which to create the new state. * @param tool * the tool to use to create the state. * @param startingEndPredecessor - * the event end graphically preceding the starting position of - * the new state. + * the event end graphically preceding the starting position of the new state. * @param finishingEndPredecessor - * the event end graphically preceding the finishing position of - * the new state. + * the event end graphically preceding the finishing position of the new state. * @return a command to create the state. */ public static Command buildCreateStateCommandFromTool(final DNode node, final StateCreationTool tool, final EventEnd startingEndPredecessor, final EventEnd finishingEndPredecessor) { @@ -321,22 +296,18 @@ public final class ToolCommandBuilder { } /** - * Builds the command which will execute the user-specified operations to - * create a new interaction use. + * Builds the command which will execute the user-specified operations to create a new interaction use. * * @param diagram * the diagram on which to create the new IU. * @param tool * the tool to use to create the IU. * @param startingEndPredecessor - * the event end graphically preceding the starting position of - * the new IU. + * the event end graphically preceding the starting position of the new IU. * @param finishingEndPredecessor - * the event end graphically preceding the finishing position of - * the new IU. + * the event end graphically preceding the finishing position of the new IU. * @param coverage - * the semantic elements representing the lifelines graphically - * covered by the initial area of the IU. + * the semantic elements representing the lifelines graphically covered by the initial area of the IU. * @return a command to create the IU. */ public static Command buildCreateInteractionUseCommandFromTool(DDiagram diagram, InteractionUseCreationTool tool, EventEnd startingEndPredecessor, EventEnd finishingEndPredecessor, @@ -345,22 +316,18 @@ public final class ToolCommandBuilder { } /** - * Builds the command which will execute the user-specified operations to - * create a new combined fragment. + * Builds the command which will execute the user-specified operations to create a new combined fragment. * * @param diagram * the diagram on which to create the new CF. * @param tool * the tool to use to create the CF. * @param startingEndPredecessor - * the event end graphically preceding the starting position of - * the new CF. + * the event end graphically preceding the starting position of the new CF. * @param finishingEndPredecessor - * the event end graphically preceding the finishing position of - * the new CF. + * the event end graphically preceding the finishing position of the new CF. * @param coverage - * the semantic elements representing the lifelines graphically - * covered by the initial area of the CF. + * the semantic elements representing the lifelines graphically covered by the initial area of the CF. * @return a command to create the CF. */ public static Command buildCreateCombinedFragmentCommandFromTool(DDiagram diagram, CombinedFragmentCreationTool tool, EventEnd startingEndPredecessor, EventEnd finishingEndPredecessor, @@ -369,22 +336,18 @@ public final class ToolCommandBuilder { } /** - * Builds the command which will execute the user-specified operations to - * create a new combined fragment. + * Builds the command which will execute the user-specified operations to create a new combined fragment. * * @param diagram * the diagram on which to create the new execution. * @param tool * the tool to use to create the combined fragment. * @param startingEndPredecessor - * the event end graphically preceding the starting position of - * the new CF. + * the event end graphically preceding the starting position of the new CF. * @param finishingEndPredecessor - * the event end graphically preceding the finishing position of - * the new CF. + * the event end graphically preceding the finishing position of the new CF. * @param coverage - * the semantic elements representing the lifelines graphically - * covered by the initial area of the CF. + * the semantic elements representing the lifelines graphically covered by the initial area of the CF. * @return a command to create the execution. */ private static Command buildCreateFrameCommandFromTool(DDiagram diagram, final ContainerCreationDescription tool, final EventEnd startingEndPredecessor, final EventEnd finishingEndPredecessor, @@ -394,19 +357,16 @@ public final class ToolCommandBuilder { } /** - * Builds the command which will execute the user-specified operations to - * create a new operand. + * Builds the command which will execute the user-specified operations to create a new operand. * * @param nodeContainer * the container in which to create the operand. * @param tool * the tool to use to create the operand. * @param startingEndPredecessor - * the event end graphically preceding the starting position of - * the new Operand. + * the event end graphically preceding the starting position of the new Operand. * @param finishingEndPredecessor - * the event end graphically preceding the finishing position of - * the new Operand. + * the event end graphically preceding the finishing position of the new Operand. * @return a command to create the execution. */ public static org.eclipse.emf.common.command.Command buildCreateOperantCommandFromTool(DDiagramElementContainer nodeContainer, final OperandCreationTool tool, @@ -417,15 +377,13 @@ public final class ToolCommandBuilder { } /** - * Check if startingEndPredecessor is a starting {@link EventEnd} of - * {@link CombinedFragment}. + * Check if startingEndPredecessor is a starting {@link EventEnd} of {@link CombinedFragment}. * * @param sequenceDiagram * the {@link SequenceDiagram} on which checks the property * @param startingEndPredecessor * the {@link EventEnd} to evaluate - * @return true if startingEndPredecessor is a starting {@link EventEnd} of - * {@link CombinedFragment} + * @return true if startingEndPredecessor is a starting {@link EventEnd} of {@link CombinedFragment} */ public static boolean isStartingEventEndOfCombinedFragment(SequenceDiagram sequenceDiagram, EventEnd startingEndPredecessor) { if (sequenceDiagram != null && startingEndPredecessor instanceof SingleEventEnd && ((SingleEventEnd) startingEndPredecessor).isStart()) { @@ -436,8 +394,7 @@ public final class ToolCommandBuilder { } /** - * Builds the command which will execute the user-specified operations with - * a generic tool. + * Builds the command which will execute the user-specified operations with a generic tool. * * @param containerView * the clicked diagram element. @@ -457,8 +414,7 @@ public final class ToolCommandBuilder { } /** - * Builds the command which will execute the user-specified operations with - * a pane based selection tool. + * Builds the command which will execute the user-specified operations with a pane based selection tool. * * @param tool * the pane based selection tool. @@ -480,8 +436,7 @@ public final class ToolCommandBuilder { } /** - * Builds the command which will execute the user-specified operations with - * a selection tool. + * Builds the command which will execute the user-specified operations with a selection tool. * * @param tool * the selection tool. diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/CacheHelper.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/CacheHelper.java index b7d8340ba3..0ec7929935 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/CacheHelper.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/CacheHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020 2021 THALES GLOBAL SERVICES. + * Copyright (c) 2020, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -19,6 +19,7 @@ import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractFrame; import org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractNodeEvent; import org.eclipse.sirius.diagram.sequence.business.internal.elements.CombinedFragment; @@ -27,7 +28,6 @@ import org.eclipse.sirius.diagram.sequence.business.internal.elements.Lifeline; import org.eclipse.sirius.diagram.sequence.business.internal.elements.Message; import org.eclipse.sirius.diagram.sequence.business.internal.elements.Operand; import org.eclipse.sirius.diagram.sequence.ordering.SingleEventEnd; -import org.eclipse.sirius.diagram.sequence.util.Range; import org.eclipse.sirius.ext.base.Option; /** diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/DecreasingRange.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/DecreasingRange.java index 1242cddcbe..23c666bc09 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/DecreasingRange.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/DecreasingRange.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019 THALES GLOBAL SERVICES and others. + * Copyright (c) 2019, 2021 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -12,7 +12,7 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.sequence.business.internal.util; -import org.eclipse.sirius.diagram.sequence.util.Range; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; /** * Specific {@link Range} accepting decreasing range (lower is superior to upper). diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/EventFinder.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/EventFinder.java index 08446db456..d95552dca0 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/EventFinder.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/EventFinder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -19,12 +19,12 @@ import java.util.Map; import java.util.Map.Entry; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractNodeEvent; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceElementAccessor; import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceEvent; import org.eclipse.sirius.diagram.sequence.business.internal.elements.Lifeline; import org.eclipse.sirius.diagram.sequence.business.internal.elements.Message; -import org.eclipse.sirius.diagram.sequence.util.Range; import org.eclipse.sirius.ext.base.Option; import com.google.common.base.Function; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/ParentOperandFinder.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/ParentOperandFinder.java index 0e09018785..6bb0917986 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/ParentOperandFinder.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/ParentOperandFinder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -16,8 +16,10 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.Set; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractNodeEvent; import org.eclipse.sirius.diagram.sequence.business.internal.elements.CombinedFragment; import org.eclipse.sirius.diagram.sequence.business.internal.elements.Execution; @@ -28,7 +30,6 @@ import org.eclipse.sirius.diagram.sequence.business.internal.elements.Message; import org.eclipse.sirius.diagram.sequence.business.internal.elements.Operand; import org.eclipse.sirius.diagram.sequence.business.internal.elements.SequenceDiagram; import org.eclipse.sirius.diagram.sequence.business.internal.elements.State; -import org.eclipse.sirius.diagram.sequence.util.Range; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.base.Options; @@ -65,12 +66,11 @@ public final class ParentOperandFinder { * Default constructor. * * @param event - * a supported {@link ISequenceEvent} : {@linkLifeline}, - * {@link AbstractNodeEvent}, {@link Operand}. + * a supported {@link ISequenceEvent} : {@linkLifeline}, {@link AbstractNodeEvent}, {@link Operand}. */ public ParentOperandFinder(ISequenceEvent event) { Preconditions.checkArgument(types.contains(event.getClass())); - Preconditions.checkNotNull(event); + Objects.requireNonNull(event); this.event = event; } @@ -78,14 +78,13 @@ public final class ParentOperandFinder { * Default constructor. * * @param event - * a supported {@link ISequenceEvent} : {@linkLifeline}, - * {@link AbstractNodeEvent}, {@link Operand}. + * a supported {@link ISequenceEvent} : {@linkLifeline}, {@link AbstractNodeEvent}, {@link Operand}. * @param rangeFunction * function to compute expected range. */ public ParentOperandFinder(ISequenceEvent event, Function<ISequenceEvent, Range> rangeFunction) { this(event); - Preconditions.checkNotNull(rangeFunction); + Objects.requireNonNull(rangeFunction); this.rangeFunction = rangeFunction; } @@ -117,6 +116,7 @@ public final class ParentOperandFinder { Predicate<Operand> coveredLifeline = new Predicate<Operand>() { // Filter the operands that cover the execution parent lifeline + @Override public boolean apply(Operand input) { CombinedFragment parentCombinedFragment = input.getCombinedFragment(); Collection<Lifeline> computeCoveredLifelines = combinedFragmentToCoveredLifelines.get(parentCombinedFragment); @@ -131,6 +131,7 @@ public final class ParentOperandFinder { Predicate<Operand> includingExecutionRange = new Predicate<Operand>() { // Filter the operands having a range that contains the execution // range (we consider the insertion point : lowerbound of range) + @Override public boolean apply(Operand input) { return rangeFunction.apply(input).includes(new Range(verticalRange.getLowerBound(), verticalRange.getLowerBound())); // return rangeFunction.apply(input).includes(verticalRange); diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/RangeSetter.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/RangeSetter.java index 899781fe2e..1713205cd6 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/RangeSetter.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/RangeSetter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -24,6 +24,7 @@ import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.RelativeBendpoints; import org.eclipse.gmf.runtime.notation.Size; import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractNodeEvent; import org.eclipse.sirius.diagram.sequence.business.internal.elements.CombinedFragment; import org.eclipse.sirius.diagram.sequence.business.internal.elements.EndOfLife; @@ -37,7 +38,6 @@ import org.eclipse.sirius.diagram.sequence.business.internal.elements.Operand; import org.eclipse.sirius.diagram.sequence.business.internal.elements.State; import org.eclipse.sirius.diagram.sequence.business.internal.query.SequenceMessageViewQuery; import org.eclipse.sirius.diagram.sequence.business.internal.query.SequenceNodeQuery; -import org.eclipse.sirius.diagram.sequence.util.Range; import org.eclipse.sirius.ext.base.Option; import com.google.common.collect.Iterables; diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/SubEventsHelper.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/SubEventsHelper.java index 7f91c02c9b..022a3f3e5f 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/SubEventsHelper.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/SubEventsHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -18,9 +18,11 @@ import java.util.Collections; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; +import java.util.Objects; import java.util.Set; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.sirius.diagram.sequence.business.api.util.Range; import org.eclipse.sirius.diagram.sequence.business.internal.RangeHelper; import org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractFrame; import org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractNodeEvent; @@ -36,7 +38,6 @@ import org.eclipse.sirius.diagram.sequence.business.internal.elements.SequenceDi import org.eclipse.sirius.diagram.sequence.business.internal.elements.State; import org.eclipse.sirius.diagram.sequence.business.internal.ordering.EventEndHelper; import org.eclipse.sirius.diagram.sequence.business.internal.query.ISequenceEventQuery; -import org.eclipse.sirius.diagram.sequence.util.Range; import org.eclipse.sirius.ext.base.Option; import com.google.common.base.Preconditions; @@ -77,7 +78,7 @@ public final class SubEventsHelper { */ public SubEventsHelper(ISequenceEvent event) { Preconditions.checkArgument(types.contains(event.getClass())); - Preconditions.checkNotNull(event); + Objects.requireNonNull(event); this.parentEvent = event; this.parentRange = event.getVerticalRange(); } @@ -224,7 +225,7 @@ public final class SubEventsHelper { for (AbstractFrame frame : frames) { Range frameRange = frame.getVerticalRange(); - if (parentRange.includes(frameRange) && validCoverage(frame, coveredLifelines)) { + if (frameRange != null && parentRange.includes(frameRange) && validCoverage(frame, coveredLifelines)) { childrenEvents.add(frame); } } |