Search in sources :

Example 1 with ReferenceHolder

use of org.eclipse.xtext.common.types.xtext.ui.refactoringTestLanguage.ReferenceHolder in project xtext-eclipse by eclipse.

the class RefactoringTestLanguageSemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == RefactoringTestLanguagePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case RefactoringTestLanguagePackage.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
            case RefactoringTestLanguagePackage.REFERENCE_HOLDER:
                sequence_ReferenceHolder(context, (ReferenceHolder) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) ReferenceHolder(org.eclipse.xtext.common.types.xtext.ui.refactoringTestLanguage.ReferenceHolder) Model(org.eclipse.xtext.common.types.xtext.ui.refactoringTestLanguage.Model) Parameter(org.eclipse.xtext.Parameter) EPackage(org.eclipse.emf.ecore.EPackage)

Example 2 with ReferenceHolder

use of org.eclipse.xtext.common.types.xtext.ui.refactoringTestLanguage.ReferenceHolder in project xtext-eclipse by eclipse.

the class RefactoringTestLanguage1SemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == RefactoringTestLanguagePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case RefactoringTestLanguagePackage.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
            case RefactoringTestLanguagePackage.REFERENCE_HOLDER:
                sequence_ReferenceHolder(context, (ReferenceHolder) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) ReferenceHolder(org.eclipse.xtext.common.types.xtext.ui.refactoringTestLanguage.ReferenceHolder) Model(org.eclipse.xtext.common.types.xtext.ui.refactoringTestLanguage.Model) Parameter(org.eclipse.xtext.Parameter) EPackage(org.eclipse.emf.ecore.EPackage)

Example 3 with ReferenceHolder

use of org.eclipse.xtext.common.types.xtext.ui.refactoringTestLanguage.ReferenceHolder in project xtext-eclipse by eclipse.

the class RefactoringTestLanguage2SemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == RefactoringTestLanguagePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case RefactoringTestLanguagePackage.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
            case RefactoringTestLanguagePackage.REFERENCE_HOLDER:
                sequence_ReferenceHolder(context, (ReferenceHolder) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) ReferenceHolder(org.eclipse.xtext.common.types.xtext.ui.refactoringTestLanguage.ReferenceHolder) Model(org.eclipse.xtext.common.types.xtext.ui.refactoringTestLanguage.Model) Parameter(org.eclipse.xtext.Parameter) EPackage(org.eclipse.emf.ecore.EPackage)

Example 4 with ReferenceHolder

use of org.eclipse.xtext.common.types.xtext.ui.refactoringTestLanguage.ReferenceHolder in project xtext-eclipse by eclipse.

the class RefactoringTest method createRenameSupportForElement.

protected IRenameSupport createRenameSupportForElement() {
    if (!languageServices.hasRefactoring())
        return null;
    IRenameElementContext renameElementContext = editor.getDocument().tryReadOnly(new IUnitOfWork<IRenameElementContext, XtextResource>() {

        @Override
        public IRenameElementContext exec(XtextResource state) throws Exception {
            Model model = (Model) state.getContents().get(0);
            ReferenceHolder referenceHolder = model.getReferenceHolder().get(0);
            return languageServices.renameContextFactory.createRenameElementContext(referenceHolder, editor, null, state);
        }
    });
    if (renameElementContext == null)
        return null;
    IRenameSupport renameSupport = languageServices.renameSupportFactory.create(renameElementContext, "newTestName");
    return renameSupport;
}
Also used : IRenameSupport(org.eclipse.xtext.ui.refactoring.ui.IRenameSupport) ReferenceHolder(org.eclipse.xtext.common.types.xtext.ui.refactoringTestLanguage.ReferenceHolder) Model(org.eclipse.xtext.common.types.xtext.ui.refactoringTestLanguage.Model) IRenameElementContext(org.eclipse.xtext.ui.refactoring.ui.IRenameElementContext) XtextResource(org.eclipse.xtext.resource.XtextResource) JavaModelException(org.eclipse.jdt.core.JavaModelException)

Aggregations

Model (org.eclipse.xtext.common.types.xtext.ui.refactoringTestLanguage.Model)4 ReferenceHolder (org.eclipse.xtext.common.types.xtext.ui.refactoringTestLanguage.ReferenceHolder)4 EPackage (org.eclipse.emf.ecore.EPackage)3 Action (org.eclipse.xtext.Action)3 Parameter (org.eclipse.xtext.Parameter)3 ParserRule (org.eclipse.xtext.ParserRule)3 JavaModelException (org.eclipse.jdt.core.JavaModelException)1 XtextResource (org.eclipse.xtext.resource.XtextResource)1 IRenameElementContext (org.eclipse.xtext.ui.refactoring.ui.IRenameElementContext)1 IRenameSupport (org.eclipse.xtext.ui.refactoring.ui.IRenameSupport)1