Search in sources :

Example 1 with DefaultReferenceDescription

use of org.eclipse.xtext.resource.impl.DefaultReferenceDescription in project xtext-eclipse by eclipse.

the class DefaultReferenceFinderTest method testLocalRefs.

@Test
public void testLocalRefs() throws Exception {
    acceptor.expect(new DefaultReferenceDescription(elementB, elementA, RefactoringPackage.Literals.ELEMENT__REFERENCED, 0, EcoreUtil2.getPlatformResourceOrNormalizedURI(elementB)));
    findAllRefs(elementA, localResourceAccess);
    acceptor.assertFinished();
    acceptor.expect(new DefaultReferenceDescription(elementB, elementA, RefactoringPackage.Literals.ELEMENT__REFERENCED, 0, EcoreUtil2.getPlatformResourceOrNormalizedURI(elementB)));
    findRefs(elementA, resource, localResourceAccess);
    acceptor.assertFinished();
}
Also used : DefaultReferenceDescription(org.eclipse.xtext.resource.impl.DefaultReferenceDescription) Test(org.junit.Test)

Example 2 with DefaultReferenceDescription

use of org.eclipse.xtext.resource.impl.DefaultReferenceDescription in project xtext-eclipse by eclipse.

the class DefaultReferenceFinderTest method testExcludeLocalRefs.

@Test
public void testExcludeLocalRefs() throws Exception {
    Resource refResource = loadResource("ref.refactoringtestlanguage", "D { ref A }");
    EObject elementD = refResource.getContents().get(0).eContents().get(0);
    findRefs(elementA, resource, null);
    acceptor.assertFinished();
    acceptor.expect(new DefaultReferenceDescription(elementD, elementA, RefactoringPackage.Literals.ELEMENT__REFERENCED, 0, EcoreUtil2.getPlatformResourceOrNormalizedURI(elementD)));
    findAllRefs(elementA, null);
    acceptor.assertFinished();
    acceptor.expect(new DefaultReferenceDescription(elementD, elementA, RefactoringPackage.Literals.ELEMENT__REFERENCED, 0, EcoreUtil2.getPlatformResourceOrNormalizedURI(elementD)));
    findRefs(elementA, refResource, null);
    acceptor.assertFinished();
}
Also used : EObject(org.eclipse.emf.ecore.EObject) Resource(org.eclipse.emf.ecore.resource.Resource) DefaultReferenceDescription(org.eclipse.xtext.resource.impl.DefaultReferenceDescription) Test(org.junit.Test)

Example 3 with DefaultReferenceDescription

use of org.eclipse.xtext.resource.impl.DefaultReferenceDescription in project xtext-eclipse by eclipse.

the class DefaultReferenceFinderTest method testExternalRefs.

@Test
public void testExternalRefs() throws Exception {
    Resource refResource = loadResource("ref.refactoringtestlanguage", "D { ref C }");
    EObject elementD = refResource.getContents().get(0).eContents().get(0);
    findRefs(elementC, resource, localResourceAccess);
    acceptor.assertFinished();
    acceptor.expect(new DefaultReferenceDescription(elementD, elementC, RefactoringPackage.Literals.ELEMENT__REFERENCED, 0, EcoreUtil2.getPlatformResourceOrNormalizedURI(elementD)));
    findAllRefs(elementC, localResourceAccess);
    acceptor.assertFinished();
    acceptor.expect(new DefaultReferenceDescription(elementD, elementC, RefactoringPackage.Literals.ELEMENT__REFERENCED, 0, EcoreUtil2.getPlatformResourceOrNormalizedURI(elementD)));
    findRefs(elementC, refResource, localResourceAccess);
    acceptor.assertFinished();
}
Also used : EObject(org.eclipse.emf.ecore.EObject) Resource(org.eclipse.emf.ecore.resource.Resource) DefaultReferenceDescription(org.eclipse.xtext.resource.impl.DefaultReferenceDescription) Test(org.junit.Test)

Example 4 with DefaultReferenceDescription

use of org.eclipse.xtext.resource.impl.DefaultReferenceDescription in project xtext-eclipse by eclipse.

the class DefaultReferenceFinderTest method testLocalAndExternalRefs.

@Test
public void testLocalAndExternalRefs() throws Exception {
    Resource refResource = loadResource("ref.refactoringtestlanguage", "D { ref A }");
    EObject elementD = refResource.getContents().get(0).eContents().get(0);
    acceptor.expect(new DefaultReferenceDescription(elementB, elementA, RefactoringPackage.Literals.ELEMENT__REFERENCED, 0, EcoreUtil2.getPlatformResourceOrNormalizedURI(elementB)));
    findRefs(elementA, resource, localResourceAccess);
    acceptor.assertFinished();
    acceptor.expect(new DefaultReferenceDescription(elementB, elementA, RefactoringPackage.Literals.ELEMENT__REFERENCED, 0, EcoreUtil2.getPlatformResourceOrNormalizedURI(elementB)));
    acceptor.expect(new DefaultReferenceDescription(elementD, elementA, RefactoringPackage.Literals.ELEMENT__REFERENCED, 0, EcoreUtil2.getPlatformResourceOrNormalizedURI(elementD)));
    findAllRefs(elementA, localResourceAccess);
    acceptor.assertFinished();
    acceptor.expect(new DefaultReferenceDescription(elementD, elementA, RefactoringPackage.Literals.ELEMENT__REFERENCED, 0, EcoreUtil2.getPlatformResourceOrNormalizedURI(elementD)));
    findRefs(elementA, refResource, localResourceAccess);
    acceptor.assertFinished();
}
Also used : EObject(org.eclipse.emf.ecore.EObject) Resource(org.eclipse.emf.ecore.resource.Resource) DefaultReferenceDescription(org.eclipse.xtext.resource.impl.DefaultReferenceDescription) Test(org.junit.Test)

Example 5 with DefaultReferenceDescription

use of org.eclipse.xtext.resource.impl.DefaultReferenceDescription in project xtext-eclipse by eclipse.

the class DelegatingReferenceFinderTest method testLocalAndExternalRefs.

@Test
public void testLocalAndExternalRefs() throws Exception {
    Resource refResource = loadResource("ref.refactoringtestlanguage", "D { ref A }");
    EObject elementD = refResource.getContents().get(0).eContents().get(0);
    acceptor.expect(new DefaultReferenceDescription(elementB, elementA, RefactoringPackage.Literals.ELEMENT__REFERENCED, 0, EcoreUtil2.getPlatformResourceOrNormalizedURI(elementB)));
    findRefs(elementA, resource, localResourceAccess);
    acceptor.assertFinished();
    acceptor.expect(new DefaultReferenceDescription(elementB, elementA, RefactoringPackage.Literals.ELEMENT__REFERENCED, 0, EcoreUtil2.getPlatformResourceOrNormalizedURI(elementB)));
    acceptor.expect(new DefaultReferenceDescription(elementD, elementA, RefactoringPackage.Literals.ELEMENT__REFERENCED, 0, EcoreUtil2.getPlatformResourceOrNormalizedURI(elementD)));
    findAllRefs(elementA, localResourceAccess);
    acceptor.assertFinished();
    acceptor.expect(new DefaultReferenceDescription(elementD, elementA, RefactoringPackage.Literals.ELEMENT__REFERENCED, 0, EcoreUtil2.getPlatformResourceOrNormalizedURI(elementD)));
    findRefs(elementA, refResource, localResourceAccess);
    acceptor.assertFinished();
}
Also used : EObject(org.eclipse.emf.ecore.EObject) Resource(org.eclipse.emf.ecore.resource.Resource) DefaultReferenceDescription(org.eclipse.xtext.resource.impl.DefaultReferenceDescription) Test(org.junit.Test)

Aggregations

DefaultReferenceDescription (org.eclipse.xtext.resource.impl.DefaultReferenceDescription)10 EObject (org.eclipse.emf.ecore.EObject)8 Test (org.junit.Test)8 Resource (org.eclipse.emf.ecore.resource.Resource)6 URI (org.eclipse.emf.common.util.URI)2 EReference (org.eclipse.emf.ecore.EReference)2 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)2 IReferenceFinder (org.eclipse.xtext.findReferences.IReferenceFinder)2 IReferenceDescription (org.eclipse.xtext.resource.IReferenceDescription)2 Provider (com.google.inject.Provider)1 IProject (org.eclipse.core.resources.IProject)1 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)1 SubMonitor (org.eclipse.core.runtime.SubMonitor)1 LinkedPositionGroup (org.eclipse.jface.text.link.LinkedPositionGroup)1 SimpleResourceAccess (org.eclipse.n4js.ts.findReferences.SimpleResourceAccess)1 ReplaceEdit (org.eclipse.text.edits.ReplaceEdit)1 TargetURIs (org.eclipse.xtext.findReferences.TargetURIs)1 IGlobalServiceProvider (org.eclipse.xtext.resource.IGlobalServiceProvider)1 IResourceServiceProvider (org.eclipse.xtext.resource.IResourceServiceProvider)1 XtextEditor (org.eclipse.xtext.ui.editor.XtextEditor)1