blob: 10481f70263ab80e218f80343d2187707ab76208 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/**
* Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Florian Pirchner - Initial implementation
*/
package org.eclipse.osbp.ecview.uisemantics.scoping;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.xtext.resource.EObjectDescription;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.scoping.IScope;
import org.eclipse.xtext.scoping.impl.AbstractScope;
public class EPackageContentScope extends AbstractScope {
private EPackage pkg;
protected EPackageContentScope(EPackage pkg) {
super(IScope.NULLSCOPE, true);
this.pkg = pkg;
}
@Override
protected Iterable<IEObjectDescription> getAllLocalElements() {
List<IEObjectDescription> result = new ArrayList<IEObjectDescription>();
if (pkg != null) {
for (EClassifier eClassifier : pkg.getEClassifiers()) {
if (eClassifier instanceof EClass) {
result.add(EObjectDescription.create(eClassifier.getName(),
eClassifier));
}
}
}
return result;
}
}
|