From 652770afc708e7707473f510f468e15858ee8c18 Mon Sep 17 00:00:00 2001 From: Vincent Lorenzo Date: Tue, 18 Feb 2020 11:34:51 +0100 Subject: Bug 560219: [Diagram][Table][AF] The abstract class ViewPrototype must allow to instanciate a view without open it Change-Id: I5da6139c1a60fcb1eb5be3eec57b9cab76767e64 Signed-off-by: Vincent Lorenzo --- .../META-INF/MANIFEST.MF | 2 +- .../plugin.xml | 3 ++- .../pom.xml | 2 +- .../gmfdiag/common/helper/DiagramPrototype.java | 22 ++++++++++++++++++---- .../plugin.xml | 3 ++- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 7 +++++-- .../schema/viewType.exsd | 2 +- .../infra/viewpoints/policy/ViewPrototype.java | 18 ++++++++++++++++-- .../usecases.md | 5 +++++ 10 files changed, 52 insertions(+), 14 deletions(-) create mode 100755 plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/usecases.md (limited to 'plugins/infra') diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF index 8a58dfa4f0d..bfc6e721921 100755 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF @@ -82,7 +82,7 @@ Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.common.Activator Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-ClassPath: . -Bundle-Version: 3.103.0.qualifier +Bundle-Version: 3.103.100.qualifier Bundle-Localization: plugin Bundle-Name: %pluginName Bundle-ManifestVersion: 2 diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml index 60026473a38..fd848859279 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml @@ -288,7 +288,8 @@ + class="org.eclipse.papyrus.infra.gmfdiag.common.helper.GMFDiagramViewTypeHelper" + priority="0"> 0.0.1-SNAPSHOT org.eclipse.papyrus.infra.gmfdiag.common - 3.103.0-SNAPSHOT + 3.103.100-SNAPSHOT eclipse-plugin diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramPrototype.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramPrototype.java index cacfbe6a872..faa5bed78ab 100755 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramPrototype.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramPrototype.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2013 CEA LIST. + * Copyright (c) 2013, 2020 CEA LIST. * * * All rights reserved. This program and the accompanying materials @@ -11,7 +11,7 @@ * * Contributors: * Laurent Wouters laurent.wouters@cea.fr - Initial API and implementation - * + * Vincent Lorenzo vincent.lorenzo@cea.fr - bug 560219 *****************************************************************************/ package org.eclipse.papyrus.infra.gmfdiag.common.helper; @@ -33,6 +33,7 @@ import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype; * Represents a prototype of GMF diagram for the viewpoints infrastructure * * @author Laurent Wouters + * */ public class DiagramPrototype extends ViewPrototype { protected final String category; @@ -54,6 +55,19 @@ public class DiagramPrototype extends ViewPrototype { @Override public boolean instantiateOn(EObject owner, String name) { + return instantiateOn(owner, name, true); + } + + /** + * @see org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype#instantiateOn(org.eclipse.emf.ecore.EObject, java.lang.String, boolean) + * + * @param owner + * @param name + * @param openCreatedView + * @return + */ + @Override + public boolean instantiateOn(EObject owner, String name, boolean openCreatedView) { ServicesRegistry registry; try { registry = ServiceUtilsForEObject.getInstance().getServiceRegistry(owner); @@ -68,7 +82,7 @@ public class DiagramPrototype extends ViewPrototype { Activator.log.error(ex); return false; } - Object result = command.createDiagram(modelSet, owner, owner, this, name); + Object result = command.createDiagram(modelSet, owner, owner, this, name, openCreatedView); return (result != null); } @@ -141,7 +155,7 @@ public class DiagramPrototype extends ViewPrototype { public EObject getRootOf(EObject view) { return ((Diagram) view).getElement(); } - + /** * @since 3.0 */ diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/plugin.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/plugin.xml index f46e2674c8d..78f2f483b53 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/plugin.xml +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/plugin.xml @@ -223,7 +223,8 @@ + class="org.eclipse.papyrus.infra.nattable.common.helper.TableCommandHelper" + priority="0"> + + 4.0.0 org.eclipse.papyrus.infra-viewpoints @@ -6,6 +9,6 @@ 0.0.1-SNAPSHOT org.eclipse.papyrus.infra.viewpoints.policy - 3.1.0-SNAPSHOT + 3.2.0-SNAPSHOT eclipse-plugin \ No newline at end of file diff --git a/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/schema/viewType.exsd b/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/schema/viewType.exsd index 27436bd7770..59546cdac0f 100755 --- a/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/schema/viewType.exsd +++ b/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/schema/viewType.exsd @@ -64,7 +64,7 @@ The priority rank, as an integer, of the extension relative to others. <p> -The default priority is zero and higher priorities precede lower priorities in matching helpers against views in the notation model. +The default priority is zero (lowest priority) and higher priorities precede lower priorities in matching helpers against views in the notation model. </p><p> Since version 2.1. </p> diff --git a/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/src/org/eclipse/papyrus/infra/viewpoints/policy/ViewPrototype.java b/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/src/org/eclipse/papyrus/infra/viewpoints/policy/ViewPrototype.java index 5588656b539..07a0ab11bcd 100644 --- a/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/src/org/eclipse/papyrus/infra/viewpoints/policy/ViewPrototype.java +++ b/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/src/org/eclipse/papyrus/infra/viewpoints/policy/ViewPrototype.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2013, 2017, 2019 CEA LIST, Christian W. Damus, and others. + * Copyright (c) 2013, 2017, 2019, 2020 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 2.0 @@ -12,7 +12,7 @@ * Laurent Wouters laurent.wouters@cea.fr - Initial API and implementation * Christian W. Damus - bugs 474467, 493375, 527580 * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 550568 - * + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - bug 560219 *****************************************************************************/ package org.eclipse.papyrus.infra.viewpoints.policy; @@ -364,6 +364,20 @@ public abstract class ViewPrototype { */ public abstract boolean instantiateOn(EObject owner, String name); + /** + * Create a new view from this prototype with the given owner and name, and open it if required + * + * @param owner + * @param name + * @param openCreatedView + * @return + * true if the diagram creation succeed, false otherwise + * @since 3.2 + */ + public boolean instantiateOn(final EObject owner, final String name, final boolean openCreatedView) { + return instantiateOn(owner, name); + } + /** * Gets the command for moving the given view to a new owner (target) * diff --git a/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/usecases.md b/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/usecases.md new file mode 100755 index 00000000000..672c7e8d9b9 --- /dev/null +++ b/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/usecases.md @@ -0,0 +1,5 @@ +**class ViewPrototype** +This class provides method to create a view (editor) from an EObject using the method +instantiateOn(final EObject owner, final String name, final boolean openCreatedView) +This class provides the command to change the graphical owner and the semantic owner. + -- cgit v1.2.3