Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauline DEVILLE2023-09-29 14:39:28 +0000
committerPauline DEVILLE2023-10-03 12:24:30 +0000
commit40b2ebb3e2672b4077fa165370caac8812c093ce (patch)
tree2ca055eac92cbb5850921d0685c94a65eb326a00
parent9435841479d2092f444b7b3d46e959021a9dc435 (diff)
downloadorg.eclipse.papyrus-streams/6.4-maintenance.tar.gz
org.eclipse.papyrus-streams/6.4-maintenance.tar.xz
org.eclipse.papyrus-streams/6.4-maintenance.zip
Bug 582415 - [ModelSet] Open api on ModelSetService to be able to usestreams/6.4-maintenance
URI Change-Id: I3f26a8d278c1d969ec8da19d7c78a9350aa9a741 Signed-off-by: Pauline DEVILLE <pauline.deville@cea.fr>
-rw-r--r--features/papyrus-main-features/org.eclipse.papyrus.infra.emf.feature/feature.xml2
-rw-r--r--features/papyrus-main-features/org.eclipse.papyrus.infra.emf.feature/pom.xml2
-rw-r--r--features/papyrus-main-features/org.eclipse.papyrus.infra.feature/feature.xml2
-rw-r--r--features/papyrus-main-features/org.eclipse.papyrus.infra.feature/pom.xml2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/pom.xml2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/api/IModelSetService.java31
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/ModelSetService.java91
8 files changed, 86 insertions, 48 deletions
diff --git a/features/papyrus-main-features/org.eclipse.papyrus.infra.emf.feature/feature.xml b/features/papyrus-main-features/org.eclipse.papyrus.infra.emf.feature/feature.xml
index a5e255153b1..93ee53ece48 100644
--- a/features/papyrus-main-features/org.eclipse.papyrus.infra.emf.feature/feature.xml
+++ b/features/papyrus-main-features/org.eclipse.papyrus.infra.emf.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.papyrus.infra.emf.feature"
label="%featureName"
- version="3.1.0.qualifier"
+ version="3.2.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="2.0.2">
diff --git a/features/papyrus-main-features/org.eclipse.papyrus.infra.emf.feature/pom.xml b/features/papyrus-main-features/org.eclipse.papyrus.infra.emf.feature/pom.xml
index be5bff61945..4a663038170 100644
--- a/features/papyrus-main-features/org.eclipse.papyrus.infra.emf.feature/pom.xml
+++ b/features/papyrus-main-features/org.eclipse.papyrus.infra.emf.feature/pom.xml
@@ -9,6 +9,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.emf.feature</artifactId>
- <version>3.1.0-SNAPSHOT</version>
+ <version>3.2.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project> \ No newline at end of file
diff --git a/features/papyrus-main-features/org.eclipse.papyrus.infra.feature/feature.xml b/features/papyrus-main-features/org.eclipse.papyrus.infra.feature/feature.xml
index a5366956563..753adb878f5 100644
--- a/features/papyrus-main-features/org.eclipse.papyrus.infra.feature/feature.xml
+++ b/features/papyrus-main-features/org.eclipse.papyrus.infra.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.papyrus.infra.feature"
label="Papyrus infra"
- version="3.2.0.qualifier"
+ version="3.3.0.qualifier"
provider-name="Eclipse Modeling Project"
license-feature="org.eclipse.license"
license-feature-version="2.0.2">
diff --git a/features/papyrus-main-features/org.eclipse.papyrus.infra.feature/pom.xml b/features/papyrus-main-features/org.eclipse.papyrus.infra.feature/pom.xml
index fabf5afd5ad..4439e39f493 100644
--- a/features/papyrus-main-features/org.eclipse.papyrus.infra.feature/pom.xml
+++ b/features/papyrus-main-features/org.eclipse.papyrus.infra.feature/pom.xml
@@ -7,6 +7,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.feature</artifactId>
- <version>3.2.0-SNAPSHOT</version>
+ <version>3.3.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project> \ No newline at end of file
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF
index 7bc2e21e573..d770a59e25c 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF
@@ -24,7 +24,7 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.6.0,4.0.0)",
org.eclipse.pde.core;bundle-version="[3.14.100,4.0.0)";resolution:=optional
Bundle-Vendor: Eclipse Modeling Project
Bundle-ActivationPolicy: lazy
-Bundle-Version: 4.3.0.qualifier
+Bundle-Version: 4.4.0.qualifier
Bundle-Name: EMF Tools
Bundle-Activator: org.eclipse.papyrus.infra.emf.Activator
Bundle-ManifestVersion: 2
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/pom.xml b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/pom.xml
index ebd53f9ab15..0001062f524 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/pom.xml
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/pom.xml
@@ -9,6 +9,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.emf</artifactId>
- <version>4.3.0-SNAPSHOT</version>
+ <version>4.4.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/api/IModelSetService.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/api/IModelSetService.java
index 62451b839f6..5f6d369c0b1 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/api/IModelSetService.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/api/IModelSetService.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2023 CEA LIST and others.s
+ * Copyright (c) 2023 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,6 +10,7 @@
*
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ * Pauline DEVILLE (CEA LIST) pauline.deville@cea.fr - Bug 582415
*
*****************************************************************************/
@@ -21,7 +22,7 @@ import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
/**
- * this class has all methods that implements use cases around model set.
+ * This class has all methods that implements use cases around model set.
*
* @since 4.3
*
@@ -29,27 +30,43 @@ import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
public interface IModelSetService {
/**
- * get the current modelSet from a services registry
+ * Get the current modelSet from a services registry
*
* @param servicesRegistry
- * the services registry see papyrus core
+ * the services registry see Papyrus core
+ * @return the ModelSet associated to the servicesRegistry if any, null otherwise
**/
public ModelSet getModelSet(ServicesRegistry servicesRegistry);
/**
- * create a modelSet, a command is executed in the command stack, for info
+ * Create a modelSet, a command is executed in the command stack, for info
*
* @param project
* the project where we want to create a modelSet
+ * @return the newly created ModelSet of null if cannot
**/
public ModelSet createModelSet(IProject project);
/**
- * load a model set from a given uri and given services registry
+ * Create a modelSet, a command is executed in the command stack, for info
*
* @param uri
+ * the uri of the project where we want to create a modelSet
+ * @param modelName
+ * the model name
+ * @return the newly created ModelSet of null if cannot
+ */
+ ModelSet createModelSet(URI uri, String modelName);
+
+ /**
+ * Load a model set from a given uri and given services registry
+ *
+ * @param uri
+ * the uri of the model to load
* @param servicesRegistry
- * @return the model set associate to the uri and services registry.
+ * the service registry associated
+ * @return the model set associated to the uri and services registry.
*/
public ModelSet loadModelSet(URI uri, ServicesRegistry servicesRegistry);
+
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/ModelSetService.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/ModelSetService.java
index 6c21a83e5fc..c95678e4293 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/ModelSetService.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/ModelSetService.java
@@ -10,6 +10,7 @@
*
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ * Pauline DEVILLE (CEA LIST) pauline.deville@cea.fr - Bug 582415
*
*****************************************************************************/
@@ -46,9 +47,12 @@ import com.google.common.collect.Iterables;
public class ModelSetService implements IModelSetService {
/**
- * @see org.org.eclipse.papyrus.infra.emf.api.IModelSetService#getModelSet()
*
- * @return
+ * @see org.eclipse.papyrus.infra.emf.api.IModelSetService#getModelSet(org.eclipse.papyrus.infra.core.services.ServicesRegistry)
+ *
+ * @param servicesRegistry
+ * the services registry see Papyrus core
+ * @return the ModelSet associated to the servicesRegistry if any, null otherwise
*/
@Override
public ModelSet getModelSet(ServicesRegistry servicesRegistry) {
@@ -65,60 +69,77 @@ public class ModelSetService implements IModelSetService {
* @see org.eclipse.papyrus.infra.emf.api.IModelSetService#createModelSet(org.eclipse.core.resources.IProject)
*
* @param project
- * @return
+ * the project where we want to create a modelSet
+ * @return the newly created ModelSet of null if cannot
*/
@Override
public ModelSet createModelSet(IProject project) {
+ URI diURI = URI.createPlatformResourceURI(project.getName(), false);// the name of the project
+ return createModelSet(diURI, project.getName());
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.api.IModelSetService#createModelSet(org.eclipse.emf.common.util.URI, java.lang.String)
+ *
+ * @param uri
+ * the uri of the project where we want to create a modelSet
+ * @param modelName
+ * the model name
+ * @return the newly created ModelSet of null if cannot
+ */
+ @Override
+ public ModelSet createModelSet(final URI uri, final String modelName) {
ModelSet modelSet = null;
- if (project != null) {
- ServicesRegistry registry = null;
+ ServicesRegistry registry = null;
+ try {
+ registry = new ExtensionServicesRegistry(org.eclipse.papyrus.infra.core.Activator.PLUGIN_ID);
+ } catch (ServiceException e) {
+ // Silently catch exception
+ }
+ if (registry != null) {
+ try {
+ registry.startServicesByClassKeys(ModelSet.class);
+ } catch (ServiceException ex) {
+ // Silently catch exception
+ }
try {
- registry = new ExtensionServicesRegistry(org.eclipse.papyrus.infra.core.Activator.PLUGIN_ID);
- } catch (ServiceException e) {
+ modelSet = registry.getService(ModelSet.class);
+ } catch (ServiceException e1) {
// Silently catch exception
}
- if (registry != null) {
+ if (modelSet != null) {
+ CommandStack stack = modelSet.getTransactionalEditingDomain().getCommandStack();
+ URI diURI = uri.appendSegment(modelName).appendFileExtension(DiModel.DI_FILE_EXTENSION);
+ Command command = new CreateModelInModelSetCommand(modelSet, diURI);
+
+ if (stack != null && command.canExecute()) {
+ stack.execute(command);
+ }
try {
- registry.startServicesByClassKeys(ModelSet.class);
- } catch (ServiceException ex) {
+ registry.startRegistry();
+ } catch (ServiceMultiException e) {
// Silently catch exception
}
try {
- modelSet = registry.getService(ModelSet.class);
- } catch (ServiceException e1) {
+ registry.getService(IPageManager.class);
+ } catch (ServiceException e) {
// Silently catch exception
}
- if (modelSet != null) {
- CommandStack stack = modelSet.getTransactionalEditingDomain().getCommandStack();
- URI diURI = URI.createPlatformResourceURI(project.getName(), false);// the name of the project
- diURI = diURI.appendSegment(project.getName());// the name of the model
- diURI = diURI.appendFileExtension(DiModel.DI_FILE_EXTENSION);
- Command command = new CreateModelInModelSetCommand(modelSet, diURI);
-
- if (stack != null && command.canExecute()) {
- stack.execute(command);
- }
- try {
- registry.startRegistry();
- } catch (ServiceMultiException e) {
- // Silently catch exception
- }
- try {
- registry.getService(IPageManager.class);
- } catch (ServiceException e) {
- // Silently catch exception
- }
- }
}
}
return modelSet;
}
/**
- * @see org.org.eclipse.papyrus.infra.emf.api.IModelSetService#loadModelSet(org.eclipse.emf.common.util.URI)
+ *
+ * @see org.eclipse.papyrus.infra.emf.api.IModelSetService#loadModelSet(org.eclipse.emf.common.util.URI, org.eclipse.papyrus.infra.core.services.ServicesRegistry)
*
* @param uri
- * @return
+ * the uri of the model to load
+ * @param servicesRegistry
+ * the service registry associated
+ * @return the model set associated to the uri and services registry.
*/
@Override
public ModelSet loadModelSet(URI uri, ServicesRegistry registry) {

Back to the top