Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/AbstractServiceUtils.java')
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/AbstractServiceUtils.java71
1 files changed, 15 insertions, 56 deletions
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/AbstractServiceUtils.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/AbstractServiceUtils.java
index 2ce85f89fc6..d52f56b2859 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/AbstractServiceUtils.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/AbstractServiceUtils.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010, 2015 LIFL & CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2010, 2016 LIFL, CEA LIST, Christian W. Damus, and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,20 +10,19 @@
* Contributors:
* Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation
* Christian W. Damus - bug 468030
+ * Christian W. Damus - bug 485220
*
*****************************************************************************/
package org.eclipse.papyrus.infra.core.utils;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.lifecycleevents.ILifeCycleEventsProvider;
+import org.eclipse.papyrus.infra.core.Activator;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
-import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
+import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.ui.IEditorPart;
+import org.eclipse.papyrus.infra.core.services.spi.IContextualServiceRegistryTracker;
/**
* Set of utility methods for accessing core Services. This class provide
@@ -50,30 +49,26 @@ public abstract class AbstractServiceUtils<T> {
abstract public ServicesRegistry getServiceRegistry(T from) throws ServiceException;
/**
- * Gets the {@link TransactionalEditingDomain} registered in the {@link ServicesRegistry}.
- *
- * @param from
- * @return
- * @throws ServiceException
- * If an error occurs while getting the requested service.
+ * Obtains the service registry determined automatically from the context of which
+ * Papyrus editor or view is active (implying the model that the user is currently editing).
+ *
+ * @return the contextual service registry, or {@code null} if none can be determined
*/
- public TransactionalEditingDomain getTransactionalEditingDomain(T from) throws ServiceException {
- return getServiceRegistry(from).getService(TransactionalEditingDomain.class);
+ protected ServicesRegistry getContextualServiceRegistry() {
+ IContextualServiceRegistryTracker tracker = Activator.getDefault().getContextualServiceRegistryTracker();
+ return (tracker == null) ? null : tracker.getServiceRegistry();
}
/**
- * Gets the {@link IPageMngr} registered in the {@link ServicesRegistry}.
+ * Gets the {@link TransactionalEditingDomain} registered in the {@link ServicesRegistry}.
*
* @param from
* @return
* @throws ServiceException
* If an error occurs while getting the requested service.
- *
- * @deprecated Use {@link #getIPageManager(Object)} instead
*/
- @Deprecated
- public IPageMngr getIPageMngr(T from) throws ServiceException {
- return getServiceRegistry(from).getService(IPageMngr.class);
+ public TransactionalEditingDomain getTransactionalEditingDomain(T from) throws ServiceException {
+ return getServiceRegistry(from).getService(TransactionalEditingDomain.class);
}
/**
@@ -101,42 +96,6 @@ public abstract class AbstractServiceUtils<T> {
}
/**
- * Gets the {@link ILifeCycleEventsProvider} registered in the {@link ServicesRegistry}.
- *
- * @param from
- * @return
- * @throws ServiceException
- * If an error occurs while getting the requested service.
- */
- public ILifeCycleEventsProvider getILifeCycleEventsProvider(T from) throws ServiceException {
- return getServiceRegistry(from).getService(ILifeCycleEventsProvider.class);
- }
-
- /**
- * Gets the {@link ISashWindowsContainer} registered in the {@link ServicesRegistry}.
- *
- * @param from
- * @return
- * @throws ServiceException
- * If an error occurs while getting the requested service.
- */
- public ISashWindowsContainer getISashWindowsContainer(T from) throws ServiceException {
- return getServiceRegistry(from).getService(ISashWindowsContainer.class);
- }
-
- /**
- * Gets the {@link IEditorPart} of the currently nested active editor.
- *
- * @param from
- * @return
- * @throws ServiceException
- * If an error occurs while getting the requested service.
- */
- public IEditorPart getNestedActiveIEditorPart(T from) throws ServiceException {
- return getISashWindowsContainer(from).getActiveEditor();
- }
-
- /**
* Returns an implementation of the requested service, from the specified context
*
* @param service

Back to the top