Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2013-02-04 09:52:36 +0000
committercletavernie2013-02-04 09:52:36 +0000
commit3d5e6004d9b6977504cf8b1bf8d45f76659e9043 (patch)
treededd52bfa05db4c803843ef0b48eba98322687ae /incoming
parent6a94865fd1ac67c9b6f603d88f9d99b682b2ac63 (diff)
downloadorg.eclipse.papyrus-3d5e6004d9b6977504cf8b1bf8d45f76659e9043.tar.gz
org.eclipse.papyrus-3d5e6004d9b6977504cf8b1bf8d45f76659e9043.tar.xz
org.eclipse.papyrus-3d5e6004d9b6977504cf8b1bf8d45f76659e9043.zip
392438: [Core Services] Papyrus should provide a LabelProvider service
https://bugs.eclipse.org/bugs/show_bug.cgi?id=392438 Move oep.infra.services.labelprovider to its final SVN location
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/ContextualLabelProvider.java31
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/ExtensibleLabelProvider.java116
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/IDetailLabelProvider.java20
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/IFilteredLabelProvider.java24
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/LabelProviderService.java85
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/impl/LabelProviderServiceImpl.java218
15 files changed, 0 insertions, 834 deletions
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/.classpath b/incoming/org.eclipse.papyrus.infra.services.labelprovider/.classpath
deleted file mode 100644
index 2d1a4302f04..00000000000
--- a/incoming/org.eclipse.papyrus.infra.services.labelprovider/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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
deleted file mode 100644
index 3fc96f9121b..00000000000
--- a/incoming/org.eclipse.papyrus.infra.services.labelprovider/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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
deleted file mode 100644
index 23a9e316165..00000000000
--- a/incoming/org.eclipse.papyrus.infra.services.labelprovider/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,17 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: LabelProvider service (Incubation)
-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.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,
- org.eclipse.papyrus.infra.services.labelprovider.service.impl
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/about.html b/incoming/org.eclipse.papyrus.infra.services.labelprovider/about.html
deleted file mode 100644
index 82d49bf5f81..00000000000
--- a/incoming/org.eclipse.papyrus.infra.services.labelprovider/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!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
deleted file mode 100644
index 7f1505329b7..00000000000
--- a/incoming/org.eclipse.papyrus.infra.services.labelprovider/build.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-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
deleted file mode 100644
index 9e5fbb1ff97..00000000000
--- a/incoming/org.eclipse.papyrus.infra.services.labelprovider/plugin.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-#################################################################################
-# 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
deleted file mode 100644
index 59c196f6502..00000000000
--- a/incoming/org.eclipse.papyrus.infra.services.labelprovider/plugin.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?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
deleted file mode 100644
index a977850c005..00000000000
--- a/incoming/org.eclipse.papyrus.infra.services.labelprovider/schema/labelProvider.exsd
+++ /dev/null
@@ -1,154 +0,0 @@
-<?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
deleted file mode 100644
index bb46f341c88..00000000000
--- a/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/Activator.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*****************************************************************************
- * 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/ContextualLabelProvider.java b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/ContextualLabelProvider.java
deleted file mode 100644
index e99f7ab2779..00000000000
--- a/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/ContextualLabelProvider.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*****************************************************************************
- * 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;
-
-/**
- * A LabelProvider which may use a context element to compute its labels.
- * It can be used to compute e.g. relative paths from a base namespace
- *
- * @author Camille Letavernier
- */
-public interface ContextualLabelProvider extends ILabelProvider {
-
- /**
- * Sets the context element against which the labels will be computed
- *
- * @param contextElement
- * the context element against which the labels will be computed (e.g. base namespace for relative paths)
- */
- public void setContext(Object contextElement);
-}
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/ExtensibleLabelProvider.java b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/ExtensibleLabelProvider.java
deleted file mode 100644
index 2412359ab9b..00000000000
--- a/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/ExtensibleLabelProvider.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*****************************************************************************
- * 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 java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * An ExtensibleLabelProvider encapsulates a set of LabelProviders. Each LabelProvider handles only a few kind of elements.
- * The ExtensibleLabelProvider retrieves the most appropriate LabelProvider for each object.
- *
- * When more than one LabelProvider match an element, the one with the smaller priority is used.
- *
- * @author Camille Letavernier
- *
- */
-public class ExtensibleLabelProvider implements ILabelProvider, ILabelProviderListener {
-
- private final Set<ILabelProviderListener> listeners;
-
- private final SortedMap<Integer, List<IFilteredLabelProvider>> providers;
-
- private final ILabelProvider defaultProvider;
-
- public ExtensibleLabelProvider() {
- listeners = new LinkedHashSet<ILabelProviderListener>();
- providers = new TreeMap<Integer, List<IFilteredLabelProvider>>();
-
- defaultProvider = new LabelProvider();
- }
-
- public void addListener(ILabelProviderListener listener) {
- listeners.add(listener);
- }
-
- public void dispose() {
- listeners.clear();
- for(List<IFilteredLabelProvider> filteredProviders : providers.values()) {
- for(IFilteredLabelProvider provider : filteredProviders) {
- provider.dispose();
- }
- }
- providers.clear();
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- listeners.remove(listener);
- }
-
- public void registerProvider(int priority, IFilteredLabelProvider provider) {
- getProviders(priority).add(provider);
- provider.addListener(this);
- }
-
- public Image getImage(Object element) {
- return getProvider(element).getImage(element);
- }
-
- public String getText(Object element) {
- return getProvider(element).getText(element);
- }
-
- protected final ILabelProvider getProvider(Object element) {
- for(List<IFilteredLabelProvider> filteredProviders : providers.values()) {
- for(IFilteredLabelProvider provider : filteredProviders) {
- if(provider.accept(element)) {
- return provider;
- }
- }
- }
-
- return defaultProvider;
- }
-
- protected final List<IFilteredLabelProvider> getProviders(int priority) {
- if(!providers.containsKey(priority)) {
- providers.put(priority, new LinkedList<IFilteredLabelProvider>());
- }
-
- return providers.get(priority);
- }
-
- /**
- * {@inheritDoc}
- *
- * Forwards the event to each listener
- */
- public void labelProviderChanged(LabelProviderChangedEvent event) {
- for(ILabelProviderListener listener : listeners) {
- listener.labelProviderChanged(event);
- }
- }
-}
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/IDetailLabelProvider.java b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/IDetailLabelProvider.java
deleted file mode 100644
index f76e7743239..00000000000
--- a/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/IDetailLabelProvider.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 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;
-
-
-public interface IDetailLabelProvider extends ILabelProvider {
-
- public String getDetail(Object object);
-}
diff --git a/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/IFilteredLabelProvider.java b/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/IFilteredLabelProvider.java
deleted file mode 100644
index d0f015c1f2d..00000000000
--- a/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/IFilteredLabelProvider.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 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;
-
-/**
- * A LabelProvider which only accepts a specific set of objects
- *
- * @author Camille Letavernier
- */
-public interface IFilteredLabelProvider extends ILabelProvider {
-
- public boolean accept(Object element);
-}
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
deleted file mode 100644
index a0657f0cbce..00000000000
--- a/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/LabelProviderService.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*****************************************************************************
- * 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);
-
- /**
- * Retrieves the LabelProvider for the given context. The provider will return
- * labels based on the contextElement
- *
- * @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
- * @param contextElement
- * The element against which the labels should be computed. It can for example
- * be the base namespace to compute relative labels.
- * @return
- */
- public ILabelProvider getLabelProvider(String context, Object contextElement);
-
- /**
- * Retrieves the default LabelProvider. The provider will return
- * labels based on the contextElement
- *
- * @param contextElement
- * The element against which the labels should be computed. It can for example
- * be the base namespace to compute relative labels.
- */
- public ILabelProvider getLabelProvider(Object contextElement);
-
-}
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
deleted file mode 100644
index 2a069b13a04..00000000000
--- a/incoming/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/impl/LabelProviderServiceImpl.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*****************************************************************************
- * 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.ContextualLabelProvider;
-import org.eclipse.papyrus.infra.services.labelprovider.service.ExtensibleLabelProvider;
-import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
-import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
-
-/**
- * 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);
- }
-
- /**
- * Parses the available contexts from the extension point
- *
- * @param config
- * The extension point IConfigurationElements
- */
- 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());
- }
- }
-
- /**
- * Parses the available label providers from the extension point
- *
- * @param config
- * The extension point IConfigurationElements
- */
- 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);
- } else {
- Activator.log.warn("The context for label provider " + e.getAttribute("provider") + " is null");
- }
- }
- }
- }
- } 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)) {
- Activator.log.warn("Unknown label provider context: " + context + ". The default label provider will be used");
- return getLabelProvider();
- }
- return labelProviders.get(context);
- }
-
- /**
- * {@inheritDoc}
- */
- 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
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public ILabelProvider getLabelProvider(String context, Object contextElement) {
- ILabelProvider provider = getLabelProvider(context);
- if(provider instanceof ContextualLabelProvider) {
- ((ContextualLabelProvider)provider).setContext(contextElement);
- }
- return provider;
- }
-
- /**
- * {@inheritDoc}
- */
- public ILabelProvider getLabelProvider(Object contextElement) {
- ILabelProvider provider = getLabelProvider();
- if(provider instanceof ContextualLabelProvider) {
- ((ContextualLabelProvider)provider).setContext(contextElement);
- }
- return provider;
- }
-
-}

Back to the top