Search in sources :

Example 21 with IEObjectDescription

use of org.eclipse.xtext.resource.IEObjectDescription in project xtext-eclipse by eclipse.

the class OverridingRuleRefactoringParticipant method getRenamedElementsOrProxies.

@Override
protected List<EObject> getRenamedElementsOrProxies(EObject originalTarget) {
    if (originalTarget instanceof AbstractRule) {
        List<IEObjectDescription> overridingRules = ruleOverrideUtil.getOverridingRules((AbstractRule) originalTarget);
        List<EObject> result = newArrayList();
        for (IEObjectDescription overridingRule : overridingRules) {
            result.add(overridingRule.getEObjectOrProxy());
        }
        return result;
    }
    return null;
}
Also used : EObject(org.eclipse.emf.ecore.EObject) AbstractRule(org.eclipse.xtext.AbstractRule) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription)

Example 22 with IEObjectDescription

use of org.eclipse.xtext.resource.IEObjectDescription in project xtext-eclipse by eclipse.

the class RuleOverrideUtil method getOverriddenRules.

public List<IEObjectDescription> getOverriddenRules(final AbstractRule originalRule) {
    Grammar grammar = GrammarUtil.getGrammar(originalRule);
    final List<IEObjectDescription> overriddenRules = newArrayList();
    IAcceptor<AbstractRule> acceptor = new IAcceptor<AbstractRule>() {

        @Override
        public void accept(AbstractRule overriddenRule) {
            if (overriddenRule != null) {
                IEObjectDescription description = EObjectDescription.create(qualifiedNameProvider.getFullyQualifiedName(overriddenRule), overriddenRule);
                overriddenRules.add(description);
            }
        }
    };
    findOverriddenRule(originalRule, grammar.getUsedGrammars(), acceptor);
    return overriddenRules;
}
Also used : IAcceptor(org.eclipse.xtext.util.IAcceptor) Grammar(org.eclipse.xtext.Grammar) AbstractRule(org.eclipse.xtext.AbstractRule) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription)

Example 23 with IEObjectDescription

use of org.eclipse.xtext.resource.IEObjectDescription in project xtext-eclipse by eclipse.

the class AbstractConstructorScopeTest method testGetElementByInstance_03.

@Test
public void testGetElementByInstance_03() {
    JvmAnnotationReference annotationReference = TypesFactory.eINSTANCE.createJvmAnnotationReference();
    IEObjectDescription element = getConstructorScope().getSingleElement(annotationReference);
    assertNull(element);
}
Also used : JvmAnnotationReference(org.eclipse.xtext.common.types.JvmAnnotationReference) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) Test(org.junit.Test)

Example 24 with IEObjectDescription

use of org.eclipse.xtext.resource.IEObjectDescription in project xtext-eclipse by eclipse.

the class AbstractConstructorScopeTest method testGetElementByName_01.

@Test
public void testGetElementByName_01() {
    IEObjectDescription objectElement = getConstructorScope().getSingleElement(QualifiedName.create(Object.class.getName()));
    assertNotNull(objectElement);
    assertFalse(objectElement.getEObjectOrProxy().eIsProxy());
    assertEquals(TypesPackage.Literals.JVM_CONSTRUCTOR, objectElement.getEClass());
    assertEquals(QualifiedName.create("java.lang.Object"), objectElement.getName());
}
Also used : IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) Test(org.junit.Test)

Example 25 with IEObjectDescription

use of org.eclipse.xtext.resource.IEObjectDescription in project xtext-eclipse by eclipse.

the class AbstractConstructorScopeTest method testGetElementByName_03.

@Test
public void testGetElementByName_03() {
    IEObjectDescription objectElement = getConstructorScope().getSingleElement(QualifiedName.create(int.class.getName()));
    assertNull(objectElement);
}
Also used : IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) Test(org.junit.Test)

Aggregations

IEObjectDescription (org.eclipse.xtext.resource.IEObjectDescription)324 Test (org.junit.Test)95 EObject (org.eclipse.emf.ecore.EObject)82 QualifiedName (org.eclipse.xtext.naming.QualifiedName)79 IScope (org.eclipse.xtext.scoping.IScope)56 URI (org.eclipse.emf.common.util.URI)41 IResourceDescription (org.eclipse.xtext.resource.IResourceDescription)33 EClass (org.eclipse.emf.ecore.EClass)30 Resource (org.eclipse.emf.ecore.resource.Resource)28 EObjectDescription (org.eclipse.xtext.resource.EObjectDescription)22 AliasedEObjectDescription (org.eclipse.xtext.resource.impl.AliasedEObjectDescription)22 ArrayList (java.util.ArrayList)19 IResourceDescriptions (org.eclipse.xtext.resource.IResourceDescriptions)14 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)12 ICompletionProposal (org.eclipse.jface.text.contentassist.ICompletionProposal)12 StyledString (org.eclipse.jface.viewers.StyledString)12 XtextResource (org.eclipse.xtext.resource.XtextResource)11 StringInputStream (org.eclipse.xtext.util.StringInputStream)11 EReference (org.eclipse.emf.ecore.EReference)10 List (java.util.List)9