Class RenameService2
java.lang.Object
org.eclipse.xtext.ide.server.rename.RenameService2
- All Implemented Interfaces:
IRenameService2
- Since:
- 2.18
- Author:
- koehnlein - Initial contribution and API
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.xtext.ide.server.rename.IRenameService2
IRenameService2.Options, IRenameService2.PrepareRenameOptions
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected 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,
String> protected 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 String
getElementName
(org.eclipse.emf.ecore.EObject element) Tries to read thename
EAttribute
from the givenelement
.protected org.eclipse.emf.ecore.EObject
getElementWithIdentifierAt
(org.eclipse.xtext.resource.XtextResource xtextResource, int offset) protected org.eclipse.xtext.resource.EObjectAtOffsetHelper
protected com.google.inject.Provider<ServerRefactoringIssueAcceptor>
protected org.eclipse.xtext.linking.impl.LinkingHelper
protected org.eclipse.xtext.resource.IResourceServiceProvider.Registry
protected org.eclipse.xtext.conversion.IValueConverterService
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 returnsfalse
, 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> Returns arange
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)
-
Constructor Details
-
RenameService2
public RenameService2()
-
-
Method Details
-
rename
- Specified by:
rename
in interfaceIRenameService2
-
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, prepareRenameorg.eclipse.lsp4j.PrepareRenameDefaultBehavior> (IRenameService2.PrepareRenameOptions options) Description copied from interface:IRenameService2
Returns arange
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 invokingrename
with the same text document position will not result in a validworkspace 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 interfaceIRenameService2
-
doPrepareRename
protected org.eclipse.lsp4j.jsonrpc.messages.Either3<org.eclipse.lsp4j.Range,org.eclipse.lsp4j.PrepareRenameResult, doPrepareRenameorg.eclipse.lsp4j.PrepareRenameDefaultBehavior> (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 returnsfalse
, it is sure, that the rename operation will fail. There is no guarantee that it will succeed even if it returnstrue
. -
getElementName
Tries to read thename
EAttribute
from the givenelement
. It never returns an empty string, but anull
instead. -
getEObjectAtOffsetHelper
protected org.eclipse.xtext.resource.EObjectAtOffsetHelper getEObjectAtOffsetHelper() -
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()
-