Package: SingletonAdapterFactoryEditingDomainProvider

SingletonAdapterFactoryEditingDomainProvider

nameinstructionbranchcomplexitylinemethod
SingletonAdapterFactoryEditingDomainProvider()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
get()
M: 0 C: 10
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 3
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2016 RCP Vision (http://www.rcp-vision.com) and others.
3: * All rights reserved. This program and the accompanying materials
4: * are made available under the terms of the Eclipse Public License v1.0
5: * which accompanies this distribution, and is available at
6: * http://www.eclipse.org/legal/epl-v10.html
7: *
8: * Contributors:
9: * Lorenzo Bettini - initial API and implementation
10: *******************************************************************************/
11: package org.eclipse.emf.parsley.edit.domain;
12:
13: import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
14:
15: import com.google.inject.Singleton;
16:
17: /**
18: * This ensures that only one instance of {@link AdapterFactoryEditingDomain}
19: * will be used by the same injector (according to the semantics of
20: * {@link Singleton}).
21: *
22: * @author Lorenzo Bettini - Initial contribution and API
23: *
24: */
25: @Singleton
26: public class SingletonAdapterFactoryEditingDomainProvider extends DefaultAdapterFactoryEditingDomainProvider {
27:
28:         private AdapterFactoryEditingDomain singleton;
29:
30:         @Override
31:         public AdapterFactoryEditingDomain get() {
32:•                if (singleton == null) {
33:                         singleton = super.get();
34:                 }
35:                 return singleton;
36:         }
37: }