org.eclipse.xtext.common.types.access.impl.Primitives Java Examples
The following examples show how to use
org.eclipse.xtext.common.types.access.impl.Primitives.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BinaryClassFinder.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
public Cache() { super(500); for (Class<?> primitiveType : Primitives.ALL_PRIMITIVE_TYPES) { put(primitiveType.getName(), new BinaryClass.Primitive(primitiveType)); } }
Example #2
Source File: JdtBasedSimpleTypeScope.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override protected Iterable<IEObjectDescription> internalGetAllElements() { IJavaProject javaProject = getTypeProvider().getJavaProject(); if (javaProject == null) return Collections.emptyList(); final List<IEObjectDescription> allScopedElements = Lists.newArrayListWithExpectedSize(25000); try { IJavaSearchScope searchScope = SearchEngine.createJavaSearchScope(new IJavaElement[] { javaProject }); for(Class<?> clazz: Primitives.ALL_PRIMITIVE_TYPES) { IEObjectDescription primitive = createScopedElement(clazz.getName()); if (primitive != null) allScopedElements.add(primitive); } TypeNameRequestor nameMatchRequestor = new TypeNameRequestor() { @Override public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path) { StringBuilder fqName = new StringBuilder(packageName.length + simpleTypeName.length + 1); if (packageName.length != 0) { fqName.append(packageName); fqName.append('.'); } for(char[] enclosingType: enclosingTypeNames) { fqName.append(enclosingType); fqName.append('.'); } fqName.append(simpleTypeName); String fullyQualifiedName = fqName.toString(); InternalEObject proxy = createProxy(fullyQualifiedName); Map<String, String> userData = null; if (enclosingTypeNames.length == 0) { userData = ImmutableMap.of("flags", String.valueOf(modifiers)); } else { userData = ImmutableMap.of("flags", String.valueOf(modifiers), "inner", "true"); } IEObjectDescription eObjectDescription = EObjectDescription.create(getQualifiedNameConverter().toQualifiedName(fullyQualifiedName), proxy, userData); if (eObjectDescription != null) allScopedElements.add(eObjectDescription); } }; collectContents(searchScope, nameMatchRequestor); } catch (JavaModelException e) { // ignore } return allScopedElements; }
Example #3
Source File: PrimitiveAwareScope.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
protected boolean isPrimitive(QualifiedName name) { return name.getSegmentCount() == 1 && Primitives.forName(name.getFirstSegment()) != null; }