Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 596451c844489e8242e1b6aae4906f5aaf99e545 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*****************************************************************************
 * Copyright (c) 2012 Cedric Dumoulin.
 *
 *    
 * 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
 *
 *****************************************************************************/
package org.eclipse.papyrus.infra.emf.utils;

import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;

/**
 * This AdapterFactory is used to attach a reference on the ServiceRegiqtry to an EMF ResourceSet.
 * 
 * This adapterFactory is not a real factory: no adapter is created.
 * 
 * @author cedric dumoulin
 * 
 */
public class ServiceRegistryAdapterFactory extends AdapterFactoryImpl {

	/**
	 * ID used to register the factory in the ResourceSet.
	 */
	static final public String TYPE_ID = ServiceRegistryAdapterFactory.class.getName() + "TypeId";

	/**
	 * The reference to the ServiceRegistry.
	 */
	protected ServicesRegistry servicesRegistry;

	/**
	 * @param servicesRegistry
	 */
	public ServiceRegistryAdapterFactory(ServicesRegistry servicesRegistry) {
		this.servicesRegistry = servicesRegistry;
	}

	/**
	 * 
	 * @return the associated {@link ServicesRegistry}
	 */
	public ServicesRegistry getServicesRegistry() {
		return servicesRegistry;
	}

	@Override
	public boolean isFactoryForType(Object type) {
		return type.equals(TYPE_ID);
	}
}

Back to the top