Skip to content

Package: TerminalStep

TerminalStep

nameinstructionbranchcomplexitylinemethod
TerminalStep(VElement, EObject, EStructuralFeature, Runnable)
M: 0 C: 15
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
drillDown()
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%
getDomainModel()
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%
getFeature()
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%
getType()
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getViewModel()
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%
reveal()
M: 0 C: 7
100%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 0 C: 3
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2019 Christian W. Damus 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: * Christian W. Damus - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.spi.core.services.reveal;
15:
16: import org.eclipse.emf.ecore.EObject;
17: import org.eclipse.emf.ecore.EStructuralFeature;
18: import org.eclipse.emf.ecp.view.spi.model.VElement;
19:
20: /**
21: * The terminal step of a successful reveal.
22: *
23: * @since 1.22
24: */
25: final class TerminalStep implements RevealStep {
26:
27:         private final VElement viewModel;
28:         private final EObject domainModel;
29:         private final EStructuralFeature feature;
30:         private final Runnable revealAction;
31:
32:         /**
33:          * Initializes me.
34:          *
35:          * @param viewModel the view model in which I reveal the object
36:          * @param domainModel the object that I reveal
37:          * @param feature the feature of the domain model object that I specfically revealed
38:          * @param revealAction an action that reveals the object in the UI
39:          */
40:         TerminalStep(VElement viewModel, EObject domainModel, EStructuralFeature feature, Runnable revealAction) {
41:                 super();
42:
43:                 this.viewModel = viewModel;
44:                 this.domainModel = domainModel;
45:                 this.feature = feature;
46:                 this.revealAction = revealAction;
47:         }
48:
49:         @Override
50:         public RevealStepKind getType() {
51:                 return RevealStepKind.TERMINAL;
52:         }
53:
54:         @Override
55:         public VElement getViewModel() {
56:                 return viewModel;
57:         }
58:
59:         @Override
60:         public EObject getDomainModel() {
61:                 return domainModel;
62:         }
63:
64:         @Override
65:         public EStructuralFeature getFeature() {
66:                 return feature;
67:         }
68:
69:         /**
70:          * There is no further step in the reveal process.
71:          *
72:          * @return {@code null}
73:          */
74:         @Override
75:         public RevealStep drillDown() {
76:                 return null;
77:         }
78:
79:         @Override
80:         public void reveal() {
81:•                if (revealAction != null) {
82:                         revealAction.run();
83:                 }
84:         }
85:
86: }