Class RenameService2

    • Constructor Summary

      Constructors 
      Constructor Description
      RenameService2()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      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)  
      protected com.google.common.base.Function<org.eclipse.emf.ecore.EObject,​java.lang.String> getAttributeResolver()  
      protected java.lang.String getConvertedValue​(org.eclipse.emf.ecore.EObject grammarElement, org.eclipse.xtext.nodemodel.ILeafNode leaf)  
      protected org.eclipse.emf.ecore.EObject getElementAtOffset​(org.eclipse.xtext.resource.XtextResource xtextResource, Document document, org.eclipse.lsp4j.Position caretPosition)  
      protected java.lang.String getElementName​(org.eclipse.emf.ecore.EObject element)
      Tries to read the name EAttribute from the given element.
      protected org.eclipse.emf.ecore.EObject getElementWithIdentifierAt​(org.eclipse.xtext.resource.XtextResource xtextResource, int offset)  
      protected org.eclipse.xtext.resource.EObjectAtOffsetHelper getEObjectAtOffsetHelper()  
      protected com.google.inject.Provider<ServerRefactoringIssueAcceptor> getIssueProvider()  
      protected org.eclipse.xtext.linking.impl.LinkingHelper getLinkingHelper()  
      protected org.eclipse.xtext.resource.IResourceServiceProvider.Registry getServiceProviderRegistry()  
      protected org.eclipse.xtext.conversion.IValueConverterService getValueConverterService()  
      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.
      org.eclipse.lsp4j.jsonrpc.messages.Either3<org.eclipse.lsp4j.Range,​org.eclipse.lsp4j.PrepareRenameResult,​org.eclipse.lsp4j.PrepareRenameDefaultBehavior> prepareRename​(IRenameService2.PrepareRenameOptions options)
      Returns a range describing the range of the string to rename and optionally a placeholder text of the string content to be renamed.
      org.eclipse.lsp4j.WorkspaceEdit rename​(IRenameService2.Options options)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RenameService2

        public RenameService2()
    • Method Detail

      • 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 java.lang.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 java.lang.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()
      • 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,​java.lang.String> getAttributeResolver()