Package: EmfParsleyDslResourceDescriptionStrategy

EmfParsleyDslResourceDescriptionStrategy

nameinstructionbranchcomplexitylinemethod
EmfParsleyDslResourceDescriptionStrategy()
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%
createEObjectDescriptions(EObject, IAcceptor)
M: 0 C: 21
100%
M: 1 C: 3
75%
M: 1 C: 2
67%
M: 0 C: 6
100%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (c) 2016 RCP Vision (http://www.rcp-vision.com) and others.
3: * All rights reserved. This program and the accompanying materials
4: * are made available under the terms of the Eclipse Public License v1.0
5: * which accompanies this distribution, and is available at
6: * http://www.eclipse.org/legal/epl-v10.html
7: *
8: * Contributors:
9: * Lorenzo Bettini - initial API and implementation
10: */
11: package org.eclipse.emf.parsley.dsl.scoping;
12:
13: import com.google.inject.Singleton;
14: import org.eclipse.emf.ecore.EObject;
15: import org.eclipse.emf.parsley.dsl.model.ViewSpecification;
16: import org.eclipse.xtext.resource.EObjectDescription;
17: import org.eclipse.xtext.resource.IEObjectDescription;
18: import org.eclipse.xtext.util.IAcceptor;
19: import org.eclipse.xtext.xbase.resource.XbaseResourceDescriptionStrategy;
20:
21: /**
22: * We need to index part specification ids to avoid duplicate ids across
23: * files in the same project.
24: *
25: * @author Lorenzo Bettini - initial API and implementation
26: */
27: @Singleton
28: @SuppressWarnings("all")
29: public class EmfParsleyDslResourceDescriptionStrategy extends XbaseResourceDescriptionStrategy {
30: @Override
31: public boolean createEObjectDescriptions(final EObject elem, final IAcceptor<IEObjectDescription> acceptor) {
32:• if ((elem instanceof ViewSpecification)) {
33: final String id = ((ViewSpecification)elem).getId();
34:• if ((id != null)) {
35: acceptor.accept(EObjectDescription.create(id, elem));
36: return true;
37: }
38: }
39: return super.createEObjectDescriptions(elem, acceptor);
40: }
41: }