diff options
| author | Laurent Redor | 2020-06-12 17:23:17 +0000 |
|---|---|---|
| committer | Laurent Redor | 2020-06-17 06:36:39 +0000 |
| commit | 126a6f65e8cede0906d8f82bebf9d6d04e4ce4c3 (patch) | |
| tree | 1ffcd7ff037bf332cce9aa3d784a80fe89bff538 | |
| parent | ef4799894bbb8f5849968f2d3f01f71d36226303 (diff) | |
| download | org.eclipse.sirius-126a6f65e8cede0906d8f82bebf9d6d04e4ce4c3.tar.gz org.eclipse.sirius-126a6f65e8cede0906d8f82bebf9d6d04e4ce4c3.tar.xz org.eclipse.sirius-126a6f65e8cede0906d8f82bebf9d6d04e4ce4c3.zip | |
[564239] Draw combined fragment labels on a OVERLAY layer so that
they are always readable
This commit makes the approach of bug 564239 [1] more generic. It is now
also used by the CombinedFragmentEditPart (through the
GradientRoundedRectangle with the field useOverlayLabel set to true) and
not only OperandEditPart (through the OperandFigure).
Even if DDiagramRootEditPart#OVERLAY_LAYER, OverlayLabelsDrawerFigure
and OverlayLabel are used only in sequence diagrams, these classes are
available in standard diagram code for potential further usages.
You can have a look to commit bbac9a8b [2] for details of the initial
implementation.
[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=560543
[2] https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=bbac9a8b4dbffb277db91cd3991fbc0683e2c141
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=564239
Change-Id: I09b2f7280d821d841b9eac67271121519147ec39
Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
12 files changed, 207 insertions, 74 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/part/CombinedFragmentEditPart.java b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/part/CombinedFragmentEditPart.java index 391d6c8908..e4d4ab8c73 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/part/CombinedFragmentEditPart.java +++ b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/part/CombinedFragmentEditPart.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2020 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 @@ -42,6 +42,7 @@ public class CombinedFragmentEditPart extends DNodeContainerEditPart implements */ public CombinedFragmentEditPart(View view) { super(view); + setUseOverlayLabel(true); } @Override @@ -57,8 +58,7 @@ public class CombinedFragmentEditPart extends DNodeContainerEditPart implements } /** - * Overridden to install a specific edit policy managing the moving and - * resizing requests on combined fragment. + * Overridden to install a specific edit policy managing the moving and resizing requests on combined fragment. * <p> * {@inheritDoc} */ diff --git a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/part/SequenceDiagramEditPart.java b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/part/SequenceDiagramEditPart.java index cd4fa602f6..94875168ef 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/part/SequenceDiagramEditPart.java +++ b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/part/SequenceDiagramEditPart.java @@ -43,11 +43,12 @@ import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.operation.Execu import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.operation.SequenceEditPartsOperations; import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.policy.SequenceContainerCreationPolicy; import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.policy.SequenceLaunchToolEditPolicy; -import org.eclipse.sirius.diagram.sequence.ui.tool.internal.figure.LabelsOverlayFigure; import org.eclipse.sirius.diagram.sequence.ui.tool.internal.layout.SequenceZOrderingRefresher; import org.eclipse.sirius.diagram.tools.api.command.IDiagramCommandFactory; import org.eclipse.sirius.diagram.tools.api.command.IDiagramCommandFactoryProvider; import org.eclipse.sirius.diagram.ui.graphical.edit.policies.ContainerCreationEditPolicy; +import org.eclipse.sirius.diagram.ui.graphical.figures.OverlayLabelsDrawerFigure; +import org.eclipse.sirius.diagram.ui.graphical.figures.OverlayLabel; import org.eclipse.sirius.diagram.ui.internal.edit.parts.DDiagramEditPart; import org.eclipse.sirius.diagram.ui.tools.api.editor.DDiagramEditor; import org.eclipse.sirius.diagram.ui.tools.api.properties.PropertiesService; @@ -67,8 +68,8 @@ import com.google.common.collect.Iterables; */ public class SequenceDiagramEditPart extends DDiagramEditPart { /** - * The listener in charge with refreshing the graphical ordering and layout - * when the model and/or graphics positions change. + * The listener in charge with refreshing the graphical ordering and layout when the model and/or graphics positions + * change. */ private final VisibilityEventHandler semanticOrderingSynchronizer; @@ -92,8 +93,13 @@ public class SequenceDiagramEditPart extends DDiagramEditPart { }; private IPropertyChangeListener snapDisabler; - - private IFigure labelsOverlayFigure; + + /** + * A "virtual" figure added to the {@link DDiagramRootEditPart#OVERLAY_LAYER} to paint all the overlay labels + * (instance of {@link OverlayLabel}) on top of the rest of the diagram to make sure they are always readable. In + * sequence diagram overlay labels are labels of {@link OperandEditPart} and of {@link CombinedFragmentEditPart}. + */ + private IFigure overlayLabelsDrawerFigure; /** * Constructor. @@ -186,10 +192,8 @@ public class SequenceDiagramEditPart extends DDiagramEditPart { } } /* - * Once the diagram (and all its children) is active, refresh the - * various ordering. This is especially needed when creating/opening a - * diagram as some commands need a properly initialized graphically - * ordering to work. + * Once the diagram (and all its children) is active, refresh the various ordering. This is especially needed + * when creating/opening a diagram as some commands need a properly initialized graphically ordering to work. */ boolean autoRefresh = PropertiesService.getInstance().getPropertiesProvider().getProperty(IPropertiesProvider.KEY_AUTO_REFRESH); boolean refreshOnOpen = DialectUIManager.INSTANCE.isRefreshActivatedOnRepresentationOpening(); @@ -209,14 +213,14 @@ public class SequenceDiagramEditPart extends DDiagramEditPart { sequenceCanonicalSynchronizer = new SequenceCanonicalSynchronizerAdapter(); sessionEventBroker.addLocalTrigger(SessionEventBrokerImpl.asFilter(sequenceCanonicalSynchronizerLayoutScope), sequenceCanonicalSynchronizer); } - + IFigure overlayLayer = getLayer(DDiagramRootEditPart.OVERLAY_LAYER); if (overlayLayer != null) { - this.labelsOverlayFigure = new LabelsOverlayFigure(this.getFigure(), this); - overlayLayer.add(this.labelsOverlayFigure); + this.overlayLabelsDrawerFigure = new OverlayLabelsDrawerFigure(this.getFigure(), this); + overlayLayer.add(this.overlayLabelsDrawerFigure); } } - + private Option<SessionEventBroker> getSessionBroker() { DDiagramEditor diagramEditor = (DDiagramEditor) this.getViewer().getProperty(DDiagramEditor.EDITOR_ID); if (diagramEditor != null) { @@ -258,9 +262,9 @@ public class SequenceDiagramEditPart extends DDiagramEditPart { snapDisabler = null; } IFigure overlayLayer = getLayer(DDiagramRootEditPart.OVERLAY_LAYER); - if (labelsOverlayFigure != null && overlayLayer != null) { - overlayLayer.remove(labelsOverlayFigure); - labelsOverlayFigure = null; + if (overlayLabelsDrawerFigure != null && overlayLayer != null) { + overlayLayer.remove(overlayLabelsDrawerFigure); + overlayLabelsDrawerFigure = null; } getEditingDomain().removeResourceSetListener(refreshZorder); diff --git a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/figure/OperandFigure.java b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/figure/OperandFigure.java index 2e5157f7b9..3370aa8c0a 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/figure/OperandFigure.java +++ b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/figure/OperandFigure.java @@ -18,6 +18,7 @@ import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.sirius.diagram.BackgroundStyle; import org.eclipse.sirius.diagram.sequence.business.internal.elements.Operand; import org.eclipse.sirius.diagram.sequence.business.internal.layout.LayoutConstants; +import org.eclipse.sirius.diagram.ui.graphical.figures.OverlayLabel; import org.eclipse.sirius.diagram.ui.tools.api.figure.GradientRoundedRectangle; import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.LifelineNodeFigure; import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.OneLineMarginBorder; @@ -78,13 +79,13 @@ public class OperandFigure extends GradientRoundedRectangle { super.paintBorder(graphics); } } - + /** * Create the content of the figure. */ @Override protected void createContents() { - fLabelFigure = new OperandLabel(this.view); + fLabelFigure = new OverlayLabel(this.view); fLabelFigure.setText(" "); //$NON-NLS-1$ fLabelFigure.setTextWrap(true); this.add(fLabelFigure); diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramElementContainerEditPart.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramElementContainerEditPart.java index 3c5e514b2c..a049a66e39 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramElementContainerEditPart.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramElementContainerEditPart.java @@ -73,6 +73,8 @@ import org.eclipse.sirius.diagram.ui.edit.internal.part.AbstractDiagramNodeEditP import org.eclipse.sirius.diagram.ui.edit.internal.part.DiagramContainerEditPartOperation; import org.eclipse.sirius.diagram.ui.edit.internal.part.DiagramElementEditPartOperation; import org.eclipse.sirius.diagram.ui.edit.internal.validators.ResizeValidator; +import org.eclipse.sirius.diagram.ui.graphical.figures.OverlayLabelsDrawerFigure; +import org.eclipse.sirius.diagram.ui.graphical.figures.OverlayLabel; import org.eclipse.sirius.diagram.ui.internal.edit.parts.AbstractDiagramElementContainerNameEditPart; import org.eclipse.sirius.diagram.ui.internal.edit.parts.DNode4EditPart; import org.eclipse.sirius.diagram.ui.internal.edit.policies.NonResizableAndNonDuplicableEditPolicy; @@ -125,6 +127,12 @@ public abstract class AbstractDiagramElementContainerEditPart extends AbstractBo private Dimension intialDefaultSize; /** + * Indicates if an {@link OverlayLabel} must be used for the figure of this edit part (see javadoc of + * {@link OverlayLabelsDrawerFigure} to see how this kind of figure is managed). + */ + private boolean useOverlayLabel; + + /** * Creates a new Container edit part. * * @param view @@ -499,10 +507,10 @@ public abstract class AbstractDiagramElementContainerEditPart extends AbstractBo if (shapeFigure == null) { if (isRegion()) { shapeFigure = new RegionRoundedGradientRectangle(DiagramContainerEditPartOperation.getCornerDimension(this), DiagramContainerEditPartOperation.getBackgroundStyle(this), - (View) getModel()); + (View) getModel(), useOverlayLabel()); } else { shapeFigure = new GradientRoundedRectangle(DiagramContainerEditPartOperation.getCornerDimension(this), DiagramContainerEditPartOperation.getBackgroundStyle(this).getValue(), - (View) getModel()); + (View) getModel(), useOverlayLabel()); } } @@ -920,4 +928,24 @@ public abstract class AbstractDiagramElementContainerEditPart extends AbstractBo // Update drop shadow. mainFigure.setBorder(tmpFigure.getBorder()); } + + /** + * Return true is an overlay label must be used for the figure of this edit part, false otherwise. + * + * @return the useOverlayLabel status + */ + protected boolean useOverlayLabel() { + return useOverlayLabel; + } + + /** + * Indicate if an overlay label must be used for the figure of this edit part. + * + * @param useOverlayLabel + * the useOverlayLabel to set + */ + protected void setUseOverlayLabel(boolean useOverlayLabel) { + this.useOverlayLabel = useOverlayLabel; + } + } diff --git a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/figure/OperandLabel.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/figures/OverlayLabel.java index 0df5ac303b..455c2c5455 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/figure/OperandLabel.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/figures/OverlayLabel.java @@ -10,7 +10,7 @@ * Contributors: * Obeo - initial API and implementation *******************************************************************************/ -package org.eclipse.sirius.diagram.sequence.ui.tool.internal.figure; +package org.eclipse.sirius.diagram.ui.graphical.figures; import java.util.concurrent.atomic.AtomicBoolean; @@ -20,11 +20,11 @@ import org.eclipse.sirius.diagram.ui.business.internal.view.ShowingViewUtil; import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.SiriusWrapLabel; /** - * A special label that can be painted or not depending on the current context/layer. + * A special label that can be painted or not, on the OVERLAY layer, depending on the current context/layer. * * @author pcdavid */ -public final class OperandLabel extends SiriusWrapLabel { +public final class OverlayLabel extends SiriusWrapLabel { /** * Flag to control whether the labels should really be painted or not. @@ -39,7 +39,7 @@ public final class OperandLabel extends SiriusWrapLabel { * @param view * the view. */ - public OperandLabel(View view) { + public OverlayLabel(View view) { this.view = view; } diff --git a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/figure/LabelsOverlayFigure.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/figures/OverlayLabelsDrawerFigure.java index 4edc9160d0..46d0e67c15 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/figure/LabelsOverlayFigure.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/figures/OverlayLabelsDrawerFigure.java @@ -10,7 +10,7 @@ * Contributors: * Obeo - initial API and implementation *******************************************************************************/ -package org.eclipse.sirius.diagram.sequence.ui.tool.internal.figure; +package org.eclipse.sirius.diagram.ui.graphical.figures; import java.util.Objects; @@ -26,11 +26,13 @@ import org.eclipse.sirius.ext.gmf.runtime.editparts.GraphicalHelper; /** * A "virtual" figure that should be added to the {@link DDiagramRootEditPart#OVERLAY_LAYER} and which paints all the - * operand labels on top of the rest of the diagram to make sure they are always readable. + * overlay labels (instance of {@link OverlayLabel}) on top of the rest of the diagram to make sure they are always + * readable.<BR> + * This figure is currently only used by sequence diagrams. * * @author pcdavid */ -public final class LabelsOverlayFigure extends Figure { +public final class OverlayLabelsDrawerFigure extends Figure { private final IFigure root; @@ -40,12 +42,12 @@ public final class LabelsOverlayFigure extends Figure { * Constructor. * * @param root - * the root figure of the diagram. + * the root figure of the diagram. * @param part * the diagram edit part. This is needed to obtain zoom/scroll information to adjust paint coordinates * correctly. */ - public LabelsOverlayFigure(IFigure root, IGraphicalEditPart part) { + public OverlayLabelsDrawerFigure(IFigure root, IGraphicalEditPart part) { this.root = Objects.requireNonNull(root); this.part = Objects.requireNonNull(part); } @@ -63,16 +65,16 @@ public final class LabelsOverlayFigure extends Figure { @Override public void paint(Graphics graphics) { try { - OperandLabel.PAINT_ENABLED.set(true); + OverlayLabel.PAINT_ENABLED.set(true); paintLabels(graphics, root); } finally { - OperandLabel.PAINT_ENABLED.set(false); + OverlayLabel.PAINT_ENABLED.set(false); } } private void paintLabels(Graphics graphics, IFigure figure) { - if (figure instanceof OperandLabel) { - paintOperandLabel(graphics, (OperandLabel) figure); + if (figure instanceof OverlayLabel) { + paintOverlayLabel(graphics, (OverlayLabel) figure); } else { for (Object child : figure.getChildren()) { paintLabels(graphics, (IFigure) child); @@ -80,7 +82,7 @@ public final class LabelsOverlayFigure extends Figure { } } - private void paintOperandLabel(Graphics graphics, OperandLabel label) { + private void paintOverlayLabel(Graphics graphics, OverlayLabel label) { Rectangle bounds = label.getBounds(); Point delta = bounds.getTopLeft().getCopy(); diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/GradientRoundedRectangle.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/GradientRoundedRectangle.java index a10ffcec85..f7edfab133 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/GradientRoundedRectangle.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/GradientRoundedRectangle.java @@ -19,6 +19,8 @@ import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.ui.business.internal.view.ShowingViewUtil; +import org.eclipse.sirius.diagram.ui.graphical.figures.OverlayLabel; +import org.eclipse.sirius.diagram.ui.graphical.figures.OverlayLabelsDrawerFigure; import org.eclipse.sirius.ext.draw2d.figure.IRoundedCorner; import org.eclipse.sirius.ext.draw2d.figure.ViewGradientFigureDesc; import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.IContainerLabelOffsets; @@ -39,7 +41,7 @@ public class GradientRoundedRectangle extends RoundedRectangle implements ViewNo * The label. */ protected SiriusWrapLabel fLabelFigure; - + /** * The GMF view. */ @@ -49,6 +51,8 @@ public class GradientRoundedRectangle extends RoundedRectangle implements ViewNo private int backgroundStyle; + private boolean useOverlayLabel; + /** * Create a new {@link GradientRoundedRectangle}. * @@ -58,10 +62,14 @@ public class GradientRoundedRectangle extends RoundedRectangle implements ViewNo * style of the wanted gradient * @param view * the model view of the part showing the figure. + * @param useOverlayLabel + * true to use an {@link OverlayLabel} as label, false otherwise (see javadoc of + * {@link OverlayLabelsDrawerFigure} to see how this kind of figure is managed). */ - public GradientRoundedRectangle(final Dimension dimension, final int backgroundStyle, View view) { + public GradientRoundedRectangle(final Dimension dimension, final int backgroundStyle, View view, boolean useOverlayLabel) { this.view = view; this.backgroundStyle = backgroundStyle; + this.useOverlayLabel = useOverlayLabel; this.setCornerDimensions(new Dimension(MapModeUtil.getMapMode().DPtoLP(dimension.width), MapModeUtil.getMapMode().DPtoLP(dimension.height))); createBorder(); createContents(); @@ -70,6 +78,20 @@ public class GradientRoundedRectangle extends RoundedRectangle implements ViewNo /** * Create a new {@link GradientRoundedRectangle}. * + * @param dimension + * dimension of the corner (with radius, height radius) + * @param backgroundStyle + * style of the wanted gradient + * @param view + * the model view of the part showing the figure. + */ + public GradientRoundedRectangle(final Dimension dimension, final int backgroundStyle, View view) { + this(dimension, backgroundStyle, view, false); + } + + /** + * Create a new {@link GradientRoundedRectangle}. + * * @param view * the model view of the part showing the figure. */ @@ -117,22 +139,26 @@ public class GradientRoundedRectangle extends RoundedRectangle implements ViewNo * Create the content of the figure. */ protected void createContents() { - fLabelFigure = new SiriusWrapLabel() { - @Override - public void paint(Graphics graphics) { - if (view != null) { - ShowingViewUtil.initGraphicsForVisibleAndInvisibleElements(this, graphics, view); - try { + if (useOverlayLabel) { + fLabelFigure = new OverlayLabel(view); + } else { + fLabelFigure = new SiriusWrapLabel() { + @Override + public void paint(Graphics graphics) { + if (view != null) { + ShowingViewUtil.initGraphicsForVisibleAndInvisibleElements(this, graphics, view); + try { + super.paint(graphics); + graphics.restoreState(); + } finally { + graphics.popState(); + } + } else { super.paint(graphics); - graphics.restoreState(); - } finally { - graphics.popState(); } - } else { - super.paint(graphics); } - } - }; + }; + } fLabelFigure.setText(" "); //$NON-NLS-1$ fLabelFigure.setTextWrap(true); this.add(fLabelFigure); @@ -174,6 +200,7 @@ public class GradientRoundedRectangle extends RoundedRectangle implements ViewNo * * @see ViewGradientFigureDesc#getBackgroundStyle() */ + @Override public int getBackgroundStyle() { return backgroundStyle; } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/figure/RegionRoundedGradientRectangle.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/figure/RegionRoundedGradientRectangle.java index bd8a168c4f..1bce78a6ee 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/figure/RegionRoundedGradientRectangle.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/figure/RegionRoundedGradientRectangle.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2018 Obeo. + * Copyright (c) 2015, 2020 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 @@ -20,6 +20,8 @@ import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.BackgroundStyle; +import org.eclipse.sirius.diagram.ui.graphical.figures.OverlayLabelsDrawerFigure; +import org.eclipse.sirius.diagram.ui.graphical.figures.OverlayLabel; import org.eclipse.sirius.diagram.ui.tools.api.figure.GradientRoundedRectangle; /** @@ -52,13 +54,30 @@ public class RegionRoundedGradientRectangle extends GradientRoundedRectangle { * style of the wanted gradient * @param view * the model view of the part showing the figure. + * @param useOverlayLabel + * true to use an {@link OverlayLabel} as label, false otherwise (see javadoc of + * {@link OverlayLabelsDrawerFigure} to see how this kind of figure is managed). */ - public RegionRoundedGradientRectangle(final Dimension dimension, final BackgroundStyle backgroundStyle, View view) { - super(dimension, backgroundStyle.getValue(), view); + public RegionRoundedGradientRectangle(final Dimension dimension, final BackgroundStyle backgroundStyle, View view, boolean useOverlayLabel) { + super(dimension, backgroundStyle.getValue(), view, true); setOutline(false); } /** + * Create a new {@link RegionRoundedGradientRectangle}. + * + * @param dimension + * dimension of the corner (with radius, height radius) + * @param backgroundStyle + * style of the wanted gradient + * @param view + * the model view of the part showing the figure. + */ + public RegionRoundedGradientRectangle(final Dimension dimension, final BackgroundStyle backgroundStyle, View view) { + this(dimension, backgroundStyle, view, false); + } + + /** * The outline of the shape is disabled for regions which have a specific border figure. */ @Override diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html index 6851caa724..fd2ebbd65e 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html @@ -18,6 +18,9 @@ <li> <a href="#UserVisibleChanges">User-Visible Changes</a> </li> + <li> + <a href="#DeveloperVisibleChanges">Developer-Visible Changes</a> + </li> </ol> </li> <li> @@ -27,7 +30,7 @@ <a href="#UserVisibleChanges2">User-Visible Changes</a> </li> <li> - <a href="#DeveloperVisibleChanges">Developer-Visible Changes</a> + <a href="#DeveloperVisibleChanges2">Developer-Visible Changes</a> </li> </ol> </li> @@ -41,7 +44,7 @@ <a href="#SpecifierVisibleChanges">Specifier-Visible Changes</a> </li> <li> - <a href="#DeveloperVisibleChanges2">Developer-Visible Changes</a> + <a href="#DeveloperVisibleChanges3">Developer-Visible Changes</a> </li> </ol> </li> @@ -52,7 +55,7 @@ <a href="#sirius6.2.1">Changes in Sirius 6.2.1</a> <ol style="list-style: disc;"> <li> - <a href="#DeveloperVisibleChanges3">Developer-Visible Changes</a> + <a href="#DeveloperVisibleChanges4">Developer-Visible Changes</a> </li> </ol> </li> @@ -66,7 +69,7 @@ <a href="#SpecifierVisibleChanges2">Specifier-Visible Changes</a> </li> <li> - <a href="#DeveloperVisibleChanges4">Developer-Visible Changes</a> + <a href="#DeveloperVisibleChanges5">Developer-Visible Changes</a> </li> </ol> </li> @@ -77,7 +80,7 @@ <a href="#UserVisibleChanges5">User-Visible Changes</a> </li> <li> - <a href="#DeveloperVisibleChanges5">Developer-Visible Changes</a> + <a href="#DeveloperVisibleChanges6">Developer-Visible Changes</a> </li> </ol> </li> @@ -99,7 +102,7 @@ <a href="#SpecifierVisibleChanges3">Specifier-Visible Changes</a> </li> <li> - <a href="#DeveloperVisibleChanges6">Developer-Visible Changes</a> + <a href="#DeveloperVisibleChanges7">Developer-Visible Changes</a> </li> </ol> </li> @@ -113,7 +116,7 @@ <a href="#SpecifierVisibleChanges4">Specifier-Visible Changes</a> </li> <li> - <a href="#DeveloperVisibleChanges7">Developer-Visible Changes</a> + <a href="#DeveloperVisibleChanges8">Developer-Visible Changes</a> </li> </ol> </li> @@ -131,6 +134,39 @@ </li> </ul> <p>A consequence is that the display of existing compartments in diagrams may be changed. When refreshing the existing diagram, the project may become dirty.</p> + <ul> + <li><span class="label label-info">Modified</span> In Sirius 6.3.1, the behavior for the labels of operands, in sequence diagrams, has been changed. Since Sirius 6.3.1, they are drawn on top of the rest of the diagram elements so that they are always completely visible. Since Sirius 6.3.2, this is now the same for labels of combined fragment. Indeed, the problem was the same:</li> + </ul> + <img border="0" src="images/combined_fragment_label_before.png"/> With Sirius 6.3.2, the label is now on the top of execution: + <img border="0" src="images/combined_fragment_label_after.png"/> + <h3 id="DeveloperVisibleChanges">Developer-Visible Changes</h3> + <h4 id="Changesinorg.eclipse.sirius.diagram.ui">Changes in + <code>org.eclipse.sirius.diagram.ui</code> + </h4> + <ul> + <li><span class="label label-success">Added</span>The class + <code>org.eclipse.sirius.diagram.ui.graphical.figures.OverlayLabelsDrawerFigure</code> is a “virtual” figure that should be added to the + <code>DDiagramRootEditPart#OVERLAY_LAYER</code> and which paints all the overlay labels (instance of + <code>OverlayLabel</code>) on top of the rest of the diagram to make sure they are always readable. This figure is currently only used by sequence diagrams for operand labels( + <code>org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.part.OperandEditPart</code>) and combined fragment labels ( + <code>org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.part.CombinedFragmentEditPart</code>). + </li> + <li><span class="label label-success">Added</span> The class + <code>org.eclipse.sirius.diagram.ui.graphical.figures.OverlayLabel</code> is a special label that can be painted or not, on the OVERLAY layer, depending on the current context/layer. + </li> + <li><span class="label label-success">Added</span> A new field, + <code>useOverlayLabel</code>, has been added in + <code>org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramElementContainerEditPart</code>. Its value can be changed with + <code>setUseOverlayLabel(boolean)</code> and accessed through + <code>useOverlayLabel()</code>. This new field allows to use an + <code>OverlayLabel</code> for the figure of this edit part. + </li> + <li><span class="label label-success">Added</span> A new constructor has been added for class + <code>org.eclipse.sirius.diagram.ui.tools.api.figure.GradientRoundedRectangle</code> to allow the use of + <code>OverlayLabel</code> for this kind of figure ( + <code>GradientRoundedRectangle(Dimension, int, View, boolean)</code>). + </li> + </ul> <h2 id="sirius6.3.1">Changes in Sirius 6.3.1</h2> <h3 id="UserVisibleChanges2">User-Visible Changes</h3> <ul> @@ -148,7 +184,7 @@ <ul> <li><span class="label label-danger">Removed</span> The feature concerning the capability to move labels on border of node, or border node, all around the node, added in 6.3.0, has been reverted. There are unexpected side effects (wrong location after a rename of a label for example).</li> </ul> - <h3 id="DeveloperVisibleChanges">Developer-Visible Changes</h3> + <h3 id="DeveloperVisibleChanges2">Developer-Visible Changes</h3> <ul> <li><span class="label label-info">Modified</span> Upgraded ELK version from 0.5.0 to 0.6.1, see the <a href="https://projects.eclipse.org/projects/modeling.elk/releases/0.6.1">ELK documentation</a> for the list of changes in that version (and previous). @@ -229,7 +265,7 @@ <code>Type</code>. </li> </ul> - <h3 id="DeveloperVisibleChanges2">Developer-Visible Changes</h3> + <h3 id="DeveloperVisibleChanges3">Developer-Visible Changes</h3> <ul> <li><span class="label label-info">Modified</span> Upgraded ELK version from 0.4.1 to 0.5.0, see the <a href="https://projects.eclipse.org/projects/modeling.elk/releases/0.5.0" target="_blank">ELK documentation</a> for the list of changes in that version.</li> <li><span class="label label-info">Modified</span> Upgraded EEF version from 2.1.2 to 2.1.3 (which contains a single bugfix, for <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=550436" target="_blank">#550436</a>).</li> @@ -367,7 +403,7 @@ <h2 id="sirius6.2.2">Changes in Sirius 6.2.2</h2> <p>There are no user-visible changes in Sirius 6.2.2 compared to 6.2.1. The only changes are internal and related either to the build process or to the automated tests.</p> <h2 id="sirius6.2.1">Changes in Sirius 6.2.1</h2> - <h3 id="DeveloperVisibleChanges3">Developer-Visible Changes</h3> + <h3 id="DeveloperVisibleChanges4">Developer-Visible Changes</h3> <h4 id="Changesinorg.eclipse.sirius2">Changes in <code>org.eclipse.sirius</code> </h4> @@ -395,7 +431,7 @@ <code>org.eclipse.sirius.business.api.helper.task.NotificationTask</code> class has been removed. It was not used anywhere. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.diagram.ui">Changes in + <h4 id="Changesinorg.eclipse.sirius.diagram.ui2">Changes in <code>org.eclipse.sirius.diagram.ui</code> </h4> <ul> @@ -442,7 +478,7 @@ <a href="specifier/diagrams/Diagrams.html#group">corresponding documentation</a> . </li> </ul> - <h3 id="DeveloperVisibleChanges4">Developer-Visible Changes</h3> + <h3 id="DeveloperVisibleChanges5">Developer-Visible Changes</h3> <h4 id="Changesinorg.eclipse.sirius.common2">Changes in <code>org.eclipse.sirius.common</code> </h4> @@ -720,7 +756,7 @@ </ul> </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.diagram.ui2">Changes in + <h4 id="Changesinorg.eclipse.sirius.diagram.ui3">Changes in <code>org.eclipse.sirius.diagram.ui</code> </h4> <ul> @@ -819,7 +855,7 @@ <em>Delete</em>. It was previously the case only for representations which semantic target does not exist anymore. </li> </ul> - <h3 id="DeveloperVisibleChanges5">Developer-Visible Changes</h3> + <h3 id="DeveloperVisibleChanges6">Developer-Visible Changes</h3> <ul> <li><span class="label label-success">Added</span> If the <code>org.eclipse.sirius.diagam.ui.hidePrintingOfPermissionAuthorityDecoration</code> system property is set to true and if there is no other printable decoration provided at the same location (South-West), the permission authority decorations displayed on diagrams are not printed nor exported in images (export as image actions). @@ -838,7 +874,7 @@ <code>DRepresentationDescriptor.repPath</code> can not be found) or can not by retrieved. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.diagram.ui3">Changes in + <h4 id="Changesinorg.eclipse.sirius.diagram.ui4">Changes in <code>org.eclipse.sirius.diagram.ui</code> </h4> <ul> @@ -970,7 +1006,7 @@ <a href="specifier/tables/Tables.html#edition_tables">the documentation</a> for details. </li> </ul> - <h3 id="DeveloperVisibleChanges6">Developer-Visible Changes</h3> + <h3 id="DeveloperVisibleChanges7">Developer-Visible Changes</h3> <p><span class="label label-info">IMPORTANT</span> Note that all plug-ins in the <em>Sirius Server</em> feature ( <code>org.eclipse.sirius.server.*</code> and @@ -1022,7 +1058,7 @@ <code>org.eclipse.sirius.ui.business.api.preferences.SiriusUIPreferencesKeys.PREF_DISPLAY_VSM_USER_FIXED_COLOR_IN_PALETTE</code> has been added. Its default value is true. It allows to display, in the color palette, the user fixed color(defined in the activated viewpoints) in addition to standard colors. The color palette is available in Appearance tab of the Properties view. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.diagram.ui4">Changes in + <h4 id="Changesinorg.eclipse.sirius.diagram.ui5">Changes in <code>org.eclipse.sirius.diagram.ui</code> </h4> <ul> @@ -1287,7 +1323,7 @@ <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=531487">bugzilla 531487</a> for more details. </li> </ul> - <h3 id="DeveloperVisibleChanges7">Developer-Visible Changes</h3> + <h3 id="DeveloperVisibleChanges8">Developer-Visible Changes</h3> <ul> <li><span class="label label-info">Modified</span> The SWTBot test framework version has been upgraded toward SWTBot 2.6. The main impacts are described below: <ul> @@ -1419,7 +1455,7 @@ <code>org.eclipse.sirius.diagram.tools.api.managment</code> </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.diagram.ui5">Changes in + <h4 id="Changesinorg.eclipse.sirius.diagram.ui6">Changes in <code>org.eclipse.sirius.diagram.ui</code> </h4> <ul> diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile index 3a2ca9faa2..c69d3f1933 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile @@ -10,6 +10,22 @@ h3. User-Visible Changes * <span class="label label-info">Modified</span> In diagrams, the display of the label of the compartments has been improved. When there is not enough space to display the label of the compartment container or the contained compartments, it is displayed on multiple lines. Refer to "Compartment section":user/diagrams/Diagrams.html#Compartments for more information. A consequence is that the display of existing compartments in diagrams may be changed. When refreshing the existing diagram, the project may become dirty. +* <span class="label label-info">Modified</span> In Sirius 6.3.1, the behavior for the labels of operands, in sequence diagrams, has been changed. Since Sirius 6.3.1, they are drawn on top of the rest of the diagram elements so that they are always completely visible. Since Sirius 6.3.2, this is now the same for labels of combined fragment. Indeed, the problem was the same: + + !images/combined_fragment_label_before.png! + + With Sirius 6.3.2, the label is now on the top of execution: + + !images/combined_fragment_label_after.png! + +h3. Developer-Visible Changes + +h4. Changes in @org.eclipse.sirius.diagram.ui@ + +* <span class="label label-success">Added</span>The class @org.eclipse.sirius.diagram.ui.graphical.figures.OverlayLabelsDrawerFigure@ is a "virtual" figure that should be added to the @DDiagramRootEditPart#OVERLAY_LAYER@ and which paints all the overlay labels (instance of @OverlayLabel@) on top of the rest of the diagram to make sure they are always readable. This figure is currently only used by sequence diagrams for operand labels(@org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.part.OperandEditPart@) and combined fragment labels (@org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.part.CombinedFragmentEditPart@). +* <span class="label label-success">Added</span> The class @org.eclipse.sirius.diagram.ui.graphical.figures.OverlayLabel@ is a special label that can be painted or not, on the OVERLAY layer, depending on the current context/layer. +* <span class="label label-success">Added</span> A new field, @useOverlayLabel@, has been added in @org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramElementContainerEditPart@. Its value can be changed with @setUseOverlayLabel(boolean)@ and accessed through @useOverlayLabel()@. This new field allows to use an @OverlayLabel@ for the figure of this edit part. +* <span class="label label-success">Added</span> A new constructor has been added for class @org.eclipse.sirius.diagram.ui.tools.api.figure.GradientRoundedRectangle@ to allow the use of @OverlayLabel@ for this kind of figure (@GradientRoundedRectangle(Dimension, int, View, boolean)@). h2(#sirius6.3.1). Changes in Sirius 6.3.1 diff --git a/plugins/org.eclipse.sirius.doc/doc/images/combined_fragment_label_after.png b/plugins/org.eclipse.sirius.doc/doc/images/combined_fragment_label_after.png Binary files differnew file mode 100644 index 0000000000..e9d532048d --- /dev/null +++ b/plugins/org.eclipse.sirius.doc/doc/images/combined_fragment_label_after.png diff --git a/plugins/org.eclipse.sirius.doc/doc/images/combined_fragment_label_before.png b/plugins/org.eclipse.sirius.doc/doc/images/combined_fragment_label_before.png Binary files differnew file mode 100644 index 0000000000..7f7667129f --- /dev/null +++ b/plugins/org.eclipse.sirius.doc/doc/images/combined_fragment_label_before.png |
