From 07059884d867f9b3ae5219b2234220a355ccb0ff Mon Sep 17 00:00:00 2001 From: Asma Smaoui Date: Tue, 5 Dec 2017 15:59:20 +0100 Subject: Bug 528156 - [Model Explorer][New Relation-ship] change the dialog content provider to include text-filter and an History widget Change-Id: I6819f4c7312830bd529713b513fafdafdbcd7a3d Signed-off-by: Asma Smaoui (cherry picked from commit a08aefe458f053a7783d4c57ac44e4673ceb35ce) --- .../papyrus/infra/newchild/CreationMenuFactory.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/infra/newchild/org.eclipse.papyrus.infra.newchild/src/org/eclipse/papyrus/infra/newchild/CreationMenuFactory.java b/plugins/infra/newchild/org.eclipse.papyrus.infra.newchild/src/org/eclipse/papyrus/infra/newchild/CreationMenuFactory.java index 7401920e7aa..00054905268 100644 --- a/plugins/infra/newchild/org.eclipse.papyrus.infra.newchild/src/org/eclipse/papyrus/infra/newchild/CreationMenuFactory.java +++ b/plugins/infra/newchild/org.eclipse.papyrus.infra.newchild/src/org/eclipse/papyrus/infra/newchild/CreationMenuFactory.java @@ -13,6 +13,7 @@ * CEA LIST - Initial API and implementation * Patrik Nandorf (Ericsson AB) patrik.nandorf@ericsson.com - Bug 425565 * Christian W. Damus - bug 485220 + * Asma Smaoui asma.smaoui@cea.fr - bug 528156 * *****************************************************************************/ package org.eclipse.papyrus.infra.newchild; @@ -34,6 +35,7 @@ import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; @@ -61,7 +63,9 @@ import org.eclipse.papyrus.infra.services.edit.utils.RequestCacheEntries; import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService; import org.eclipse.papyrus.infra.services.semantic.service.SemanticService; import org.eclipse.papyrus.infra.types.ElementTypeConfiguration; +import org.eclipse.papyrus.infra.ui.emf.providers.EMFGraphicalContentProvider; import org.eclipse.papyrus.infra.ui.emf.providers.strategy.SemanticEMFContentProvider; +import org.eclipse.papyrus.infra.ui.emf.utils.ProviderHelper; import org.eclipse.papyrus.infra.ui.providers.DelegatingPapyrusContentProvider; import org.eclipse.papyrus.infra.ui.providers.ISemanticContentProviderFactory; import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog; @@ -551,9 +555,10 @@ public class CreationMenuFactory { .filter(Objects::nonNull) .reduce(ISemanticContentProviderFactory::compose); + ResourceSet rs= eobject.eResource().getResourceSet(); ITreeContentProvider delegate = factory.orElse(SemanticEMFContentProvider::new) - .createSemanticContentProvider(eobject.eResource().getResourceSet()); - + .createSemanticContentProvider(rs); + ITreeContentProvider contentProvider = new DelegatingPapyrusContentProvider(delegate) { @Override public boolean isValidValue(Object element) { @@ -579,8 +584,11 @@ public class CreationMenuFactory { } }; + + EMFGraphicalContentProvider graphicalContentProvider = ProviderHelper.encapsulateProvider(contentProvider, rs, "target"); + TreeSelectorDialog dialog = new TreeSelectorDialog(Display.getDefault().getActiveShell()); - dialog.setContentProvider(contentProvider); + dialog.setContentProvider(graphicalContentProvider); dialog.setLabelProvider(labelProvider); dialog.setMessage("Choose the target element"); dialog.setTitle("Target Element Selection"); -- cgit v1.2.3