diff options
| author | Pierre-Charles David | 2016-05-19 13:21:24 +0000 |
|---|---|---|
| committer | Pierre-Charles David | 2016-05-19 13:21:24 +0000 |
| commit | 61d921d715f392dfbf74520b662c58606daceb2f (patch) | |
| tree | 66ae24e6b3ff1bc4aee6beb2a80998228b1fd6c6 | |
| parent | 997b9ac6a25809e8f4328fbfbac9b17438b2b9ac (diff) | |
| download | org.eclipse.sirius-61d921d715f392dfbf74520b662c58606daceb2f.tar.gz org.eclipse.sirius-61d921d715f392dfbf74520b662c58606daceb2f.tar.xz org.eclipse.sirius-61d921d715f392dfbf74520b662c58606daceb2f.zip | |
[482528] Use icon and text from the ItemProvider for the view's header
Delegate to the EMF Edit integration services to obtain the icon and
label to use for the view's header.
Bug: 482528
Change-Id: I6792bd31759fe35fe73767c21a50b4dadc8b85fe
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
3 files changed, 21 insertions, 17 deletions
diff --git a/incubation/org.eclipse.sirius.ui.properties/META-INF/MANIFEST.MF b/incubation/org.eclipse.sirius.ui.properties/META-INF/MANIFEST.MF index 296b78f61a..f6daaf952b 100644 --- a/incubation/org.eclipse.sirius.ui.properties/META-INF/MANIFEST.MF +++ b/incubation/org.eclipse.sirius.ui.properties/META-INF/MANIFEST.MF @@ -22,7 +22,8 @@ Require-Bundle: org.eclipse.eef;bundle-version="1.6.0", org.eclipse.emf.transaction;bundle-version="1.4.0", org.eclipse.eef.common;bundle-version="[1.6.0,2.0.0)", org.eclipse.eef.common.ui;bundle-version="[1.6.0,2.0.0)", - org.eclipse.eef.ide.ui.properties;bundle-version="[1.6.0,2.0.0)" + org.eclipse.eef.ide.ui.properties;bundle-version="[1.6.0,2.0.0)", + org.eclipse.sirius.ext.emf.edit;bundle-version="4.0.0" Import-Package: com.ibm.icu.util, org.eclipse.sirius.ui.tools.api.properties;version="2.1.0" Bundle-Activator: org.eclipse.sirius.ui.properties.internal.SiriusUIPropertiesPlugin$Implementation diff --git a/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/SiriusToolServices.java b/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/SiriusToolServices.java index 9f73cffa3d..97c01043f5 100644 --- a/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/SiriusToolServices.java +++ b/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/SiriusToolServices.java @@ -14,19 +14,17 @@ import java.util.Collection; import java.util.LinkedHashSet; import java.util.Set; -import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.IItemLabelProvider; import org.eclipse.sirius.business.api.helper.task.ICommandTask; import org.eclipse.sirius.business.api.helper.task.TaskHelper; import org.eclipse.sirius.business.api.query.EObjectQuery; import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor; import org.eclipse.sirius.ext.base.Option; +import org.eclipse.sirius.ext.emf.edit.EditingDomainServices; import org.eclipse.sirius.properties.ViewExtensionDescription; import org.eclipse.sirius.tools.api.command.SiriusCommand; import org.eclipse.sirius.tools.api.command.ui.NoUICallback; @@ -44,8 +42,9 @@ import org.eclipse.sirius.viewpoint.description.tool.ModelOperation; * @author sbegaudeau */ public class SiriusToolServices { + + private final EditingDomainServices editServices = new EditingDomainServices(); - // TODO To be removed in favor of the standard EMF Edit /** * Returns the image representing the given EObject. * @@ -54,14 +53,20 @@ public class SiriusToolServices { * @return The image representing the given EObject or <code>null</code> if * none could be found */ - public Object image(EObject eObject) { - ComposedAdapterFactory composedAdapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - Adapter adapter = composedAdapterFactory.adapt(eObject, IItemLabelProvider.class); - if (adapter instanceof IItemLabelProvider) { - IItemLabelProvider labelProvider = (IItemLabelProvider) adapter; - return labelProvider.getImage(eObject); - } - return null; + public Object eefViewImage(EObject eObject) { + return this.editServices.getLabelProviderImage(eObject); + } + + /** + * Returns the text representing the given EObject. + * + * @param eObject + * The EObject + * @return The text representing the given EObject or <code>null</code> if + * none could be found + */ + public Object eefViewText(EObject eObject) { + return this.editServices.getLabelProviderText(eObject); } /** diff --git a/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/tabprovider/ViewDescriptionConverter.java b/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/tabprovider/ViewDescriptionConverter.java index 968b15655c..06068883c7 100644 --- a/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/tabprovider/ViewDescriptionConverter.java +++ b/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/tabprovider/ViewDescriptionConverter.java @@ -169,8 +169,7 @@ public class ViewDescriptionConverter { public EEFViewDescription convert(SiriusInputDescriptor input) { EEFViewDescription view = EefFactory.eINSTANCE.createEEFViewDescription(); - // TODO Replace by the retrieval of the image from the label provider - view.setImageExpression("service:image"); + view.setImageExpression("service:eefViewImage"); Set<EPackage> ePackages = new LinkedHashSet<>(); for (PageDescription pageDescription : pageDescriptions) { @@ -183,8 +182,7 @@ public class ViewDescriptionConverter { view.getEPackages().addAll(ePackages); - // TODO Replace by the retrieval of the label from the label provider - view.setLabelExpression("feature:name"); + view.setLabelExpression("service:eefViewText"); for (PageDescription pageDescription : pageDescriptions) { createPage(pageDescription, view); |
