Skip to content

Package: AddEClassifierOnlyEDataTypeReferenceAction

AddEClassifierOnlyEDataTypeReferenceAction

nameinstructionbranchcomplexitylinemethod
AddEClassifierOnlyEDataTypeReferenceAction(EditingDomain, EStructuralFeature.Setting, IItemPropertyDescriptor, ReferenceService, Set)
M: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
getEClassifiersFromRegistry(Set)
M: 36 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2013 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.edit.ecore.swt.internal;
15:
16: import java.util.HashSet;
17: import java.util.Set;
18:
19: import org.eclipse.emf.ecore.EClassifier;
20: import org.eclipse.emf.ecore.EDataType;
21: import org.eclipse.emf.ecore.EPackage;
22: import org.eclipse.emf.ecore.EStructuralFeature.Setting;
23: import org.eclipse.emf.ecp.edit.spi.ReferenceService;
24: import org.eclipse.emf.edit.domain.EditingDomain;
25: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
26:
27: /**
28: * An action to select an {@link EClassifier} which is an {@link EDataType}. Will be used for editing the type of an
29: * {@link org.eclipse.emf.ecore.EAttribute EAttribute}.
30: *
31: * @author jfaltermeier
32: *
33: */
34: public class AddEClassifierOnlyEDataTypeReferenceAction extends AddEClassifierReferenceAction {
35:
36:         /**
37:          * Constructor.
38:          *
39:          * @param editingDomain the {@link EditingDomain} to use
40:          * @param setting the {@link Setting} to use
41:          * @param itemPropertyDescriptor the {@link IItemPropertyDescriptor} to use
42:          * @param referenceService the {@link ReferenceService} to use
43:          * @param packages the {@link EPackage}s to use
44:          */
45:         public AddEClassifierOnlyEDataTypeReferenceAction(EditingDomain editingDomain, Setting setting,
46:                 IItemPropertyDescriptor itemPropertyDescriptor, ReferenceService referenceService, Set<EPackage> packages) {
47:                 super(editingDomain, setting, itemPropertyDescriptor, referenceService, packages);
48:         }
49:
50:         /**
51:          * {@inheritDoc}
52:          *
53:          * @see org.eclipse.emf.ecp.edit.ecore.swt.internal.AddEClassifierReferenceAction#getEClassifiersFromRegistry()
54:          */
55:         @Override
56:         protected Set<EClassifier> getEClassifiersFromRegistry(Set<EPackage> ePackages) {
57:                 final Set<EClassifier> elements = new HashSet<EClassifier>();
58:•                for (final EPackage ePackage : ePackages) {
59:•                        for (final EClassifier eClassifier : ePackage.getEClassifiers()) {
60:•                                if (eClassifier instanceof EDataType) {
61:                                         elements.add(eClassifier);
62:                                 }
63:                         }
64:                 }
65:                 return elements;
66:         }
67:
68: }