Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2012-11-23 12:08:54 +0000
committercletavernie2012-11-23 12:08:54 +0000
commit714725d728b22cbb3cecfc6b3cb4327b74f68199 (patch)
treef66efb5693ea80ba514dac6ce94141bdf6f798e2
parent2511ee0bc5fcc06626d9a6f3b8e6d9ceaabaa7ac (diff)
downloadorg.eclipse.papyrus-714725d728b22cbb3cecfc6b3cb4327b74f68199.tar.gz
org.eclipse.papyrus-714725d728b22cbb3cecfc6b3cb4327b74f68199.tar.xz
org.eclipse.papyrus-714725d728b22cbb3cecfc6b3cb4327b74f68199.zip
394965: [Core Services] Papyrus should provide a Service to retrieve the semantic roots of a ModelSet
https://bugs.eclipse.org/bugs/show_bug.cgi?id=394965 Initial import
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.semantic/.classpath7
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.semantic/.project28
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.semantic/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.semantic/META-INF/MANIFEST.MF16
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.semantic/about.html28
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.semantic/build.properties8
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.semantic/plugin.properties13
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.semantic/plugin.xml15
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.semantic/src/org/eclipse/papyrus/infra/services/semantic/Activator.java66
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.semantic/src/org/eclipse/papyrus/infra/services/semantic/service/SemanticService.java40
-rw-r--r--incoming/org.eclipse.papyrus.infra.services.semantic/src/org/eclipse/papyrus/infra/services/semantic/service/impl/SemanticServiceImpl.java77
11 files changed, 305 insertions, 0 deletions
diff --git a/incoming/org.eclipse.papyrus.infra.services.semantic/.classpath b/incoming/org.eclipse.papyrus.infra.services.semantic/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.semantic/.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.semantic/.project b/incoming/org.eclipse.papyrus.infra.services.semantic/.project
new file mode 100644
index 00000000000..ef69d647090
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.semantic/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.services.semantic</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.semantic/.settings/org.eclipse.jdt.core.prefs b/incoming/org.eclipse.papyrus.infra.services.semantic/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..44217f8c068
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.semantic/.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/incoming/org.eclipse.papyrus.infra.services.semantic/META-INF/MANIFEST.MF b/incoming/org.eclipse.papyrus.infra.services.semantic/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..693f7e865c8
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.semantic/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Semantic Service (Incubation)
+Bundle-SymbolicName: org.eclipse.papyrus.infra.services.semantic;singleton:=true
+Bundle-Version: 0.10.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.infra.services.semantic.Activator
+Bundle-Vendor: Eclipse Modeling Project
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
+ org.eclipse.emf.ecore;bundle-version="2.6.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.semantic,
+ org.eclipse.papyrus.infra.services.semantic.service
diff --git a/incoming/org.eclipse.papyrus.infra.services.semantic/about.html b/incoming/org.eclipse.papyrus.infra.services.semantic/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.semantic/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.semantic/build.properties b/incoming/org.eclipse.papyrus.infra.services.semantic/build.properties
new file mode 100644
index 00000000000..baa36b183ee
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.semantic/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.properties,\
+ plugin.xml
+src.includes = about.html
diff --git a/incoming/org.eclipse.papyrus.infra.services.semantic/plugin.properties b/incoming/org.eclipse.papyrus.infra.services.semantic/plugin.properties
new file mode 100644
index 00000000000..72885518636
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.semantic/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=Semantic Service (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/incoming/org.eclipse.papyrus.infra.services.semantic/plugin.xml b/incoming/org.eclipse.papyrus.infra.services.semantic/plugin.xml
new file mode 100644
index 00000000000..a5f41240bf8
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.semantic/plugin.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.infra.core.service">
+ <service
+ classname="org.eclipse.papyrus.infra.services.semantic.service.impl.SemanticServiceImpl"
+ description="Default implementation for the SemanticService"
+ id="org.eclipse.papyrus.infra.services.semantic.service.SemanticService"
+ priority="1"
+ startKind="lazy">
+ </service>
+ </extension>
+
+</plugin>
diff --git a/incoming/org.eclipse.papyrus.infra.services.semantic/src/org/eclipse/papyrus/infra/services/semantic/Activator.java b/incoming/org.eclipse.papyrus.infra.services.semantic/src/org/eclipse/papyrus/infra/services/semantic/Activator.java
new file mode 100644
index 00000000000..b3b7cc5e663
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.semantic/src/org/eclipse/papyrus/infra/services/semantic/Activator.java
@@ -0,0 +1,66 @@
+/*****************************************************************************
+ * 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.semantic;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.osgi.framework.BundleContext;
+
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.services.semantic"; //$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.semantic/src/org/eclipse/papyrus/infra/services/semantic/service/SemanticService.java b/incoming/org.eclipse.papyrus.infra.services.semantic/src/org/eclipse/papyrus/infra/services/semantic/service/SemanticService.java
new file mode 100644
index 00000000000..e979fb7fcfe
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.semantic/src/org/eclipse/papyrus/infra/services/semantic/service/SemanticService.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * 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.semantic.service;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.core.resource.IModel;
+import org.eclipse.papyrus.infra.core.services.IService;
+
+/**
+ * A service to retrieve the semantic root(s) and IModel(s) for the current context
+ *
+ * @author Camille Letavernier
+ *
+ */
+public interface SemanticService extends IService {
+
+ /**
+ * Retrieves the semantic root EObject(s) for the current context
+ *
+ * @return
+ */
+ public EObject[] getSemanticRoots();
+
+ /**
+ * Retrieves the semantic root IModel for the current context
+ *
+ * @return
+ */
+ public IModel[] getSemanticIModels();
+
+}
diff --git a/incoming/org.eclipse.papyrus.infra.services.semantic/src/org/eclipse/papyrus/infra/services/semantic/service/impl/SemanticServiceImpl.java b/incoming/org.eclipse.papyrus.infra.services.semantic/src/org/eclipse/papyrus/infra/services/semantic/service/impl/SemanticServiceImpl.java
new file mode 100644
index 00000000000..5de780c5dea
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.services.semantic/src/org/eclipse/papyrus/infra/services/semantic/service/impl/SemanticServiceImpl.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * 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.semantic.service.impl;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.papyrus.infra.core.resource.IModel;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.services.semantic.Activator;
+import org.eclipse.papyrus.infra.services.semantic.service.SemanticService;
+
+/**
+ * Default implementation of the SemanticService. The result is composed of the root elements
+ * of each resource of the current model set
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class SemanticServiceImpl implements SemanticService {
+
+ private ServicesRegistry registry;
+
+ public void init(ServicesRegistry servicesRegistry) throws ServiceException {
+ this.registry = servicesRegistry;
+ }
+
+ public void startService() throws ServiceException {
+ //Nothing
+ }
+
+ public void disposeService() throws ServiceException {
+ registry = null;
+ }
+
+ /**
+ * The default implements returns all root EObjects
+ */
+ public EObject[] getSemanticRoots() {
+ try {
+ List<EObject> rootElements = new LinkedList<EObject>();
+
+ ModelSet modelSet = ServiceUtils.getInstance().getModelSet(registry);
+ for(Resource resource : modelSet.getResources()) {
+ rootElements.addAll(resource.getContents());
+ }
+
+ return rootElements.toArray(new EObject[rootElements.size()]);
+
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ return new EObject[0];
+ }
+ }
+
+ /**
+ * TODO: Unsupported
+ */
+ public IModel[] getSemanticIModels() {
+ return new IModel[0]; //Currently, it is not possible to retrieve all registered IModels for a ModelSet
+ }
+
+}

Back to the top