use of org.eclipse.xtext.ui.refactoring.ui.IRenameSupport in project xtext-eclipse by eclipse.
the class RefactoringTest method testRenameElement_1.
@Test
public void testRenameElement_1() throws Exception {
setLanguageConfig(true, false);
IRenameSupport renameSupport = createRenameSupportForElement();
assertNotNull(renameSupport);
renameSupport.startDirectRefactoring();
waitForBuild();
assertXtextElementRefactored();
assertJavaUnchanged();
}
use of org.eclipse.xtext.ui.refactoring.ui.IRenameSupport in project xtext-eclipse by eclipse.
the class RefactoringTest method createRenameSupportForJvmReference.
protected IRenameSupport createRenameSupportForJvmReference() {
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);
JvmType defaultReference = model.getReferenceHolder().get(0).getDefaultReference();
return languageServices.renameContextFactory.createRenameElementContext(defaultReference, editor, null, state);
}
});
if (renameElementContext == null)
return null;
IRenameSupport renameSupport = languageServices.renameSupportFactory.create(renameElementContext, "NewJavaClass");
return renameSupport;
}
use of org.eclipse.xtext.ui.refactoring.ui.IRenameSupport in project xtext-eclipse by eclipse.
the class RefactoringTest method testRenameElement_2.
@Test
public void testRenameElement_2() throws Exception {
setLanguageConfig(true, true);
IRenameSupport renameSupport = createRenameSupportForElement();
assertNotNull(renameSupport);
renameSupport.startDirectRefactoring();
waitForBuild();
assertXtextElementRefactored();
assertJavaUnchanged();
}
use of org.eclipse.xtext.ui.refactoring.ui.IRenameSupport in project xtext-eclipse by eclipse.
the class RefactoringTest method testRenameJvmReference_1.
@Test
public void testRenameJvmReference_1() throws Exception {
setLanguageConfig(true, false);
IRenameSupport renameSupport = createRenameSupportForJvmReference();
assertNull(renameSupport);
}
use of org.eclipse.xtext.ui.refactoring.ui.IRenameSupport 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;
}
Aggregations