Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-04-08 16:00:38 +0000
committerChristian W. Damus2014-04-15 17:49:12 +0000
commita69ae2b062345500a8aefc6c90d5795ecda3302b (patch)
tree4d5a41c921dc5ab0436e7e389b62c50d548d02ac /extraplugins
parentf12a871dde88d2ea09453b757daf02ec4847bc5a (diff)
downloadorg.eclipse.papyrus-a69ae2b062345500a8aefc6c90d5795ecda3302b.tar.gz
org.eclipse.papyrus-a69ae2b062345500a8aefc6c90d5795ecda3302b.tar.xz
org.eclipse.papyrus-a69ae2b062345500a8aefc6c90d5795ecda3302b.zip
431953: Stereotype garbage left in .uml file after removing profile (crash reason?)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=431953 Refactor the initialization of the ModelSet service so that its own service factory associates it with the service registry (removing the additional service-factory that did this). This introduces a new concept of service adapters that can externally provide a POJO service instance with the service lifecycle hooks, for POJOs that are injected into the service registry by a client and not created by a factory. Non-POJO services and factory-created services do not need this because they have the service lifecycle built-in. Update the CoreMultiDiagramEditor to start itself early to let other services such as the model set find it in the registry. Fix an NPE in the abstract editor triggered by the service registry's attempt to obtain a service adapter from it.
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSetServiceFactory.java49
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/CDOSearchQueryProvider.java10
2 files changed, 25 insertions, 34 deletions
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSetServiceFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSetServiceFactory.java
index 963380356f2..cb7e95ccce5 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSetServiceFactory.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSetServiceFactory.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,53 +8,46 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 431953 (pre-requisite refactoring of ModelSet service start-up)
+ *
*****************************************************************************/
package org.eclipse.papyrus.cdo.core.resource;
import org.eclipse.papyrus.cdo.core.IPapyrusRepositoryManager;
import org.eclipse.papyrus.cdo.internal.core.l10n.Messages;
-import org.eclipse.papyrus.infra.core.services.IServiceFactory;
+import org.eclipse.papyrus.infra.core.editor.ModelSetServiceFactory;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
/**
* This is the CDOAwareModelSetServiceFactory type. Enjoy.
*/
-public class CDOAwareModelSetServiceFactory
- implements IServiceFactory {
+public class CDOAwareModelSetServiceFactory extends ModelSetServiceFactory {
private IPapyrusRepositoryManager repositoryManager;
- private CDOAwareModelSet modelSet;
+ @Override
+ public void init(ServicesRegistry servicesRegistry) throws ServiceException {
+ repositoryManager = servicesRegistry.getService(IPapyrusRepositoryManager.class);
- public void init(ServicesRegistry servicesRegistry)
- throws ServiceException {
-
- repositoryManager = servicesRegistry
- .getService(IPapyrusRepositoryManager.class);
+ super.init(servicesRegistry);
}
- public void startService()
- throws ServiceException {
-
- // pass
- }
-
- public void disposeService()
- throws ServiceException {
-
- if (modelSet != null) {
- try {
- modelSet.unload();
- } catch (Exception e) {
- throw new ServiceException(Messages.CDOAwareModelSetServiceFactory_0, e);
- }
+ @Override
+ public void disposeService() throws ServiceException {
+ try {
+ super.disposeService();
+ } catch (ServiceException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new ServiceException(Messages.CDOAwareModelSetServiceFactory_0, e);
}
}
- public Object createServiceInstance() {
- modelSet = new CDOAwareModelSet(repositoryManager);
- return modelSet;
+ @Override
+ protected ModelSet createModelSet() {
+ return new CDOAwareModelSet(repositoryManager);
}
}
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/CDOSearchQueryProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/CDOSearchQueryProvider.java
index 95f421f890a..9688dcccc79 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/CDOSearchQueryProvider.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/CDOSearchQueryProvider.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 431953 (pre-requisite refactoring of ModelSet service start-up)
+ *
*****************************************************************************/
package org.eclipse.papyrus.cdo.uml.search.internal.ui.query;
@@ -40,7 +42,6 @@ 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.emf.utils.ServiceUtilsForResourceInitializerService;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet;
import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
import org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl;
@@ -196,11 +197,8 @@ public class CDOSearchQueryProvider implements IPapyrusQueryProvider {
ServicesRegistry services = new ServicesRegistry();
services.add(LabelProviderService.class, 10, new LabelProviderServiceImpl());
services.add(OpenElementService.class, 10, new CDOOpenElementService());
- services.startRegistry();
-
services.add(ModelSet.class, 10, new CDOAwareModelSet(PapyrusRepositoryManager.INSTANCE));
- services.add(ServiceUtilsForResourceInitializerService.class, 10, new ServiceUtilsForResourceInitializerService());
- services.startServicesByClassKeys(ModelSet.class, ServiceUtilsForResourceInitializerService.class);
+ services.startRegistry();
// create our own transaction for the model-set
view = repo.getCDOView(repo.createTransaction(ServiceUtils.getInstance().getModelSet(services)));

Back to the top