diff options
author | cletavernie | 2011-10-25 12:15:38 +0000 |
---|---|---|
committer | cletavernie | 2011-10-25 12:15:38 +0000 |
commit | 83b8c416060679f924f77fc6290366e5861329f5 (patch) | |
tree | ed9f0094b6b92283a685f13cf5dd0033feda06f0 /plugins/views | |
parent | efaa35d99af2f347ef8a940bf1af3d09bbd362d9 (diff) | |
download | org.eclipse.papyrus-83b8c416060679f924f77fc6290366e5861329f5.tar.gz org.eclipse.papyrus-83b8c416060679f924f77fc6290366e5861329f5.tar.xz org.eclipse.papyrus-83b8c416060679f924f77fc6290366e5861329f5.zip |
359057: [Architecture - SVN - Build] The Papyrus architecture should be refactored
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359057
Diffstat (limited to 'plugins/views')
9 files changed, 367 insertions, 0 deletions
diff --git a/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/.classpath b/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/.classpath new file mode 100644 index 00000000000..2d1a4302f04 --- /dev/null +++ b/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/.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/views/properties/org.eclipse.papyrus.tabbedproperties.core/.project b/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/.project new file mode 100644 index 00000000000..56801250e50 --- /dev/null +++ b/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.tabbedproperties.core</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/views/properties/org.eclipse.papyrus.tabbedproperties.core/META-INF/MANIFEST.MF b/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..8fb16570fe0 --- /dev/null +++ b/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Localization: plugin +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.papyrus.tabbedproperties.core;singleton:=true +Bundle-Version: 0.9.0.qualifier +Require-Bundle: org.eclipse.emf.edit.ui;bundle-version="2.4.0", + org.eclipse.papyrus.core;bundle-version="0.8.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: org.eclipse.papyrus.tabbedproperties.core, + org.eclipse.papyrus.tabbedproperties.core.providers +Bundle-Vendor: %providerName +Bundle-Activator: org.eclipse.papyrus.tabbedproperties.core.Activator diff --git a/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/about.html b/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/about.html new file mode 100644 index 00000000000..209103075a7 --- /dev/null +++ b/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/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 14, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). 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, "Program" 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 ("Redistributor") 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/views/properties/org.eclipse.papyrus.tabbedproperties.core/build.properties b/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/build.properties new file mode 100644 index 00000000000..282fed47ea1 --- /dev/null +++ b/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/build.properties @@ -0,0 +1,7 @@ +#
+#Mon Sep 12 09:30:18 CEST 2011
+bin.includes=META-INF/,.,plugin.properties,about.html,plugin.xml,build.properties
+output..=bin/
+src.includes=about.html,META-INF/,.,plugin.properties,plugin.xml,build.properties
+source..=src/
+bin..=bin/
diff --git a/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/plugin.properties b/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/plugin.properties new file mode 100644 index 00000000000..26bfbb06fd2 --- /dev/null +++ b/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/plugin.properties @@ -0,0 +1,12 @@ +#################################################################################
+# Copyright (c) 2008 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:
+# Remi Schnekenburger - CEA LIST (remi.schnekenburger@cea.fr) - Initial API and implementation
+##################################################################################
+pluginName=Papyrus Core Tabbed Properties (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/plugin.xml b/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/plugin.xml new file mode 100644 index 00000000000..5e4319bc4fe --- /dev/null +++ b/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/plugin.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.2"?> +<plugin> + + <extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs"> + <propertyTabs contributorId="TreeOutlinePage"> + <propertyTab id="Base" label="General" category="org.eclipse.papyrus" afterTab=""/> + <propertyTab id="org.eclipse.papyrus.tabbedproperties.profile" label="Profile" category="org.eclipse.papyrus" afterTab="Base" /> + <propertyTab id="Comments" label="Comments" category="org.eclipse.papyrus" afterTab="org.eclipse.papyrus.tabbedproperties.profile"/> + <propertyTab id="org.eclipse.papyrus.tabbedproperties.appearance.appearancetab" label="Appearance" category="org.eclipse.papyrus" afterTab="Comments"/> + <propertyTab id="advanced" label="Advanced" category="org.eclipse.papyrus" afterTab="org.eclipse.papyrus.tabbedproperties.appearance.appearancetab"/> + </propertyTabs> + </extension> + + +</plugin> diff --git a/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/src/org/eclipse/papyrus/tabbedproperties/core/Activator.java b/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/src/org/eclipse/papyrus/tabbedproperties/core/Activator.java new file mode 100644 index 00000000000..6bb38b6d001 --- /dev/null +++ b/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/src/org/eclipse/papyrus/tabbedproperties/core/Activator.java @@ -0,0 +1,95 @@ +/*****************************************************************************
+ * Copyright (c) 2009 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:
+ * Remi Schnekenburger (CEA LIST) Remi.Schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.tabbedproperties.core;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+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 {
+
+ /** Plugin id */
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.tabbedproperties.core"; //$NON-NLS-1$
+
+ /**
+ * singleton instance of this plugin.
+ */
+ private static Activator plugin;
+
+ /**
+ * Creates a new Activator.
+ */
+ public Activator() {
+ plugin = this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ 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;
+ }
+
+ /**
+ * Logs an error into the plugin's log
+ *
+ * @param string
+ * the message of the error
+ */
+ public static void logWarning(String string) {
+ getDefault().getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, string));
+ }
+
+ /**
+ * Logs an error into the plugin's log
+ *
+ * @param string
+ * the message of the error
+ */
+ public static void logError(String string) {
+ getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, string));
+ }
+
+ /**
+ * Logs an exception into the plugin's log
+ *
+ * @param exception
+ * the exception to log
+ */
+ public static void logException(Exception exception) {
+ getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, exception.getLocalizedMessage(), exception));
+ }
+
+}
diff --git a/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/src/org/eclipse/papyrus/tabbedproperties/core/providers/EMFObjectLabelProvider.java b/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/src/org/eclipse/papyrus/tabbedproperties/core/providers/EMFObjectLabelProvider.java new file mode 100644 index 00000000000..4909e087a0f --- /dev/null +++ b/plugins/views/properties/org.eclipse.papyrus.tabbedproperties.core/src/org/eclipse/papyrus/tabbedproperties/core/providers/EMFObjectLabelProvider.java @@ -0,0 +1,160 @@ +/******************************************************************************* + * Copyright (c) 2008 Obeo. + * 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: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.papyrus.tabbedproperties.core.providers; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; +import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.graphics.Image; + +/** + * This class handles title label for tabbed properties. + * + * @author Jerome Benois + */ +public class EMFObjectLabelProvider extends AdapterFactoryLabelProvider implements ILabelProvider { + + private static final Class<?> IItemLabelProviderClass = IItemLabelProvider.class; + + private static Map<String, AdapterFactory> factories = new HashMap<String, AdapterFactory>(); + + private static final String EXT_FACTORIES = "org.eclipse.emf.edit.itemProviderAdapterFactories"; //$NON-NLS-1$ + + public EMFObjectLabelProvider() { + super(new ReflectiveItemProviderAdapterFactory()); + } + + @Override + public String getText(Object element) { + String title = ""; //$NON-NLS-1$ + EObject eObject = getModel(element); + IItemLabelProvider itemLabelProvider = getItemLabelProvider(eObject); + if(itemLabelProvider != null) { + title = itemLabelProvider.getText(eObject); + } + + if("".equals(title)) { //$NON-NLS-1$ + title = super.getText(eObject); + } + + return title; + } + + @Override + public Image getImage(Object element) { + Image result = null; + EObject eObject = getModel(element); + IItemLabelProvider itemLabelProvider = getItemLabelProvider(eObject); + if(itemLabelProvider != null) { + result = getImageFromObject(itemLabelProvider.getImage(eObject)); + } + + return result; + } + + private EObject getModel(Object element) { + EObject eObject = null; + if(element != null && element instanceof StructuredSelection) { + StructuredSelection selection = (StructuredSelection)element; + Object o = selection.getFirstElement(); + eObject = resolveSemanticObject(o); + if(o instanceof IGraphicalEditPart) { + IGraphicalEditPart editPart = (IGraphicalEditPart)o; + eObject = editPart.resolveSemanticElement(); + } + } + return eObject; + } + + /** + * Resolve semantic element + * + * @param object + * the object to resolve + * @return <code>null</code> or the semantic element associated to the specified object + */ + private EObject resolveSemanticObject(Object object) { + if(object instanceof EObject) { + return (EObject)object; + } else if(object instanceof IAdaptable) { + IAdaptable adaptable = (IAdaptable)object; + if(adaptable.getAdapter(EObject.class) != null) { + return (EObject)adaptable.getAdapter(EObject.class); + } + } + return null; + } + + private IItemLabelProvider getItemLabelProvider(EObject eObject) { + IItemLabelProvider itemLabelProvider = null; + if(eObject != null) { + AdapterFactory adapterFactory = getEditFactory(eObject); + if(adapterFactory != null) { + return (IItemLabelProvider)adapterFactory.adapt(eObject, IItemLabelProviderClass); + } + } + return itemLabelProvider; + } + + /** + * Gets the edit factory. + * + * @param eobject + * the eobject + * + * @return the edits the factory + */ + public static AdapterFactory getEditFactory(EObject eobject) { + String uri = eobject.eClass().getEPackage().getNsURI(); + return getFactory(uri); + } + + /** + * Gets the factory from uri. + * + * @param uri + * the uri + * + * @return the factory + */ + public static AdapterFactory getFactory(String uri) { + AdapterFactory factory = factories.get(uri); + if(factory == null) { + IConfigurationElement[] extensions = Platform.getExtensionRegistry().getConfigurationElementsFor(EXT_FACTORIES); + for(IConfigurationElement e : extensions) { + if(uri.equals(e.getAttribute("uri"))) { //$NON-NLS-1$ + try { + factory = (AdapterFactory)e.createExecutableExtension("class"); //$NON-NLS-1$ + if(factory != null) { + factories.put(uri, factory); + } + } catch (CoreException e1) { + // do nothing + } + } + } + } + return factory; + } + +} |