Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2013-07-11 09:33:02 +0000
committercletavernie2013-07-11 09:33:02 +0000
commitc35c95b368c4c5b6e2fb5ca0e446b6b010c342bb (patch)
tree228898d1f9857f7576916842d36919207194c9da /plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider
parentd2888b1e048a61ff9a23b1d407b7dd69d4a9519d (diff)
downloadorg.eclipse.papyrus-c35c95b368c4c5b6e2fb5ca0e446b6b010c342bb.tar.gz
org.eclipse.papyrus-c35c95b368c4c5b6e2fb5ca0e446b6b010c342bb.tar.xz
org.eclipse.papyrus-c35c95b368c4c5b6e2fb5ca0e446b6b010c342bb.zip
[SVN] Move the search plug-ins to their final location
Diffstat (limited to 'plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider')
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/.classpath7
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/.project28
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/META-INF/MANIFEST.MF21
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/about.html28
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/build.properties8
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/plugin.properties2
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/plugin.xml15
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/src/org/eclipse/papyrus/infra/services/viewlabelprovider/Activator.java67
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/src/org/eclipse/papyrus/infra/services/viewlabelprovider/Messages.java33
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/src/org/eclipse/papyrus/infra/services/viewlabelprovider/messages.properties2
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/src/org/eclipse/papyrus/infra/services/viewlabelprovider/provider/ViewLabelProvider.java142
12 files changed, 360 insertions, 0 deletions
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/.classpath b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/.classpath
new file mode 100644
index 00000000000..da1049abda9
--- /dev/null
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/.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/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/.project b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/.project
new file mode 100644
index 00000000000..e9b5b2bfc0b
--- /dev/null
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.services.viewlabelprovider</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/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..44217f8c068
--- /dev/null
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/META-INF/MANIFEST.MF b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..23a69cdb545
--- /dev/null
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.1",
+ org.eclipse.ui;bundle-version="3.105.0",
+ org.eclipse.papyrus.infra.core;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.1",
+ org.eclipse.gmf.runtime.notation;bundle-version="1.5.0",
+ org.eclipse.emf.ecore;bundle-version="2.9.0"
+Bundle-Vendor: %vendorName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.10.1.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.infra.services.viewlabelprovider
+ .Activator
+Bundle-SymbolicName: org.eclipse.papyrus.infra.services.viewlabelprovi
+ der;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/about.html b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/about.html
new file mode 100644
index 00000000000..5ddc72c177f
--- /dev/null
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/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>November 20, 2008</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> \ No newline at end of file
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/build.properties b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/build.properties
new file mode 100644
index 00000000000..653ec3c3daf
--- /dev/null
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html,\
+ plugin.properties
+src.includes = about.html
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/plugin.properties b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/plugin.properties
new file mode 100644
index 00000000000..1036da63160
--- /dev/null
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/plugin.properties
@@ -0,0 +1,2 @@
+pluginName=GMF View Label Provider (Incubation)
+vendorName=Eclipse Modeling Project \ No newline at end of file
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/plugin.xml b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/plugin.xml
new file mode 100644
index 00000000000..95a2195ad0d
--- /dev/null
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/plugin.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension
+ id="org.eclipse.papyrus.infra.services.viewLabelProvider"
+ name="ViewLabelProvider"
+ point="org.eclipse.papyrus.infra.services.labelprovider.labelProvider">
+ <labelProvider
+ priority="10"
+ provider="org.eclipse.papyrus.infra.services.viewlabelprovider.provider.ViewLabelProvider">
+ </labelProvider>
+ </extension>
+
+</plugin>
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/src/org/eclipse/papyrus/infra/services/viewlabelprovider/Activator.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/src/org/eclipse/papyrus/infra/services/viewlabelprovider/Activator.java
new file mode 100644
index 00000000000..e5a075e4ec5
--- /dev/null
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/src/org/eclipse/papyrus/infra/services/viewlabelprovider/Activator.java
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.services.viewlabelprovider;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The Class Activator.
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.services.viewlabelprovider"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static LogHelper log;
+
+ 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);
+ log = new LogHelper(this);
+ plugin = 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);
+ }
+
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/src/org/eclipse/papyrus/infra/services/viewlabelprovider/Messages.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/src/org/eclipse/papyrus/infra/services/viewlabelprovider/Messages.java
new file mode 100644
index 00000000000..afcb25bb222
--- /dev/null
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/src/org/eclipse/papyrus/infra/services/viewlabelprovider/Messages.java
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.services.viewlabelprovider;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.services.viewlabelprovider.messages"; //$NON-NLS-1$
+
+ public static String ViewLabelProvider_0;
+
+ public static String ViewLabelProvider_1;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/src/org/eclipse/papyrus/infra/services/viewlabelprovider/messages.properties b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/src/org/eclipse/papyrus/infra/services/viewlabelprovider/messages.properties
new file mode 100644
index 00000000000..8ce9de16fd6
--- /dev/null
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/src/org/eclipse/papyrus/infra/services/viewlabelprovider/messages.properties
@@ -0,0 +1,2 @@
+ViewLabelProvider_0=Failed to retrieve label service for :
+ViewLabelProvider_1=\ (view)
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/src/org/eclipse/papyrus/infra/services/viewlabelprovider/provider/ViewLabelProvider.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/src/org/eclipse/papyrus/infra/services/viewlabelprovider/provider/ViewLabelProvider.java
new file mode 100644
index 00000000000..689a5a41569
--- /dev/null
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewlabelprovider/src/org/eclipse/papyrus/infra/services/viewlabelprovider/provider/ViewLabelProvider.java
@@ -0,0 +1,142 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.services.viewlabelprovider.provider;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.infra.services.viewlabelprovider.Activator;
+import org.eclipse.papyrus.infra.services.viewlabelprovider.Messages;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ *
+ * Adds a labelProvider to the LabelproviderService for GMF View that provides text and image of the semantic element represented by the View
+ *
+ */
+public class ViewLabelProvider implements IFilteredLabelProvider {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider#accept(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ public boolean accept(Object element) {
+ if(element instanceof View) {
+ if(!(element instanceof Diagram)) {
+ EObject semanticElement = ((View)element).getElement();
+ if(semanticElement != null) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns the semantic element's image
+ *
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ public Image getImage(Object element) {
+ if(element instanceof View) {
+ EObject semanticElement = ((View)element).getElement();
+
+ if(semanticElement != null) {
+ try {
+ LabelProviderService service = ServiceUtilsForEObject.getInstance().getService(LabelProviderService.class, semanticElement);
+ return service.getLabelProvider().getImage(semanticElement);
+ } catch (ServiceException e) {
+ Activator.log.warn(Messages.ViewLabelProvider_0 + semanticElement);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the semantic element's text
+ *
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ public String getText(Object element) {
+ if(element instanceof View) {
+ EObject semanticElement = ((View)element).getElement();
+
+ if(semanticElement != null) {
+ try {
+ LabelProviderService service = ServiceUtilsForEObject.getInstance().getService(LabelProviderService.class, semanticElement);
+ return service.getLabelProvider().getText(semanticElement) + Messages.ViewLabelProvider_1;
+ } catch (ServiceException e) {
+ Activator.log.warn(Messages.ViewLabelProvider_0 + semanticElement);
+ }
+ }
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ *
+ * @param listener
+ */
+ public void addListener(ILabelProviderListener listener) {
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ *
+ */
+ public void dispose() {
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
+ *
+ * @param element
+ * @param property
+ * @return
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ *
+ * @param listener
+ */
+ public void removeListener(ILabelProviderListener listener) {
+
+ }
+}

Back to the top