Skip to content

Package: MultiReferenceTooltipModifier

MultiReferenceTooltipModifier

nameinstructionbranchcomplexitylinemethod
MultiReferenceTooltipModifier()
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%
getPriority()
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%
modifyString(String, EStructuralFeature.Setting)
M: 0 C: 34
100%
M: 0 C: 6
100%
M: 0 C: 4
100%
M: 0 C: 11
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2018 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: * Eugen Neufeld - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.view.internal.table.swt.cell;
15:
16: import java.util.List;
17:
18: import org.eclipse.emf.ecore.EAttribute;
19: import org.eclipse.emf.ecore.EStructuralFeature.Setting;
20: import org.eclipse.emf.ecp.view.spi.provider.ECPStringModifier;
21: import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
22: import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
23:
24: /**
25: * Tooltip modifier which provides tooltips for multi reference cells.
26: *
27: * @author Eugen Neufeld
28: * @since 1.18
29: *
30: */
31: public class MultiReferenceTooltipModifier implements ECPStringModifier {
32:
33:         @Override
34:         public String modifyString(String text, Setting setting) {
35:•                if (setting == null) {
36:                         return text;
37:                 }
38:•                if (setting.getEStructuralFeature() instanceof EAttribute) {
39:                         return text;
40:                 }
41:•                if (!setting.getEStructuralFeature().isMany()) {
42:                         return text;
43:                 }
44:                 final AdapterFactoryItemDelegator adapterFactoryItemDelegator = new AdapterFactoryItemDelegator(
45:                         ((AdapterFactoryEditingDomain) AdapterFactoryEditingDomain
46:                                 .getEditingDomainFor(setting.getEObject())).getAdapterFactory());
47:                 final List<?> referencedValues = (List<?>) setting.get(true);
48:
49:                 return adapterFactoryItemDelegator.getText(referencedValues);
50:
51:         }
52:
53:         @Override
54:         public double getPriority() {
55:                 return 20;
56:         }
57: }