Search in sources :

Example 6 with LazyLinkingResource

use of org.eclipse.xtext.linking.lazy.LazyLinkingResource in project xtext-xtend by eclipse.

the class SmokeTest method testResourceUpdateSkipLastCharacters.

@Test
public void testResourceUpdateSkipLastCharacters() throws Exception {
    for (String string : smokeTestModels) {
        LazyLinkingResource resource = createResource("");
        for (int i = 0; i < string.length(); i++) {
            logProgress(i);
            compareWithNewResource(resource, i, 0, String.valueOf(string.charAt(i)));
        }
    }
}
Also used : LazyLinkingResource(org.eclipse.xtext.linking.lazy.LazyLinkingResource) Test(org.junit.Test)

Example 7 with LazyLinkingResource

use of org.eclipse.xtext.linking.lazy.LazyLinkingResource in project xtext-xtend by eclipse.

the class SmokeTest method testResourceUpdateSkipCharacterInBetween.

@Test
public void testResourceUpdateSkipCharacterInBetween() throws Exception {
    for (String string : smokeTestModels) {
        LazyLinkingResource resource = createResource(string.substring(1));
        for (int i = 0; i < string.length() - 1; i++) {
            logProgress(i);
            compareWithNewResource(resource, i, 1, String.valueOf(string.charAt(i)));
        }
    }
}
Also used : LazyLinkingResource(org.eclipse.xtext.linking.lazy.LazyLinkingResource) Test(org.junit.Test)

Example 8 with LazyLinkingResource

use of org.eclipse.xtext.linking.lazy.LazyLinkingResource in project xtext-xtend by eclipse.

the class LinkingErrorTest method assertNoExceptions.

protected void assertNoExceptions(EObject object) {
    Resource resource = object.eResource();
    if (resource instanceof LazyLinkingResource)
        ((LazyLinkingResource) resource).resolveLazyCrossReferences(CancelIndicator.NullImpl);
    List<Diagnostic> errors = object.eResource().getErrors();
    for (Diagnostic error : errors) {
        if (error instanceof ExceptionDiagnostic) {
            ((ExceptionDiagnostic) error).getException().printStackTrace();
        }
        assertFalse(error.toString(), error instanceof ExceptionDiagnostic);
    }
    validateWithoutException((XtextResource) resource);
}
Also used : LazyLinkingResource(org.eclipse.xtext.linking.lazy.LazyLinkingResource) ExceptionDiagnostic(org.eclipse.xtext.diagnostics.ExceptionDiagnostic) LazyLinkingResource(org.eclipse.xtext.linking.lazy.LazyLinkingResource) XtextResource(org.eclipse.xtext.resource.XtextResource) Resource(org.eclipse.emf.ecore.resource.Resource) BasicDiagnostic(org.eclipse.emf.common.util.BasicDiagnostic) Diagnostic(org.eclipse.emf.ecore.resource.Resource.Diagnostic) ExceptionDiagnostic(org.eclipse.xtext.diagnostics.ExceptionDiagnostic)

Example 9 with LazyLinkingResource

use of org.eclipse.xtext.linking.lazy.LazyLinkingResource in project xtext-core by eclipse.

the class AbstractXtextTests method doGetResource.

protected XtextResource doGetResource(InputStream in, URI uri) throws Exception {
    XtextResourceSet rs = get(XtextResourceSet.class);
    rs.setClasspathURIContext(getClasspathURIContext());
    XtextResource resource = (XtextResource) getResourceFactory().createResource(uri);
    rs.getResources().add(resource);
    resource.load(in, null);
    if (resource instanceof LazyLinkingResource) {
        ((LazyLinkingResource) resource).resolveLazyCrossReferences(CancelIndicator.NullImpl);
    } else {
        EcoreUtil.resolveAll(resource);
    }
    return resource;
}
Also used : XtextResourceSet(org.eclipse.xtext.resource.XtextResourceSet) LazyLinkingResource(org.eclipse.xtext.linking.lazy.LazyLinkingResource) XtextResource(org.eclipse.xtext.resource.XtextResource)

Example 10 with LazyLinkingResource

use of org.eclipse.xtext.linking.lazy.LazyLinkingResource in project xtext-core by eclipse.

the class AbstractCleaningLinker method beforeModelLinked.

protected void beforeModelLinked(EObject model, IDiagnosticConsumer diagnosticsConsumer) {
    Resource resource = model.eResource();
    if (resource instanceof LazyLinkingResource) {
        ((LazyLinkingResource) resource).clearLazyProxyInformation();
    }
    ImportedNamesAdapter adapter = ImportedNamesAdapter.find(resource);
    if (adapter != null)
        adapter.clear();
}
Also used : LazyLinkingResource(org.eclipse.xtext.linking.lazy.LazyLinkingResource) LazyLinkingResource(org.eclipse.xtext.linking.lazy.LazyLinkingResource) Resource(org.eclipse.emf.ecore.resource.Resource)

Aggregations

LazyLinkingResource (org.eclipse.xtext.linking.lazy.LazyLinkingResource)16 Test (org.junit.Test)8 ICompositeNode (org.eclipse.xtext.nodemodel.ICompositeNode)5 INode (org.eclipse.xtext.nodemodel.INode)5 ReplaceRegion (org.eclipse.xtext.util.ReplaceRegion)4 XtextResource (org.eclipse.xtext.resource.XtextResource)3 XtextResourceSet (org.eclipse.xtext.resource.XtextResourceSet)3 Resource (org.eclipse.emf.ecore.resource.Resource)2 ANTLRStringStream (org.antlr.runtime.ANTLRStringStream)1 CommonToken (org.antlr.runtime.CommonToken)1 Token (org.antlr.runtime.Token)1 BasicDiagnostic (org.eclipse.emf.common.util.BasicDiagnostic)1 Diagnostic (org.eclipse.emf.ecore.resource.Resource.Diagnostic)1 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)1 InternalXtendLexer (org.eclipse.xtend.core.parser.antlr.internal.InternalXtendLexer)1 ExceptionDiagnostic (org.eclipse.xtext.diagnostics.ExceptionDiagnostic)1 Lexer (org.eclipse.xtext.parser.antlr.Lexer)1 StringInputStream (org.eclipse.xtext.util.StringInputStream)1