Search in sources :

Example 6 with XImportDeclaration

use of org.eclipse.xtext.xtype.XImportDeclaration in project xtext-xtend by eclipse.

the class ParserTest method testImport_02.

@Test
public void testImport_02() throws Exception {
    XImportDeclaration importDeclaration = importDeclaration("import java . util . /*comment*/ List");
    assertNotNull(importDeclaration);
    assertEquals("java.util.List", importDeclaration.getImportedTypeName());
    assertFalse(importDeclaration.isWildcard());
    assertFalse(importDeclaration.isStatic());
    assertFalse(importDeclaration.isExtension());
}
Also used : XImportDeclaration(org.eclipse.xtext.xtype.XImportDeclaration) Test(org.junit.Test)

Example 7 with XImportDeclaration

use of org.eclipse.xtext.xtype.XImportDeclaration in project xtext-xtend by eclipse.

the class ParserTest method testImport_03.

@Test
public void testImport_03() throws Exception {
    XImportDeclaration importDeclaration = importDeclaration("import static java.util.Collections. * // foobar");
    assertNotNull(importDeclaration);
    assertEquals("java.util.Collections", importDeclaration.getImportedTypeName());
    assertTrue(importDeclaration.isWildcard());
    assertTrue(importDeclaration.isStatic());
    assertFalse(importDeclaration.isExtension());
}
Also used : XImportDeclaration(org.eclipse.xtext.xtype.XImportDeclaration) Test(org.junit.Test)

Example 8 with XImportDeclaration

use of org.eclipse.xtext.xtype.XImportDeclaration in project xtext-xtend by eclipse.

the class ParserTest method testImport_04.

@Test
public void testImport_04() throws Exception {
    XImportDeclaration importDeclaration = importDeclaration("import static extension java.lang.reflect.\nArrays.*");
    assertNotNull(importDeclaration);
    assertEquals("java.lang.reflect.Arrays", importDeclaration.getImportedTypeName());
    assertTrue(importDeclaration.isWildcard());
    assertTrue(importDeclaration.isStatic());
    assertTrue(importDeclaration.isExtension());
}
Also used : XImportDeclaration(org.eclipse.xtext.xtype.XImportDeclaration) Test(org.junit.Test)

Example 9 with XImportDeclaration

use of org.eclipse.xtext.xtype.XImportDeclaration in project xtext-xtend by eclipse.

the class ParserTest method testBug367949.

@Test
public void testBug367949() throws Exception {
    XImportDeclaration importDeclaration = importDeclaration("import org.eclipse.xtext.^create");
    assertNotNull(importDeclaration);
    assertEquals("org.eclipse.xtext.create", importDeclaration.getImportedTypeName());
}
Also used : XImportDeclaration(org.eclipse.xtext.xtype.XImportDeclaration) Test(org.junit.Test)

Example 10 with XImportDeclaration

use of org.eclipse.xtext.xtype.XImportDeclaration in project xtext-xtend by eclipse.

the class ModelExtensionsTest method testXtendImport.

@Test
public void testXtendImport() throws Exception {
    XImportDeclaration xtendImport = xtypeFactory.createXImportDeclaration();
    assertFalse(xtendImport.isWildcard());
    assertNull(xtendImport.getImportedTypeName());
    xtendImport.setImportedNamespace("");
    assertFalse(xtendImport.isWildcard());
    assertEquals("", xtendImport.getImportedTypeName());
    xtendImport.setImportedNamespace("java.lang.Collections.*");
    assertTrue(xtendImport.isWildcard());
    assertEquals("java.lang.Collections", xtendImport.getImportedTypeName());
}
Also used : XImportDeclaration(org.eclipse.xtext.xtype.XImportDeclaration) Test(org.junit.Test)

Aggregations

XImportDeclaration (org.eclipse.xtext.xtype.XImportDeclaration)10 Test (org.junit.Test)6 JvmDeclaredType (org.eclipse.xtext.common.types.JvmDeclaredType)3 Resource (org.eclipse.emf.ecore.resource.Resource)2 XtendMember (org.eclipse.xtend.core.xtend.XtendMember)2 JvmType (org.eclipse.xtext.common.types.JvmType)2 JvmTypeParameter (org.eclipse.xtext.common.types.JvmTypeParameter)2 XImportSection (org.eclipse.xtext.xtype.XImportSection)2 Provider (com.google.inject.Provider)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 EList (org.eclipse.emf.common.util.EList)1 EClass (org.eclipse.emf.ecore.EClass)1 EObject (org.eclipse.emf.ecore.EObject)1 EPackage (org.eclipse.emf.ecore.EPackage)1 ProcessorInstanceForJvmTypeProvider (org.eclipse.xtend.core.macro.ProcessorInstanceForJvmTypeProvider)1 AnonymousClass (org.eclipse.xtend.core.xtend.AnonymousClass)1 RichString (org.eclipse.xtend.core.xtend.RichString)1 RichStringLiteral (org.eclipse.xtend.core.xtend.RichStringLiteral)1