org.eclipse.xtext.ui.refactoring.impl.AbstractRenameProcessor Java Examples

The following examples show how to use org.eclipse.xtext.ui.refactoring.impl.AbstractRenameProcessor. 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: DefaultRenameSupport.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected boolean initialize(IRenameElementContext renameElementContext, String newName) {
	if (executerProvider != null && renameRefactoringProvider != null) {
		this.renameRefactoring = renameRefactoringProvider.getRenameRefactoring(renameElementContext);
		if (renameRefactoring != null && renameRefactoring.getProcessor() instanceof AbstractRenameProcessor) {
			((AbstractRenameProcessor) renameRefactoring.getProcessor()).setNewName(newName);
			this.renameElementContext = renameElementContext;
			return true;
		}
	}
	return false;
}
 
Example #2
Source File: SharedCommonTypesModule.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public void configure(Binder binder) {
	binder.bind(IEObjectHoverProvider.class).to(JdtHoverProvider.class);
	binder.bind(IEObjectHoverDocumentationProvider.class).to(JdtHoverDocumentationProvider.class);
	binder.bind(IResourceServiceProvider.class).to(SharedCommonTypesResourceServiceProvider.class);
	binder.bind(IResourceSetProvider.class).to(XtextResourceSetProvider.class);
	binder.bindConstant().annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).to("java");

	binder.bind(IQualifiedNameProvider.class).to(JvmIdentifiableQualifiedNameProvider.class);
	binder.bind(ICopyQualifiedNameService.class).to(DefaultCopyQualifiedNameService.class);
	binder.bind(IJvmTypeProvider.Factory.class).to(JdtTypeProviderFactory.class);
	binder.bind(IRenameRefactoringProvider.class).to(DefaultRenameRefactoringProvider.class);
	binder.bind(AbstractRenameProcessor.class).to(JvmMemberRenameProcessor.class);
	binder.bind(IRenameStrategy.Provider.class).to(JvmMemberRenameStrategy.Provider.class);
	binder.bind(RefactoringResourceSetProvider.class).to(JvmRefactoringResourceSetProvider.class);
	binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("Java");

	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.LIVE_SCOPE))
			.to(LiveShadowedResourceDescriptions.class);
	binder.bind(IResourceDescriptions.class)
			.annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE))
			.to(CurrentDescriptions.ResourceSetAware.class);
	binder.bind(IResourceDescriptions.class)
			.annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS))
			.to(IBuilderState.class);

	binder.bind(IWorkspaceRoot.class).toInstance(ResourcesPlugin.getWorkspace().getRoot());
	binder.bind(ITraceForStorageProvider.class).to(TraceForStorageProvider.class);

	binder.bind(IReferenceUpdater.class).to(NullReferenceUpdater.class);
}
 
Example #3
Source File: CompositeRefactoringProcessor.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void setNewName(String newName) {
	this.newName = newName;
	for (RefactoringProcessor processor : processors) {
		if (processor instanceof AbstractRenameProcessor)
			((AbstractRenameProcessor) processor).setNewName(newName);
	}
}
 
Example #4
Source File: CompositeRefactoringProcessor.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public RefactoringStatus validateNewName(String newName) {
	RefactoringStatus status = new RefactoringStatus();
	for (RefactoringProcessor processor : processors) {
		if (processor instanceof AbstractRenameProcessor)
			status.merge(((AbstractRenameProcessor) processor).validateNewName(newName));
	}
	return status;
}
 
Example #5
Source File: AbstractXtendRenameRefactoringTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected ProcessorBasedRefactoring createXtendRenameRefactoring(final XtextEditor editor, final int offset,
		String newName) {
	IRenameElementContext renameElementContext = createRenameElementContext(editor, offset);
	ProcessorBasedRefactoring renameRefactoring = renameRefactoringProvider
			.getRenameRefactoring(renameElementContext);
	RefactoringProcessor processor = renameRefactoring.getProcessor();
	if (processor instanceof AbstractRenameProcessor)
		((AbstractRenameProcessor) processor).setNewName(newName);
	else if (processor instanceof JavaRenameProcessor)
		((JavaRenameProcessor) processor).setNewElementName(newName);
	return renameRefactoring;
}
 
Example #6
Source File: N4JSUiModule.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
/** Custom N4JSRenameElementProcessor */
public Class<? extends AbstractRenameProcessor> bindAbstractRenameProcessor() {
	return N4JSRenameElementProcessor.class;
}
 
Example #7
Source File: AbstractFileAwareTestLanguageUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends AbstractRenameProcessor> bindAbstractRenameProcessor() {
	return RenameElementProcessor2.class;
}
 
Example #8
Source File: RenameElementWizard.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public RenameElementWizard(ProcessorBasedRefactoring refactoring, IRenameElementContext context) {
	super(refactoring, DIALOG_BASED_USER_INTERFACE);
	setWindowTitle("Rename Element");
	this.context = context;
	renameProcessor = (AbstractRenameProcessor) refactoring.getProcessor();
}
 
Example #9
Source File: RenameElementWizard.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected AbstractRenameProcessor getRenameProcessor() {
	return renameProcessor;
}
 
Example #10
Source File: RenameElementWizard.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public UserInputPage(AbstractRenameProcessor renameProcessor, IRenameElementContext context) {
	super("RenameElementResourceRefactoringInputPage"); //$NON-NLS-1$
	this.renameProcessor = renameProcessor;
	currentName = renameProcessor.getNewName() != null ? renameProcessor.getNewName()
			: renameProcessor.getOriginalName();
}