Search in sources :

Example 1 with TypeReference

use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.

the class ImportURIScopingFragment2 method getDelegateScopeProvider.

@Override
public TypeReference getDelegateScopeProvider() {
    TypeReference _xifexpression = null;
    boolean _inheritsXbase = this._xbaseUsageDetector.inheritsXbase(this.getLanguage().getGrammar());
    if (_inheritsXbase) {
        _xifexpression = TypeReference.typeRef("org.eclipse.xtext.xbase.scoping.XImportSectionNamespaceScopeProvider");
    } else {
        _xifexpression = TypeReference.typeRef(SimpleLocalScopeProvider.class);
    }
    return _xifexpression;
}
Also used : SimpleLocalScopeProvider(org.eclipse.xtext.scoping.impl.SimpleLocalScopeProvider) TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference)

Example 2 with TypeReference

use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.

the class TypeReferenceTest method testBug508810.

@Test
public void testBug508810() {
    final ResourceSetImpl rs = new ResourceSetImpl();
    final TypeReference ref = new TypeReference(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY, rs);
    Assert.assertEquals("java.util.Map.Entry", ref.getName());
}
Also used : ResourceSetImpl(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl) TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference) Test(org.junit.Test)

Example 3 with TypeReference

use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.

the class TypeReferenceTest method testNestedType.

@Test
public void testNestedType() {
    final TypeReference ref = new TypeReference("java.util", "Map.Entry");
    Assert.assertEquals("java.util", ref.getPackageName());
    Assert.assertEquals("Entry", ref.getSimpleName());
    Assert.assertEquals(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("Map", "Entry")), ref.getSimpleNames());
}
Also used : TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference) Test(org.junit.Test)

Example 4 with TypeReference

use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.

the class TypeReferenceTest method testPackageName.

@Test
public void testPackageName() {
    final TypeReference ref = TypeReference.typeRef("org.example.MyType");
    Assert.assertEquals("MyType", ref.getSimpleName());
    Assert.assertEquals("org.example", ref.getPackageName());
}
Also used : TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference) Test(org.junit.Test)

Example 5 with TypeReference

use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.

the class TypeReferenceTest method testXtendPath.

@Test
public void testXtendPath() {
    final TypeReference ref = TypeReference.typeRef("org.example.MyType");
    Assert.assertEquals("org/example/MyType.xtend", ref.getXtendPath());
}
Also used : TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference) Test(org.junit.Test)

Aggregations

TypeReference (org.eclipse.xtext.xtext.generator.model.TypeReference)154 StringConcatenationClient (org.eclipse.xtend2.lib.StringConcatenationClient)119 GuiceModuleAccess (org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess)27 GeneratedJavaFileAccess (org.eclipse.xtext.xtext.generator.model.GeneratedJavaFileAccess)24 Grammar (org.eclipse.xtext.Grammar)23 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)21 ManifestAccess (org.eclipse.xtext.xtext.generator.model.ManifestAccess)17 List (java.util.List)14 Set (java.util.Set)12 Test (org.junit.Test)12 JavaFileAccess (org.eclipse.xtext.xtext.generator.model.JavaFileAccess)11 PluginXmlAccess (org.eclipse.xtext.xtext.generator.model.PluginXmlAccess)11 IClassAnnotation (org.eclipse.xtext.xtext.generator.model.annotations.IClassAnnotation)10 AbstractRule (org.eclipse.xtext.AbstractRule)9 SuppressWarningsAnnotation (org.eclipse.xtext.xtext.generator.model.annotations.SuppressWarningsAnnotation)8 IBundleProjectConfig (org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig)8 ContentAssistGrammarNaming (org.eclipse.xtext.xtext.generator.parser.antlr.ContentAssistGrammarNaming)7 EObject (org.eclipse.emf.ecore.EObject)6 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)6 ArrayList (java.util.ArrayList)5