diff options
author | Laurent Fasani | 2019-05-06 10:07:06 +0000 |
---|---|---|
committer | Laurent Fasani | 2019-05-06 10:16:51 +0000 |
commit | 24b5612325c635295324542b3cd01cea3ec0244b (patch) | |
tree | 4faead3eb1f0fe62975fb1602e3e3ab2a6745d38 | |
parent | 0d6da74d305d51781dc86edebd2e0440fa0903ab (diff) | |
download | org.eclipse.sirius-24b5612325c635295324542b3cd01cea3ec0244b.tar.gz org.eclipse.sirius-24b5612325c635295324542b3cd01cea3ec0244b.tar.xz org.eclipse.sirius-24b5612325c635295324542b3cd01cea3ec0244b.zip |
Bug: 545122
Change-Id: I48a3432ef1721259ff47004112fed57270ef4349
Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
3 files changed, 30 insertions, 27 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/view/factories/DEdgeBeginNameViewFactory.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/view/factories/DEdgeBeginNameViewFactory.java index a7e24afd45..90a09fb9f6 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/view/factories/DEdgeBeginNameViewFactory.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/view/factories/DEdgeBeginNameViewFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2019 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 @@ -52,6 +52,7 @@ public class DEdgeBeginNameViewFactory extends AbstractLabelViewFactory { /** * @not-generated */ + @Override public View createView(final IAdaptable semanticAdapter, final View containerView, final String semanticHint, final int index, final boolean persisted, final PreferencesHint preferencesHint) { final Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint); final Location location = (Location) view.getLayoutConstraint(); @@ -60,15 +61,14 @@ public class DEdgeBeginNameViewFactory extends AbstractLabelViewFactory { view.setVisible(!new DDiagramElementQuery(dEdge).isLabelHidden()); final EdgeLabelLayoutData data = SiriusLayoutDataManager.INSTANCE.getLabelData(dEdge); - int x; - int y; - if (data == null) { - x = mapMode.DPtoLP(0); - y = mapMode.DPtoLP(10); - } else { + int x = mapMode.DPtoLP(0); + int y = mapMode.DPtoLP(10); + if (data != null) { final Point labelLocation = data.getLocation(); - x = labelLocation.x; - y = labelLocation.y; + if (labelLocation != null) { + x = labelLocation.x; + y = labelLocation.y; + } final Rectangle labelBounds = data.getLabelBounds(); if (labelBounds != null && location instanceof Bounds) { ((Bounds) location).setWidth(labelBounds.width); @@ -84,6 +84,7 @@ public class DEdgeBeginNameViewFactory extends AbstractLabelViewFactory { /** * @was-generated */ + @Override protected List<?> createStyles(final View view) { return new ArrayList<>(); } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/view/factories/DEdgeEndNameViewFactory.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/view/factories/DEdgeEndNameViewFactory.java index 4cb44e344e..310141de33 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/view/factories/DEdgeEndNameViewFactory.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/view/factories/DEdgeEndNameViewFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2019 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 @@ -52,6 +52,7 @@ public class DEdgeEndNameViewFactory extends AbstractLabelViewFactory { /** * @not-generated */ + @Override public View createView(final IAdaptable semanticAdapter, final View containerView, final String semanticHint, final int index, final boolean persisted, final PreferencesHint preferencesHint) { final Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint); final Location location = (Location) view.getLayoutConstraint(); @@ -60,15 +61,14 @@ public class DEdgeEndNameViewFactory extends AbstractLabelViewFactory { view.setVisible(!new DDiagramElementQuery(dEdge).isLabelHidden()); final EdgeLabelLayoutData data = SiriusLayoutDataManager.INSTANCE.getLabelData(dEdge); - int x; - int y; - if (data == null) { - x = mapMode.DPtoLP(0); - y = mapMode.DPtoLP(10); - } else { + int x = mapMode.DPtoLP(0); + int y = mapMode.DPtoLP(10); + if (data != null) { final Point labelLocation = data.getLocation(); - x = labelLocation.x; - y = labelLocation.y; + if (labelLocation != null) { + x = labelLocation.x; + y = labelLocation.y; + } final Rectangle labelBounds = data.getLabelBounds(); if (labelBounds != null && location instanceof Bounds) { ((Bounds) location).setWidth(labelBounds.width); @@ -84,6 +84,7 @@ public class DEdgeEndNameViewFactory extends AbstractLabelViewFactory { /** * @was-generated */ + @Override protected List<?> createStyles(final View view) { return new ArrayList<>(); } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/view/factories/DEdgeNameViewFactory.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/view/factories/DEdgeNameViewFactory.java index b623941dc6..f0b3cde630 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/view/factories/DEdgeNameViewFactory.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/view/factories/DEdgeNameViewFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2019 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 @@ -52,6 +52,7 @@ public class DEdgeNameViewFactory extends AbstractLabelViewFactory { /** * @not-generated */ + @Override public View createView(final IAdaptable semanticAdapter, final View containerView, final String semanticHint, final int index, final boolean persisted, final PreferencesHint preferencesHint) { final Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint); final Location location = (Location) view.getLayoutConstraint(); @@ -60,15 +61,14 @@ public class DEdgeNameViewFactory extends AbstractLabelViewFactory { view.setVisible(!new DDiagramElementQuery(dEdge).isLabelHidden()); final EdgeLabelLayoutData data = SiriusLayoutDataManager.INSTANCE.getLabelData(dEdge); - int x; - int y; - if (data == null) { - x = mapMode.DPtoLP(0); - y = mapMode.DPtoLP(-10); - } else { + int x = mapMode.DPtoLP(0); + int y = mapMode.DPtoLP(-10); + if (data != null) { final Point labelLocation = data.getLocation(); - x = labelLocation.x; - y = labelLocation.y; + if (labelLocation != null) { + x = labelLocation.x; + y = labelLocation.y; + } final Rectangle labelBounds = data.getLabelBounds(); if (labelBounds != null && location instanceof Bounds) { ((Bounds) location).setWidth(labelBounds.width); @@ -84,6 +84,7 @@ public class DEdgeNameViewFactory extends AbstractLabelViewFactory { /** * @was-generated */ + @Override protected List<?> createStyles(final View view) { return new ArrayList<>(); } |