Class RenameService2

java.lang.Object
org.eclipse.xtext.ide.server.rename.RenameService2
All Implemented Interfaces:
IRenameService2

public class RenameService2 extends Object implements IRenameService2
Since:
2.18
Author:
koehnlein - Initial contribution and API
  • Constructor Details

    • RenameService2

      public RenameService2()
  • Method Details

    • rename

      public org.eclipse.lsp4j.WorkspaceEdit rename(IRenameService2.Options options)
      Specified by:
      rename in interface IRenameService2
    • applyModifications

      protected void applyModifications(org.eclipse.emf.ecore.EObject element, org.eclipse.lsp4j.WorkspaceEdit workspaceEdit, ServerRefactoringIssueAcceptor issueAcceptor, IRenameService2.Options options, ILanguageServerAccess.Context context)

      Performs the actual renaming. Runs within a read transaction on the index and a live-scoped resource set.

      Override this method to implement custom renaming behavior.

      Since:
      2.25
    • getElementAtOffset

      protected org.eclipse.emf.ecore.EObject getElementAtOffset(org.eclipse.xtext.resource.XtextResource xtextResource, Document document, org.eclipse.lsp4j.Position caretPosition)
    • getElementWithIdentifierAt

      protected org.eclipse.emf.ecore.EObject getElementWithIdentifierAt(org.eclipse.xtext.resource.XtextResource xtextResource, int offset)
    • prepareRename

      public org.eclipse.lsp4j.jsonrpc.messages.Either3<org.eclipse.lsp4j.Range,org.eclipse.lsp4j.PrepareRenameResult,org.eclipse.lsp4j.PrepareRenameDefaultBehavior> prepareRename(IRenameService2.PrepareRenameOptions options)
      Description copied from interface: IRenameService2
      Returns a range describing the range of the string to rename and optionally a placeholder text of the string content to be renamed.

      If null is returned then it is deemed that invoking rename with the same text document position will not result in a valid workspace edit.

      The default implementation only checks whether there is an identifier under the give text document position or not.

      This method should be used to set up and to test the validity of a rename operation at a given location.
      See textDocument/prepareRename for more details.

      Specified by:
      prepareRename in interface IRenameService2
    • doPrepareRename

      protected org.eclipse.lsp4j.jsonrpc.messages.Either3<org.eclipse.lsp4j.Range,org.eclipse.lsp4j.PrepareRenameResult,org.eclipse.lsp4j.PrepareRenameDefaultBehavior> doPrepareRename(org.eclipse.emf.ecore.resource.Resource resource, Document document, org.eclipse.lsp4j.PrepareRenameParams params, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
    • getConvertedValue

      protected String getConvertedValue(org.eclipse.emf.ecore.EObject grammarElement, org.eclipse.xtext.nodemodel.ILeafNode leaf)
    • mayPerformRename

      protected boolean mayPerformRename(org.eclipse.lsp4j.jsonrpc.messages.Either3<org.eclipse.lsp4j.Range,org.eclipse.lsp4j.PrepareRenameResult,org.eclipse.lsp4j.PrepareRenameDefaultBehavior> prepareRenameResult, org.eclipse.lsp4j.RenameParams renameParams)
      If this method returns false, it is sure, that the rename operation will fail. There is no guarantee that it will succeed even if it returns true.
    • getElementName

      protected String getElementName(org.eclipse.emf.ecore.EObject element)
      Tries to read the name EAttribute from the given element. It never returns an empty string, but a null instead.
    • getEObjectAtOffsetHelper

      protected org.eclipse.xtext.resource.EObjectAtOffsetHelper getEObjectAtOffsetHelper()
    • getIssueProvider

      protected com.google.inject.Provider<ServerRefactoringIssueAcceptor> getIssueProvider()
    • getServiceProviderRegistry

      protected org.eclipse.xtext.resource.IResourceServiceProvider.Registry getServiceProviderRegistry()
    • getValueConverterService

      protected org.eclipse.xtext.conversion.IValueConverterService getValueConverterService()
    • getLinkingHelper

      protected org.eclipse.xtext.linking.impl.LinkingHelper getLinkingHelper()
    • getAttributeResolver

      protected com.google.common.base.Function<org.eclipse.emf.ecore.EObject,String> getAttributeResolver()