public class ASTRewriteCorrectionProposal extends CUCorrectionProposal
getRewrite()
is overridden to provide
the AST rewrite that is evaluated on the document when the proposal is applied.fChange, fName, fRelevance
ASSIST_SUFFIX, COMMAND_ID_PREFIX
Constructor and Description |
---|
ASTRewriteCorrectionProposal(String name,
ICompilationUnit cu,
ASTRewrite rewrite,
int relevance)
Constructs an AST rewrite correction proposal.
|
ASTRewriteCorrectionProposal(String name,
ICompilationUnit cu,
ASTRewrite rewrite,
int relevance,
Image image)
Constructs an AST rewrite correction proposal.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addEdits(IDocument document,
TextEdit editRoot)
Called when the
CompilationUnitChange is initialized. |
ImportRewrite |
createImportRewrite(CompilationUnit astRoot)
Creates and sets the import rewrite used for this compilation unit.
|
ImportRewrite |
getImportRewrite()
Returns the import rewrite used for this compilation unit.
|
protected ASTRewrite |
getRewrite()
Returns the rewrite that has been passed in the constructor.
|
void |
setImportRewrite(ImportRewrite rewrite)
Sets the import rewrite used for this compilation unit.
|
apply, createChange, createTextChange, didOpenEditor, getAdditionalProposalInfo, getCompilationUnit, getPreviewContent, getTextChange, toString
getAdditionalProposalInfo, getChange, getCommandId, getContextInformation, getDisplayString, getImage, getSelection, getStyledDisplayString, performChange, setCommandId, setImage
apply, getName, getRelevance, performChange, setDisplayName, setRelevance
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getRelevance
public ASTRewriteCorrectionProposal(String name, ICompilationUnit cu, ASTRewrite rewrite, int relevance, Image image)
name
- the display name of the proposalcu
- the compilation unit that is modifiedrewrite
- the AST rewrite that is invoked when the proposal is applied or
null
if getRewrite()
is overriddenrelevance
- the relevance of this proposalimage
- the image that is displayed for this proposal or null
if no image
is desiredpublic ASTRewriteCorrectionProposal(String name, ICompilationUnit cu, ASTRewrite rewrite, int relevance)
name
- the display name of the proposalcu
- the compilation unit that is modifiedrewrite
- the AST rewrite that is invoked when the proposal is applied or
null
if getRewrite()
is overriddenrelevance
- The relevance of this proposalpublic ImportRewrite getImportRewrite()
null
if no import rewrite has been setpublic void setImportRewrite(ImportRewrite rewrite)
rewrite
- the import rewritepublic ImportRewrite createImportRewrite(CompilationUnit astRoot)
astRoot
- the AST for the current CUprotected void addEdits(IDocument document, TextEdit editRoot) throws CoreException
CUCorrectionProposal
CompilationUnitChange
is initialized. Subclasses can override to add
text edits to the root edit of the change. Implementors must not access the proposal, e.g.
not call ChangeCorrectionProposal.getChange()
.
The default implementation does not add any edits
addEdits
in class CUCorrectionProposal
document
- content of the underlying compilation unit. To be accessed read only.editRoot
- The root edit to add all edits toCoreException
- can be thrown if adding the edits is failing.protected ASTRewrite getRewrite() throws CoreException
CoreException
- when the rewrite could not be created
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.