org.eclipse.xtext.ui.refactoring.ui.IRenameSupport Java Examples

The following examples show how to use org.eclipse.xtext.ui.refactoring.ui.IRenameSupport. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RefactoringTest.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: RefactoringTest.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
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;
}
 
Example #3
Source File: RefactoringTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testRenameElement_1() throws Exception {
	setLanguageConfig(true, false);
	IRenameSupport renameSupport = createRenameSupportForElement();
	assertNotNull(renameSupport);
	renameSupport.startDirectRefactoring();
	waitForBuild();
	assertXtextElementRefactored();
	assertJavaUnchanged();
}
 
Example #4
Source File: RefactoringTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testRenameElement_2() throws Exception {
	setLanguageConfig(true, true);
	IRenameSupport renameSupport = createRenameSupportForElement();
	assertNotNull(renameSupport);
	renameSupport.startDirectRefactoring();
	waitForBuild();
	assertXtextElementRefactored();
	assertJavaUnchanged();
}
 
Example #5
Source File: JdtRenameSupport.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public IRenameSupport create(Object context, String newName) {
	if (context instanceof JdtRefactoringContext) {
		try {
			RenameJavaElementDescriptor descriptor = createDescriptor((JdtRefactoringContext) context, newName);
			JdtRenameSupport jdtRenameSupport = jdtRenameSupportProvider.get();
			jdtRenameSupport.initialize((JdtRefactoringContext) context, descriptor);
			return jdtRenameSupport;
		} catch (Exception exc) {
			throw new WrappedException(exc);
		}
	}
	return super.create(context, newName);
}
 
Example #6
Source File: RefactoringTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testRenameJvmReference_2() throws Exception {
	setLanguageConfig(true, true);
	IRenameSupport renameSupport = createRenameSupportForJvmReference();
	assertNotNull(renameSupport);
	renameSupport.startDirectRefactoring();
	waitForBuild();
	assertXtextJvmRefRefactored();
	assertJavaRefactored();
}
 
Example #7
Source File: AbstractRuleEngineUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return JdtRenameSupport.Factory.class;
}
 
Example #8
Source File: RefactoringTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Test public void testRenameJvmReference() throws Exception {
	setLanguageConfig(false, false);
	IRenameSupport renameSupport = createRenameSupportForJvmReference();
	assertNull(renameSupport);
}
 
Example #9
Source File: RefactoringTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Test public void testRenameJvmReference_1() throws Exception {
	setLanguageConfig(true, false);
	IRenameSupport renameSupport = createRenameSupportForJvmReference();
	assertNull(renameSupport);
}
 
Example #10
Source File: AbstractDomainmodelUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return JdtRenameSupport.Factory.class;
}
 
Example #11
Source File: AbstractStatemachineUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return DefaultRenameSupport.Factory.class;
}
 
Example #12
Source File: RefactoringTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Test public void testRenameElement() throws Exception {
	setLanguageConfig(false, false);
	IRenameSupport renameSupport = createRenameSupportForElement();
	assertNull(renameSupport);
}
 
Example #13
Source File: AbstractArithmeticsUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return DefaultRenameSupport.Factory.class;
}
 
Example #14
Source File: AbstractBuilderTestLanguageUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return DefaultRenameSupport.Factory.class;
}
 
Example #15
Source File: EmfUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @since 2.1
 */
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return DefaultRenameSupport.Factory.class;
}
 
Example #16
Source File: AbstractPureXbaseUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return JdtRenameSupport.Factory.class;
}
 
Example #17
Source File: AbstractXtendUiModule.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return JdtRenameSupport.Factory.class;
}
 
Example #18
Source File: AbstractHelloWorldUiModule.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return DefaultRenameSupport.Factory.class;
}
 
Example #19
Source File: AbstractGamlUiModule.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return DefaultRenameSupport.Factory.class;
}
 
Example #20
Source File: AbstractSARLUiModule.java    From sarl with Apache License 2.0 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return JdtRenameSupport.Factory.class;
}
 
Example #21
Source File: AbstractNestedRefsTestLanguageUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return DefaultRenameSupport.Factory.class;
}
 
Example #22
Source File: AbstractN4JSUiModule.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return DefaultRenameSupport.Factory.class;
}
 
Example #23
Source File: AbstractRegularExpressionUiModule.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return DefaultRenameSupport.Factory.class;
}
 
Example #24
Source File: AbstractJSONUiModule.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return DefaultRenameSupport.Factory.class;
}
 
Example #25
Source File: AbstractTypesUiModule.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return DefaultRenameSupport.Factory.class;
}
 
Example #26
Source File: AbstractBromiumUiModule.java    From bromium with MIT License 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return DefaultRenameSupport.Factory.class;
}
 
Example #27
Source File: AbstractMyDslUiModule.java    From M2Doc with Eclipse Public License 1.0 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return DefaultRenameSupport.Factory.class;
}
 
Example #28
Source File: AbstractFileAwareTestLanguageUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return DefaultRenameSupport.Factory.class;
}
 
Example #29
Source File: AbstractXtextGrammarTestLanguageUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return DefaultRenameSupport.Factory.class;
}
 
Example #30
Source File: AbstractNoJdtTestLanguageUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IRenameSupport.Factory> bindIRenameSupport$Factory() {
	return DefaultRenameSupport.Factory.class;
}