Search in sources :

Example 31 with Procedure0

use of org.eclipse.xtext.xbase.lib.Procedures.Procedure0 in project xtext-xtend by eclipse.

the class TypesChangingQueuedBuildDataTest method createPrimaryAndSecondaryType.

@Test
public void createPrimaryAndSecondaryType() {
    final Procedure0 _function = () -> {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("public class Bar {}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("class Foo {}");
        _builder.newLine();
        this.create("Bar.java", _builder.toString());
    };
    this.assertThereAreDeltas(_function, "Foo", "Bar");
}
Also used : Procedure0(org.eclipse.xtext.xbase.lib.Procedures.Procedure0) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) AbstractQueuedBuildDataTest(org.eclipse.xtend.ide.tests.builder.AbstractQueuedBuildDataTest) Test(org.junit.Test)

Example 32 with Procedure0

use of org.eclipse.xtext.xbase.lib.Procedures.Procedure0 in project xtext-xtend by eclipse.

the class TypesChangingQueuedBuildDataTest method deletePrimaryAndNestedTypes2.

@Test
public void deletePrimaryAndNestedTypes2() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("package mypackage;");
    _builder.newLine();
    _builder.newLine();
    _builder.append("public class Bar {");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\t");
    _builder.append("public class Foo {");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("public class Foo3 {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\t");
    _builder.append("public static class Foo2 {}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    this.create("/mypackage/Bar.java", _builder.toString());
    final Procedure0 _function = () -> {
        this.delete("/mypackage/Bar.java");
    };
    this.assertThereAreDeltas(_function, "mypackage.Bar", "mypackage.Bar$Foo$Foo3", "mypackage.Bar$Foo2", "mypackage.Bar$Foo");
}
Also used : Procedure0(org.eclipse.xtext.xbase.lib.Procedures.Procedure0) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) AbstractQueuedBuildDataTest(org.eclipse.xtend.ide.tests.builder.AbstractQueuedBuildDataTest) Test(org.junit.Test)

Example 33 with Procedure0

use of org.eclipse.xtext.xbase.lib.Procedures.Procedure0 in project xtext-xtend by eclipse.

the class TypesChangingQueuedBuildDataTest method createPrimaryType.

@Test
public void createPrimaryType() {
    final Procedure0 _function = () -> {
        this.create("Bar.java", "public class Bar {}");
    };
    this.assertThereAreDeltas(_function, "Bar");
}
Also used : Procedure0(org.eclipse.xtext.xbase.lib.Procedures.Procedure0) AbstractQueuedBuildDataTest(org.eclipse.xtend.ide.tests.builder.AbstractQueuedBuildDataTest) Test(org.junit.Test)

Example 34 with Procedure0

use of org.eclipse.xtext.xbase.lib.Procedures.Procedure0 in project xtext-xtend by eclipse.

the class TypesChangingQueuedBuildDataTest method deletePrimaryAndSecondaryType.

@Test
public void deletePrimaryAndSecondaryType() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("public class Bar {}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Foo {}");
    _builder.newLine();
    this.create("Bar.java", _builder.toString());
    final Procedure0 _function = () -> {
        this.delete("Bar.java");
    };
    this.assertThereAreDeltas(_function, "Bar", "Foo");
}
Also used : Procedure0(org.eclipse.xtext.xbase.lib.Procedures.Procedure0) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) AbstractQueuedBuildDataTest(org.eclipse.xtend.ide.tests.builder.AbstractQueuedBuildDataTest) Test(org.junit.Test)

Example 35 with Procedure0

use of org.eclipse.xtext.xbase.lib.Procedures.Procedure0 in project xtext-xtend by eclipse.

the class AbstractSingleEditorQueuedBuildTest method renamePrimaryTopLevelTypeWithinDefaultPackage.

@Test
public void renamePrimaryTopLevelTypeWithinDefaultPackage() {
    try {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("public class Bar {}");
        _builder.newLine();
        this.testHelper.createFile("Bar.java", _builder.toString());
        final Procedure0 _function = () -> {
            this.save("Bar.java", "Bar", "Bar2");
        };
        this.assertThereAreDeltas(_function, "Bar", "Bar2");
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : Procedure0(org.eclipse.xtext.xbase.lib.Procedures.Procedure0) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) AbstractQueuedBuildDataTest(org.eclipse.xtend.ide.tests.builder.AbstractQueuedBuildDataTest) Test(org.junit.Test)

Aggregations

Procedure0 (org.eclipse.xtext.xbase.lib.Procedures.Procedure0)102 Test (org.junit.Test)79 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)53 AbstractQueuedBuildDataTest (org.eclipse.xtend.ide.tests.builder.AbstractQueuedBuildDataTest)50 AbstractBuilderParticipantTest (org.eclipse.xtext.builder.impl.AbstractBuilderParticipantTest)13 OutputConfiguration (org.eclipse.xtext.generator.OutputConfiguration)13 BadLocationException (org.eclipse.jface.text.BadLocationException)11 IFile (org.eclipse.core.resources.IFile)6 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)6 LocalArgumentsVariable (org.eclipse.n4js.n4JS.LocalArgumentsVariable)5 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)5 Procedure1 (org.eclipse.xtext.xbase.lib.Procedures.Procedure1)5 List (java.util.List)4 TypeReference (org.eclipse.xtend.lib.macro.declaration.TypeReference)4 File (java.io.File)3 IResourceDescription (org.eclipse.xtext.resource.IResourceDescription)3 Matcher (java.util.regex.Matcher)2 JavaModelException (org.eclipse.jdt.core.JavaModelException)2 MutableFieldDeclaration (org.eclipse.xtend.lib.macro.declaration.MutableFieldDeclaration)2 MutableInterfaceDeclaration (org.eclipse.xtend.lib.macro.declaration.MutableInterfaceDeclaration)2