Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'incoming')
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/.classpath7
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/.project28
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/META-INF/MANIFEST.MF17
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/about.html28
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/build.properties9
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/plugin.properties13
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/plugin.xml15
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/schema/labelProvider.exsd154
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/Activator.java69
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/LabelProviderService.java60
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/impl/LabelProviderServiceImpl.java177
11 files changed, 577 insertions, 0 deletions
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/.classpath b/incoming/org.eclipse.papyrus.infra.services.labelprovider/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.labelprovider/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/.project b/incoming/org.eclipse.papyrus.infra.services.labelprovider/.project
new file mode 100644
index 00000000000..3fc96f9121b
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.labelprovider/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.services.labelprovider</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/META-INF/MANIFEST.MF b/incoming/org.eclipse.papyrus.infra.services.labelprovider/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..7c9f92b4bd3
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.labelprovider/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: LabelProvider service
+Bundle-SymbolicName: org.eclipse.papyrus.infra.services.labelprovider;singleton:=true
+Bundle-Version: 0.10.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.infra.services.labelprovider.Activator
+Bundle-Vendor: Eclipse Modeling Project
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+Export-Package: org.eclipse.papyrus.infra.services.labelprovider,
+ org.eclipse.papyrus.infra.services.labelprovider.service
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/about.html b/incoming/org.eclipse.papyrus.infra.services.labelprovider/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.labelprovider/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/build.properties b/incoming/org.eclipse.papyrus.infra.services.labelprovider/build.properties
new file mode 100644
index 00000000000..7f1505329b7
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.labelprovider/build.properties
@@ -0,0 +1,9 @@
+source.. = src/
+output.. = bin/
+bin.includes = .,\
+ META-INF/,\
+ about.html,\
+ plugin.properties,\
+ plugin.xml,\
+ schema/
+src.includes = about.html
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/plugin.properties b/incoming/org.eclipse.papyrus.infra.services.labelprovider/plugin.properties
new file mode 100644
index 00000000000..9e5fbb1ff97
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.labelprovider/plugin.properties
@@ -0,0 +1,13 @@
+#################################################################################
+# Copyright (c) 2010 CEA LIST.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+# Yann Tanguy yann.tanguy@cea.fr - GMF Runtime based edit service for model type
+##################################################################################
+pluginName=LabelProvider service (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/plugin.xml b/incoming/org.eclipse.papyrus.infra.services.labelprovider/plugin.xml
new file mode 100644
index 00000000000..59c196f6502
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.labelprovider/plugin.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="labelProvider" name="labelProvider" schema="schema/labelProvider.exsd"/>
+ <extension
+ point="org.eclipse.papyrus.infra.core.service">
+ <service
+ classname="org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl"
+ description="A Service to instantiate label providers"
+ id="org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService"
+ priority="1"
+ startKind="lazy">
+ </service>
+ </extension>
+</plugin>
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/schema/labelProvider.exsd b/incoming/org.eclipse.papyrus.infra.services.labelprovider/schema/labelProvider.exsd
new file mode 100644
index 00000000000..a977850c005
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.labelprovider/schema/labelProvider.exsd
@@ -0,0 +1,154 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.papyrus.infra.services.labelprovider" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.papyrus.infra.services.labelprovider" id="labelProvider" name="labelProvider"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <choice minOccurs="1" maxOccurs="unbounded">
+ <element ref="context"/>
+ <element ref="labelProvider"/>
+ </choice>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="labelProvider">
+ <complexType>
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <element ref="labelProviderContext"/>
+ </sequence>
+ <attribute name="provider" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.widgets.providers.IFilteredLabelProvider"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="priority" type="string" use="default" value="10">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="context">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="labelProviderContext">
+ <annotation>
+ <documentation>
+ A reference to a LabelProvider context. A LabelProvider may have 0, one or more contexts. If a label provider doesn&apos;t have a context, it will be applied to all contexts.
+
+If a LabelProvider should only apply to the default context, it should use the context name &quot;default&quot; (Which is always available).
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="context" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.papyrus.infra.services.labelprovider/context/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/Activator.java b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/Activator.java
new file mode 100644
index 00000000000..bb46f341c88
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/Activator.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.services.labelprovider;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.services.labelprovider"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static LogHelper log;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/LabelProviderService.java b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/LabelProviderService.java
new file mode 100644
index 00000000000..e7f0240ae11
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/LabelProviderService.java
@@ -0,0 +1,60 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.services.labelprovider.service;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.infra.core.services.IService;
+
+/**
+ * A service to retrieve the best LabelProvider for a given element.
+ *
+ * The Label provider may be contextual, e.g. the LabelProvider won't
+ * be the same for the ModelExplorer and the PropertiesView (Although
+ * these two views typically share the same ServicesRegistry).
+ *
+ * The context is an optional String key
+ *
+ * @author Camille Letavernier
+ *
+ */
+public interface LabelProviderService extends IService {
+
+ /**
+ * Identifies the default Label Provider context
+ *
+ * @see #getLabelProvider(String)
+ * @see #getLabelProvider()
+ */
+ public static final String DEFAULT_LABEL_PROVIDER = "default";
+
+ /**
+ * Retrieves the standard ILabelProvider.
+ *
+ * Equivalent to #getLabelProvider(null)
+ * Equivalent to #getLabelProvider(LabelProviderService.DEFAULT_LABEL_PROVIDER)
+ *
+ * @return
+ */
+ public ILabelProvider getLabelProvider();
+
+ /**
+ *
+ * @param context
+ * The context in which the ILabelProvider will be used. According to the context,
+ * a different implementation may be returned. If the context is unknown or null,
+ * the standard ILabelProvider will be returned
+ * @return
+ * The most appropriate ILabelProvider for the given context
+ */
+ public ILabelProvider getLabelProvider(String context);
+
+}
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/impl/LabelProviderServiceImpl.java b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/impl/LabelProviderServiceImpl.java
new file mode 100644
index 00000000000..bcda8d919bf
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/impl/LabelProviderServiceImpl.java
@@ -0,0 +1,177 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.services.labelprovider.service.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.services.labelprovider.Activator;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.infra.widgets.providers.ExtensibleLabelProvider;
+import org.eclipse.papyrus.infra.widgets.providers.IFilteredLabelProvider;
+
+/**
+ * Default implementation for the LabelProviderService
+ *
+ * It relies on an ExtensibleLabelProvider. Different label providers can be contributed via
+ * an extension point.
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class LabelProviderServiceImpl implements LabelProviderService {
+
+ private final Map<String, SharedExtensibleLabelProvider> labelProviders = new HashMap<String, SharedExtensibleLabelProvider>();
+
+ public static final String EXTENSION_ID = Activator.PLUGIN_ID + ".labelProvider";
+
+ /**
+ * {@inheritDoc}
+ */
+ public void init(ServicesRegistry servicesRegistry) throws ServiceException {
+ //Nothing
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void startService() throws ServiceException {
+ IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
+
+ readContexts(config);
+ readLabelProviders(config);
+ }
+
+ private void readContexts(IConfigurationElement[] config) {
+ for(IConfigurationElement e : config) {
+ try {
+ if("context".equals(e.getName())) {
+ String contextId = e.getAttribute("id");
+ if(contextId == null) {
+ Activator.log.warn("The plug-in " + e.getContributor() + " contributed an invalid extension for " + EXTENSION_ID + ". The context id must be set");
+ continue;
+ }
+
+ if(labelProviders.containsKey(contextId)) {
+ Activator.log.warn("The context " + contextId + " is already contributed");
+ continue;
+ }
+
+ /** Associates an empty LabelProvider to the context */
+ labelProviders.put(contextId, new SharedExtensibleLabelProvider());
+ }
+ } catch (Exception ex) {
+ Activator.log.error("The plugin " + e.getContributor() + " contributed an invalid extension for " + EXTENSION_ID, ex); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ }
+
+ /**
+ * THe default label provider context may have been registered via an extension. Otherwise, we force its creation.
+ */
+ if(!labelProviders.containsKey(DEFAULT_LABEL_PROVIDER)) {
+ labelProviders.put(DEFAULT_LABEL_PROVIDER, new SharedExtensibleLabelProvider());
+ }
+ }
+
+ private void readLabelProviders(IConfigurationElement[] config) {
+ for(IConfigurationElement e : config) {
+ try {
+ if("labelProvider".equals(e.getName())) {
+ IFilteredLabelProvider provider = (IFilteredLabelProvider)e.createExecutableExtension("provider");
+ if(provider == null) {
+ Activator.log.warn("The labelProvider class is required");
+ continue;
+ }
+
+ int priority = Integer.parseInt(e.getAttribute("priority"));
+
+ IConfigurationElement[] contextElements = e.getChildren("labelProviderContext");
+
+ //No context means all contexts
+ if(contextElements.length == 0) {
+ for(ExtensibleLabelProvider labelProvider : labelProviders.values()) {
+ labelProvider.registerProvider(priority, provider);
+ }
+ } else {
+ for(IConfigurationElement contextElement : contextElements) {
+ String context = contextElement.getAttribute("context");
+ if(context != null) {
+ ExtensibleLabelProvider labelProvider = labelProviders.get(context);
+ if(labelProvider == null) {
+ Activator.log.warn("Unknown label provider context: " + context);
+ continue;
+ }
+
+ labelProvider.registerProvider(priority, provider);
+ }
+ }
+ }
+ }
+ } catch (ClassCastException ex) {
+ Activator.log.warn("The plug-in " + e.getContributor() + " contributed an invalid extension for " + EXTENSION_ID + ". The labelProvider must implement IFilteredLabelProvider");
+ } catch (Exception ex) {
+ Activator.log.error("The plugin " + e.getContributor() + " contributed an invalid extension for " + EXTENSION_ID, ex); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void disposeService() throws ServiceException {
+ for(SharedExtensibleLabelProvider provider : labelProviders.values()) {
+ provider.doDispose();
+ }
+ this.labelProviders.clear();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ILabelProvider getLabelProvider() {
+ return getLabelProvider(DEFAULT_LABEL_PROVIDER);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ILabelProvider getLabelProvider(String context) {
+ if(context == null) {
+ return getLabelProvider();
+ }
+
+ if(!labelProviders.containsKey(context)) {
+
+ }
+ return labelProviders.get(context);
+ }
+
+ private class SharedExtensibleLabelProvider extends ExtensibleLabelProvider {
+
+ @Override
+ public void dispose() {
+ //Nothing. The LabelProvider is shared, and JFace viewers dispose their providers
+ //when they are disposed.
+ //The providers should be disposed only when the service is disposed.
+ }
+
+ public void doDispose() {
+ super.dispose(); //Disposed only when the service is disposed
+ }
+ }
+
+}

Back to the top