Search in sources :

Example 16 with Procedure0

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

the class AbstractFSSynchronizationTest method testCleanProjectAsOutput.

@Test
public void testCleanProjectAsOutput() {
    final Procedure1<OutputConfiguration> _function = (OutputConfiguration it) -> {
        it.setOutputDirectory("./");
        it.setCanClearOutputDirectory(true);
        it.setCleanUpDerivedResources(false);
    };
    final Procedure0 _function_1 = () -> {
        try {
            final File projectDirectory = this.project.getLocation().toFile();
            final int initialSize = ((List<File>) Conversions.doWrapArray(projectDirectory.listFiles())).size();
            Assert.assertNotEquals(0, initialSize);
            IResourcesSetupUtil.createFile(this.project.getFile(("src/Foo" + this.F_EXT)).getFullPath(), "object Foo");
            IResourcesSetupUtil.reallyWaitForAutoBuild();
            final int expectedSize = ((List<File>) Conversions.doWrapArray(projectDirectory.listFiles())).size();
            Assert.assertNotEquals(initialSize, expectedSize);
            IResourcesSetupUtil.cleanBuild();
            Assert.assertEquals(expectedSize, ((List<File>) Conversions.doWrapArray(projectDirectory.listFiles())).size());
        } catch (Throwable _e) {
            throw Exceptions.sneakyThrow(_e);
        }
    };
    this.withOutputConfiguration(_function, _function_1);
}
Also used : Procedure0(org.eclipse.xtext.xbase.lib.Procedures.Procedure0) OutputConfiguration(org.eclipse.xtext.generator.OutputConfiguration) List(java.util.List) File(java.io.File) IFile(org.eclipse.core.resources.IFile) AbstractBuilderParticipantTest(org.eclipse.xtext.builder.impl.AbstractBuilderParticipantTest) Test(org.junit.Test)

Example 17 with Procedure0

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

the class AbstractFSSynchronizationTest method testDeleteTraceFileWithProjectAsOutput.

@Test
public void testDeleteTraceFileWithProjectAsOutput() {
    final Procedure1<OutputConfiguration> _function = (OutputConfiguration it) -> {
        it.setOutputDirectory("./");
    };
    final Procedure0 _function_1 = () -> {
        this.testDeleteTraceFile(this.project);
    };
    this.withOutputConfiguration(_function, _function_1);
}
Also used : Procedure0(org.eclipse.xtext.xbase.lib.Procedures.Procedure0) OutputConfiguration(org.eclipse.xtext.generator.OutputConfiguration) AbstractBuilderParticipantTest(org.eclipse.xtext.builder.impl.AbstractBuilderParticipantTest) Test(org.junit.Test)

Example 18 with Procedure0

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

the class AbstractFSSynchronizationTest method testCleanUpProjectDerivedResourcesWithUpdateDerived.

@Test
public void testCleanUpProjectDerivedResourcesWithUpdateDerived() {
    final Procedure1<OutputConfiguration> _function = (OutputConfiguration it) -> {
        it.setOutputDirectory("./");
    };
    final Procedure0 _function_1 = () -> {
        this.testCleanUpDerivedResourcesWithUpdateDerived(this.project);
    };
    this.withOutputConfiguration(_function, _function_1);
}
Also used : Procedure0(org.eclipse.xtext.xbase.lib.Procedures.Procedure0) OutputConfiguration(org.eclipse.xtext.generator.OutputConfiguration) AbstractBuilderParticipantTest(org.eclipse.xtext.builder.impl.AbstractBuilderParticipantTest) Test(org.junit.Test)

Example 19 with Procedure0

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

the class CheckMutableClassDeclarationProcessor method doRegisterGlobals.

@Override
public void doRegisterGlobals(final ClassDeclaration annotatedClass, @Extension final RegisterGlobalsContext context) {
    final Procedure1<String> _function = (String qualifiedName) -> {
        context.registerClass(qualifiedName);
    };
    MutableAssert.assertValidQualifiedName("qualifiedName", "foo.Bar", _function);
    final Procedure0 _function_1 = () -> {
        context.registerClass("foo.Bar");
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "The type \'foo.Bar\' has already been registered.", _function_1);
    final Procedure1<String> _function_2 = (String qualifiedName) -> {
        context.registerAnnotationType(qualifiedName);
    };
    MutableAssert.assertValidQualifiedName("qualifiedName", "foo.Bar2", _function_2);
    final Procedure0 _function_3 = () -> {
        context.registerAnnotationType("foo.Bar2");
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "The type \'foo.Bar2\' has already been registered.", _function_3);
    final Procedure1<String> _function_4 = (String qualifiedName) -> {
        context.registerEnumerationType(qualifiedName);
    };
    MutableAssert.assertValidQualifiedName("qualifiedName", "foo.Bar3", _function_4);
    final Procedure0 _function_5 = () -> {
        context.registerEnumerationType("foo.Bar3");
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "The type \'foo.Bar3\' has already been registered.", _function_5);
    final Procedure1<String> _function_6 = (String qualifiedName) -> {
        context.registerInterface(qualifiedName);
    };
    MutableAssert.assertValidQualifiedName("qualifiedName", "foo.Bar4", _function_6);
    final Procedure0 _function_7 = () -> {
        context.registerInterface("foo.Bar4");
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "The type \'foo.Bar4\' has already been registered.", _function_7);
}
Also used : Procedure0(org.eclipse.xtext.xbase.lib.Procedures.Procedure0)

Example 20 with Procedure0

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

the class CheckMutableEnumerationTypeDeclarationProcessor method doTransform.

@Override
public void doTransform(final List<? extends MutableEnumerationTypeDeclaration> annotatedTargetElements, @Extension final TransformationContext context) {
    for (final MutableEnumerationTypeDeclaration enumeration : annotatedTargetElements) {
        {
            final Procedure1<String> _function = (String identifier) -> {
                final Procedure1<MutableEnumerationValueDeclaration> _function_1 = (MutableEnumerationValueDeclaration it) -> {
                };
                enumeration.addValue(identifier, _function_1).remove();
            };
            MutableAssert.assertValidJavaIdentifier("name", _function);
            final Procedure0 _function_1 = () -> {
                enumeration.addValue("foo", null);
            };
            MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "initializer cannot be null", _function_1);
            final Procedure0 _function_2 = () -> {
                final Procedure1<MutableEnumerationValueDeclaration> _function_3 = (MutableEnumerationValueDeclaration it) -> {
                };
                enumeration.addValue("A", _function_3).setVisibility(Visibility.PRIVATE);
            };
            MutableAssert.<UnsupportedOperationException>assertThrowable(UnsupportedOperationException.class, "It is not possible to change visibility of enumeration value.", _function_2);
        }
    }
}
Also used : MutableEnumerationTypeDeclaration(org.eclipse.xtend.lib.macro.declaration.MutableEnumerationTypeDeclaration) Procedure0(org.eclipse.xtext.xbase.lib.Procedures.Procedure0) Procedure1(org.eclipse.xtext.xbase.lib.Procedures.Procedure1) MutableEnumerationValueDeclaration(org.eclipse.xtend.lib.macro.declaration.MutableEnumerationValueDeclaration)

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