Skip to content

Package: ECPDeleteServiceImpl

ECPDeleteServiceImpl

nameinstructionbranchcomplexitylinemethod
ECPDeleteServiceImpl()
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%
deleteElement(Object)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
deleteElements(Collection)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
dispose()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
getECPProject()
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%
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%
instantiate(ViewModelContext)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2015 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.spi.ui;
15:
16: import java.util.Collection;
17: import java.util.Collections;
18:
19: import org.eclipse.emf.ecp.core.ECPProject;
20: import org.eclipse.emf.ecp.core.util.ECPUtil;
21: import org.eclipse.emf.ecp.edit.spi.DeleteService;
22: import org.eclipse.emf.ecp.view.spi.context.ViewModelContext;
23:
24: /**
25: * ECP specific implementation of the {@link org.eclipse.emf.ecp.edit.spi.DeleteService DeleteService}.
26: *
27: * @author jfaltermeier
28: * @since 1.6
29: *
30: */
31: public class ECPDeleteServiceImpl implements DeleteService {
32:
33:         private ECPProject ecpProject;
34:
35:         /**
36:          * {@inheritDoc}
37:          *
38:          * @see org.eclipse.emf.ecp.view.spi.context.ViewModelService#instantiate(org.eclipse.emf.ecp.view.spi.context.ViewModelContext)
39:          */
40:         @Override
41:         public void instantiate(ViewModelContext context) {
42:                 ecpProject = ECPUtil.getECPProjectManager().getProject(context.getDomainModel());
43:         }
44:
45:         /**
46:          * {@inheritDoc}
47:          *
48:          * @see org.eclipse.emf.ecp.view.spi.context.ViewModelService#dispose()
49:          */
50:         @Override
51:         public void dispose() {
52:                 ecpProject = null;
53:         }
54:
55:         /**
56:          * {@inheritDoc}
57:          *
58:          * @see org.eclipse.emf.ecp.view.spi.context.ViewModelService#getPriority()
59:          */
60:         @Override
61:         public int getPriority() {
62:                 return 0;
63:         }
64:
65:         /**
66:          *
67:          * {@inheritDoc}
68:          *
69:          * @see org.eclipse.emf.ecp.edit.spi.EMFDeleteServiceImpl#deleteElements(java.util.Collection)
70:          */
71:         @Override
72:         public void deleteElements(Collection<Object> toDelete) {
73:                 getECPProject().deleteElements(toDelete);
74:         }
75:
76:         /**
77:          *
78:          * {@inheritDoc}
79:          *
80:          * @see org.eclipse.emf.ecp.edit.spi.EMFDeleteServiceImpl#deleteElement(java.lang.Object)
81:          */
82:         @Override
83:         public void deleteElement(Object toDelete) {
84:                 getECPProject().deleteElements(Collections.singleton(toDelete));
85:         }
86:
87:         /**
88:          * Returns the ECPProject.
89:          *
90:          * @return the project
91:          */
92:         ECPProject getECPProject() {
93:                 return ecpProject;
94:         }
95:
96: }