diff options
author | cletavernie | 2013-07-11 09:36:41 +0000 |
---|---|---|
committer | cletavernie | 2013-07-11 09:36:41 +0000 |
commit | 9255f979346065e0226e349979c48307a4a304b3 (patch) | |
tree | c87df08f3a903756b40c29850f4af836739724b1 /plugins | |
parent | c22a6b289038741e2b34e201ca96a174aa58e136 (diff) | |
download | org.eclipse.papyrus-9255f979346065e0226e349979c48307a4a304b3.tar.gz org.eclipse.papyrus-9255f979346065e0226e349979c48307a4a304b3.tar.xz org.eclipse.papyrus-9255f979346065e0226e349979c48307a4a304b3.zip |
[SVN] Move the semantic service to its final location
Diffstat (limited to 'plugins')
11 files changed, 308 insertions, 0 deletions
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/.classpath b/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/.classpath new file mode 100644 index 00000000000..2d1a4302f04 --- /dev/null +++ b/plugins/infra/services/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/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/.project b/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/.project new file mode 100644 index 00000000000..ef69d647090 --- /dev/null +++ b/plugins/infra/services/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/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..44217f8c068 --- /dev/null +++ b/plugins/infra/services/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/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/META-INF/MANIFEST.MF b/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..d26a2853b51 --- /dev/null +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.core;bundle-version="0.10.1",
+ org.eclipse.emf.ecore;bundle-version="2.6.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.1"
+Export-Package: org.eclipse.papyrus.infra.services.semantic,
+ org.eclipse.papyrus.infra.services.semantic.service
+Bundle-Vendor: Eclipse Modeling Project
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.10.1.qualifier
+Bundle-Name: Semantic Service (Incubation)
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.infra.services.semantic.Activato
+ r
+Bundle-SymbolicName: org.eclipse.papyrus.infra.services.semantic;singl
+ eton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/about.html b/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/about.html new file mode 100644 index 00000000000..82d49bf5f81 --- /dev/null +++ b/plugins/infra/services/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 ("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>
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/build.properties b/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/build.properties new file mode 100644 index 00000000000..baa36b183ee --- /dev/null +++ b/plugins/infra/services/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/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/plugin.properties b/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/plugin.properties new file mode 100644 index 00000000000..72885518636 --- /dev/null +++ b/plugins/infra/services/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/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/plugin.xml b/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/plugin.xml new file mode 100644 index 00000000000..a5f41240bf8 --- /dev/null +++ b/plugins/infra/services/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/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/src/org/eclipse/papyrus/infra/services/semantic/Activator.java b/plugins/infra/services/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/plugins/infra/services/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/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/src/org/eclipse/papyrus/infra/services/semantic/service/SemanticService.java b/plugins/infra/services/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/plugins/infra/services/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/plugins/infra/services/org.eclipse.papyrus.infra.services.semantic/src/org/eclipse/papyrus/infra/services/semantic/service/impl/SemanticServiceImpl.java b/plugins/infra/services/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/plugins/infra/services/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
+ }
+
+}
|