diff options
author | Asma Smaoui | 2018-03-09 13:46:57 +0000 |
---|---|---|
committer | Ansgar Radermacher | 2018-03-09 14:51:48 +0000 |
commit | c24fe36ff2ed08b048885e68a698dfa5a8f94878 (patch) | |
tree | 479f9d514dd5905faf52ed2fc462d34063b02ee1 /plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus | |
parent | 0dac77dfab1dd890604fd0d47a26eed191c79d1f (diff) | |
download | org.eclipse.papyrus-c24fe36ff2ed08b048885e68a698dfa5a8f94878.tar.gz org.eclipse.papyrus-c24fe36ff2ed08b048885e68a698dfa5a8f94878.tar.xz org.eclipse.papyrus-c24fe36ff2ed08b048885e68a698dfa5a8f94878.zip |
Bug 527181 - [Composite structure diagram] Initial port location on a
part is top-left corner
- Add possibility to override the initial port poisition in
ShowHidecontentsAction
- Create a custom port position for the composite-structure diagram that
locates
the diagram for the defining type (if any) and copies port positions
from there. Based
on similar code in PapyrusRT
- Add a new edit policy "CompositeSideAffixedNodesCreation".
Change-Id: If3c62f78ea1f2373a610f78260d317174ca4ca12
Signed-off-by: Asma Smaoui <asma.smaoui@cea.fr>
Diffstat (limited to 'plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus')
3 files changed, 34 insertions, 9 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusDiagramEditPart.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusDiagramEditPart.java index cdd6a6aa30f..9810d54c940 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusDiagramEditPart.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusDiagramEditPart.java @@ -86,7 +86,7 @@ public class PapyrusDiagramEditPart extends DiagramEditPart { IMultiDiagramEditor multiDiagramEditor = ServiceUtilsForEditPart.getInstance().getService(IMultiDiagramEditor.class, this); activeEditor = multiDiagramEditor.getActiveEditor(); } catch (ServiceException e) { - //Ignore: the IMultiDiagramEditor may not be present in headless mode + Activator.log.error(e); } ((IRefreshHandlerPart) SVGPostProcessor.instance).refresh(activeEditor); } diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PreferencesConstantsHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PreferencesConstantsHelper.java index 9c4dff238b2..65390b83014 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PreferencesConstantsHelper.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PreferencesConstantsHelper.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2013, 2018 CEA LIST. + * Copyright (c) 2013 CEA LIST. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -10,7 +10,6 @@ * * CEA LIST - Initial API and implementation * Fanch Bonnabesse (ALL4TEC) fanch.bonnabesse@alltec.net - Bug 419357 - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Bug 531055 * *****************************************************************************/ package org.eclipse.papyrus.infra.gmfdiag.common.preferences; @@ -24,7 +23,7 @@ import org.eclipse.gmf.runtime.diagram.ui.internal.properties.WorkspaceViewerPro * A class that defines the available preference type available through Papyrus. * </p> * <p> - * It defines the following type (and more): + * It defines the following type: * </p> * <ul> * <li>COLOR_FILL</li> @@ -461,10 +460,7 @@ public class PreferencesConstantsHelper { break; case EXTERNAL_REFERENCE_STRATEGY: sb.append(EXTERNAL_REFERENCE_STRATEGY_CONSTANT); - break; - case DRAW_CONNECTION_POINT: - sb.append(DRAW_CONNECTION_POINT_CONSTANT); - break; + break; default: break; } diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramEditPartsUtil.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramEditPartsUtil.java index 0fe3a81a4c0..7d459582a9b 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramEditPartsUtil.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramEditPartsUtil.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2012, 2016 CEA LIST, Christian W. Damus, and others. + * Copyright (c) 2012, 2016, 2017 CEA LIST, Christian W. Damus, and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -10,6 +10,7 @@ * CEA LIST - Initial API and implementation * Christian W. Damus - bugs 433206, 473148, 485220 * Vincent Lorenzo - bug 492522 + * Ansgar Radermacher - bug 527181 *****************************************************************************/ package org.eclipse.papyrus.infra.gmfdiag.common.utils; @@ -1057,4 +1058,32 @@ public class DiagramEditPartsUtil { } return null; } + + /** + * Gets the diagram on the given {@code context} matching a particular + * {@code filter} condition. + * + * @param context + * a diagram context (its {@link View#getElement() element}) + * @param filter + * the diagram selection criterion, or {@code null} to get any diagram + * + * @return the matching diagram, or {@code null} if none + * @since 3.100 + */ + public static Diagram getDiagram(EObject context, java.util.function.Predicate<? super Diagram> filter) { + if (filter == null) { + filter = __ -> true; + } + + return EMFHelper.getUsages(context).stream() + .filter(s -> s.getEObject() instanceof Diagram) + .filter(s -> s.getEStructuralFeature() == NotationPackage.Literals.VIEW__ELEMENT) + .map(s -> s.getEObject()) + // Not in an undone command's change description + .filter(o -> o.eResource() != null) + .map(Diagram.class::cast) + .filter(filter) + .findAny().orElse(null); + } } |