Java Code Examples for org.eclipse.xtext.xbase.imports.RewritableImportSection#addStaticExtensionImport()

The following examples show how to use org.eclipse.xtext.xbase.imports.RewritableImportSection#addStaticExtensionImport() . 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: AbstractRewritableImportSectionTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testVariousAddAsString() {
  final RewritableImportSection section = this.getSection();
  section.addStaticExtensionImport("java.util.Set", "*");
  section.addStaticImport("java.util.Collections", "*");
  section.addStaticImport("org.eclipse.xtext.xbase.lib.InputOutput", "println");
  section.addImport("java.util.List");
  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);
}
 
Example 2
Source File: AbstractRewritableImportSectionTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testVariousAddAsString_2() {
  final RewritableImportSection section = this.getSection();
  section.addStaticExtensionImport("java.util.Set", "*");
  section.addStaticImport("java.util.Collections", "*");
  section.addStaticImport("org.eclipse.xtext.xbase.lib.InputOutput", "println");
  section.addImport("java.util.List");
  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);
}
 
Example 3
Source File: AbstractRewritableImportSectionTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testVariousAddAsString_3() {
  final RewritableImportSection section = this.getSection();
  section.addStaticExtensionImport("com.google.common.base.Strings", "*");
  section.addStaticImport("com.google.common.base.Strings", "*");
  section.addStaticImport("com.google.common.base.Strings", "emptyToNull");
  section.addImport("com.google.common.base.Strings");
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("import static extension com.google.common.base.Strings.*");
  _builder.newLine();
  _builder.append("import com.google.common.base.Strings");
  _builder.newLine();
  this.assertEquals(section, _builder);
}
 
Example 4
Source File: AbstractRewritableImportSectionTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testDoubleAddAsString_2() {
  final RewritableImportSection section = this.getSection();
  section.addStaticExtensionImport("java.util.Collections", "*");
  section.addStaticExtensionImport("java.util.Collections", "*");
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("import static extension java.util.Collections.*");
  _builder.newLine();
  this.assertEquals(section, _builder);
}
 
Example 5
Source File: AbstractRewritableImportSectionTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testDoubleAddAsString_6() {
  final RewritableImportSection section = this.getSection(Collections.class);
  section.addStaticExtensionImport("java.util.Collections", "*");
  section.addStaticExtensionImport("java.util.Collections", "sort");
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("import java.util.Collections");
  _builder.newLine();
  _builder.append("import static extension java.util.Collections.*");
  _builder.newLine();
  this.assertEquals(section, _builder);
}
 
Example 6
Source File: AbstractRewritableImportSectionTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@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);
}
 
Example 7
Source File: AbstractRewritableImportSectionTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
protected boolean addExtensionImport(final RewritableImportSection section, final Class<?> javaClass) {
  return section.addStaticExtensionImport(this.jvmType(javaClass));
}