Skip to content

Package: PersistTableStateServiceFactory

PersistTableStateServiceFactory

nameinstructionbranchcomplexitylinemethod
PersistTableStateServiceFactory()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
createService(EMFFormsViewContext)
M: 28 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
getPolicy()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getPriority()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getScope()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getType()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2016 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Johannes Faltermeier - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.internal.view.table.ui.swt.persistedstate;
15:
16: import java.text.MessageFormat;
17:
18: import org.eclipse.emf.ecp.spi.view.table.ui.swt.persistedstate.PersistTableStateService;
19: import org.eclipse.emf.ecp.view.spi.context.ViewModelContext;
20: import org.eclipse.emfforms.spi.core.services.view.EMFFormsViewContext;
21: import org.eclipse.emfforms.spi.core.services.view.EMFFormsViewServiceFactory;
22: import org.eclipse.emfforms.spi.core.services.view.EMFFormsViewServicePolicy;
23: import org.eclipse.emfforms.spi.core.services.view.EMFFormsViewServiceScope;
24: import org.osgi.service.component.annotations.Component;
25:
26: /**
27: * Factory for creating {@link PersistTableStateServiceImpl}.
28: *
29: * @author Johannes Faltermeier
30: *
31: */
32: @Component(name = "PersistTableStateServiceFactory", service = EMFFormsViewServiceFactory.class)
33: public class PersistTableStateServiceFactory implements EMFFormsViewServiceFactory<PersistTableStateService> {
34:
35:         @Override
36:         public EMFFormsViewServicePolicy getPolicy() {
37:                 return EMFFormsViewServicePolicy.IMMEDIATE;
38:         }
39:
40:         @Override
41:         public EMFFormsViewServiceScope getScope() {
42:                 return EMFFormsViewServiceScope.LOCAL;
43:         }
44:
45:         @Override
46:         public double getPriority() {
47:                 return 0;
48:         }
49:
50:         @Override
51:         public Class<PersistTableStateService> getType() {
52:                 return PersistTableStateService.class;
53:         }
54:
55:         @Override
56:         public PersistTableStateService createService(EMFFormsViewContext emfFormsViewContext) {
57:•                if (ViewModelContext.class.isInstance(emfFormsViewContext)) {
58:                         final PersistTableStateServiceImpl service = new PersistTableStateServiceImpl(
59:                                 ViewModelContext.class.cast(emfFormsViewContext));
60:                         return service;
61:                 }
62:                 throw new IllegalArgumentException(MessageFormat.format("Context of type {0} is not supported yet.", //$NON-NLS-1$
63:                         emfFormsViewContext.getClass().getSimpleName()));
64:         }
65:
66: }