Skip to content

Package: LeafConditionDmrOpenInNewContextStrategyProvider

LeafConditionDmrOpenInNewContextStrategyProvider

nameinstructionbranchcomplexitylinemethod
LeafConditionDmrOpenInNewContextStrategyProvider()
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%
getSelectionValidator()
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%
handles(EObject, EReference)
M: 0 C: 13
100%
M: 0 C: 6
100%
M: 0 C: 4
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
lambda$0(EStructuralFeature)
M: 0 C: 7
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
setEMFFormsDatabindingEMF(EMFFormsDatabindingEMF)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
setReportService(ReportService)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2019 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: * Lucas Koehler - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.view.internal.editor.handler;
15:
16: import org.eclipse.emf.ecore.EAttribute;
17: import org.eclipse.emf.ecore.EObject;
18: import org.eclipse.emf.ecore.EReference;
19: import org.eclipse.emf.ecp.ui.view.swt.reference.OpenInNewContextStrategy.Provider;
20: import org.eclipse.emf.ecp.view.spi.editor.controls.EStructuralFeatureSelectionValidator;
21: import org.eclipse.emf.ecp.view.spi.rule.model.LeafCondition;
22: import org.eclipse.emf.ecp.view.spi.rule.model.RulePackage;
23: import org.eclipse.emfforms.spi.common.report.ReportService;
24: import org.eclipse.emfforms.spi.core.services.databinding.emf.EMFFormsDatabindingEMF;
25: import org.osgi.service.component.annotations.Component;
26: import org.osgi.service.component.annotations.Reference;
27:
28: /**
29: * This provider registers a {@link org.eclipse.emf.ecp.ui.view.swt.reference.OpenInNewContextStrategy
30: * OpenInNewContextStrategy} to edit <strong>segment based</strong> domain model
31: * references for {@link org.eclipse.emf.ecp.view.spi.rule.model.LeafCondition LeafConditions}.
32: *
33: * @author Lucas Koehler
34: */
35: @Component(name = "LeafConditionDmrOpenInNewContextStrategyProvider", property = "service.ranking:Integer=50", service = {
36:         Provider.class })
37: public class LeafConditionDmrOpenInNewContextStrategyProvider extends RuleConditionDmrOpenInNewContextStrategyProvider {
38:
39:         @Override
40:         @Reference(unbind = "-")
41:         protected void setEMFFormsDatabindingEMF(EMFFormsDatabindingEMF databinding) {
42:                 super.setEMFFormsDatabindingEMF(databinding);
43:         }
44:
45:         @Override
46:         @Reference(unbind = "-")
47:         protected void setReportService(ReportService reportService) {
48:                 super.setReportService(reportService);
49:         }
50:
51:         @Override
52:         protected boolean handles(EObject owner, EReference reference) {
53:•                return isSegmentToolingEnabled()
54:•                        && owner instanceof LeafCondition
55:•                        && reference == RulePackage.Literals.LEAF_CONDITION__DOMAIN_MODEL_REFERENCE;
56:         }
57:
58:         @Override
59:         protected EStructuralFeatureSelectionValidator getSelectionValidator() {
60:•                return feature -> feature instanceof EAttribute ? null
61:                         : "A leaf condition's domain model reference must point to an attribute."; //$NON-NLS-1$
62:         }
63: }