Search in sources :

Example 21 with RewritableImportSection

use of org.eclipse.xtext.xbase.imports.RewritableImportSection in project xtext-xtend by eclipse.

the class AbstractRewritableImportSectionTest method testVariousAdd.

@Test
public void testVariousAdd() {
    final RewritableImportSection section = this.getSection();
    this.addExtensionImport(section, Set.class);
    this.addStaticImport(section, Collections.class);
    this.addImport(section, List.class);
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import static extension java.util.Set.*");
    _builder.newLine();
    _builder.append("import static java.util.Collections.*");
    _builder.newLine();
    _builder.append("import java.util.List");
    _builder.newLine();
    this.assertEquals(section, _builder);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) RewritableImportSection(org.eclipse.xtext.xbase.imports.RewritableImportSection) Test(org.junit.Test)

Example 22 with RewritableImportSection

use of org.eclipse.xtext.xbase.imports.RewritableImportSection in project xtext-xtend by eclipse.

the class AbstractRewritableImportSectionTest method testDoubleAddAsString_5.

@Test
public void testDoubleAddAsString_5() {
    final RewritableImportSection section = this.getSection(Collections.class);
    section.addStaticImport("java.util.Collections", "sort");
    section.addStaticImport("java.util.Collections", "*");
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.util.Collections");
    _builder.newLine();
    _builder.append("import static java.util.Collections.sort");
    _builder.newLine();
    _builder.append("import static java.util.Collections.*");
    _builder.newLine();
    this.assertEquals(section, _builder);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) RewritableImportSection(org.eclipse.xtext.xbase.imports.RewritableImportSection) Test(org.junit.Test)

Example 23 with RewritableImportSection

use of org.eclipse.xtext.xbase.imports.RewritableImportSection in project xtext-xtend by eclipse.

the class AbstractRewritableImportSectionTest method testSimpleAdd.

@Test
public void testSimpleAdd() {
    final RewritableImportSection section = this.getSection(Set.class);
    this.addImport(section, List.class);
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.util.Set");
    _builder.newLine();
    _builder.append("import java.util.List");
    _builder.newLine();
    this.assertEquals(section, _builder);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) RewritableImportSection(org.eclipse.xtext.xbase.imports.RewritableImportSection) Test(org.junit.Test)

Example 24 with RewritableImportSection

use of org.eclipse.xtext.xbase.imports.RewritableImportSection in project xtext-xtend by eclipse.

the class AbstractRewritableImportSectionTest method testVariousAdd_2.

@Test
public void testVariousAdd_2() {
    final RewritableImportSection section = this.getSection();
    this.addExtensionImport(section, Set.class);
    this.addStaticImport(section, Set.class);
    this.addImport(section, Set.class);
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import static extension java.util.Set.*");
    _builder.newLine();
    _builder.append("import java.util.Set");
    _builder.newLine();
    this.assertEquals(section, _builder);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) RewritableImportSection(org.eclipse.xtext.xbase.imports.RewritableImportSection) Test(org.junit.Test)

Example 25 with RewritableImportSection

use of org.eclipse.xtext.xbase.imports.RewritableImportSection in project xtext-xtend by eclipse.

the class AbstractRewritableImportSectionTest method testDoubleAddAsString_7.

@Test
public void testDoubleAddAsString_7() {
    final RewritableImportSection section = this.getSection(Collections.class);
    section.addStaticExtensionImport("java.util.Collections", "sort");
    section.addStaticExtensionImport("java.util.Collections", "*");
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.util.Collections");
    _builder.newLine();
    _builder.append("import static extension java.util.Collections.sort");
    _builder.newLine();
    _builder.append("import static extension java.util.Collections.*");
    _builder.newLine();
    this.assertEquals(section, _builder);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) RewritableImportSection(org.eclipse.xtext.xbase.imports.RewritableImportSection) Test(org.junit.Test)

Aggregations

RewritableImportSection (org.eclipse.xtext.xbase.imports.RewritableImportSection)33 Test (org.junit.Test)33 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)30 ICompletionProposal (org.eclipse.jface.text.contentassist.ICompletionProposal)1 JvmDeclaredType (org.eclipse.xtext.common.types.JvmDeclaredType)1 ReplaceRegion (org.eclipse.xtext.util.ReplaceRegion)1 ImportOrganizingProposal (org.eclipse.xtext.xbase.ui.contentassist.ImportOrganizingProposal)1 ReplacingAppendable (org.eclipse.xtext.xbase.ui.contentassist.ReplacingAppendable)1