public class CUCorrectionProposalCore extends ChangeCorrectionProposalCore implements ICUCorrectionProposal
text change
is directly passed in the constructor or method
addEdits(IDocument, TextEdit)
is overridden to provide the text edits that are applied
to the document when the proposal is evaluated.
The proposal takes care of the preview of the changes as proposal information.
fChange, fName, fRelevance
Modifier | Constructor and Description |
---|---|
|
CUCorrectionProposalCore(ICUCorrectionProposal proposal,
String name,
ICompilationUnit cu,
TextChange change,
int relevance)
Constructs a correction proposal working on a compilation unit with a given text change.
|
protected |
CUCorrectionProposalCore(String name,
ICompilationUnit cu,
int relevance)
Constructs a correction proposal working on a compilation unit.
|
|
CUCorrectionProposalCore(String name,
ICompilationUnit cu,
TextChange change,
int relevance)
Constructs a correction proposal working on a compilation unit with a given text change.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addEdits(IDocument document,
TextEdit editRoot)
Called when the
CompilationUnitChange is initialized. |
void |
apply() |
protected Change |
createChange()
Creates the change for this proposal.
|
TextChange |
createTextChange()
Creates the text change for this proposal.
|
Object |
getAdditionalProposalInfo(IProgressMonitor monitor) |
ICompilationUnit |
getCompilationUnit()
The compilation unit on which the change works.
|
TextChange |
getNewChange() |
String |
getPreviewContent()
Creates a preview of the content of the compilation unit after applying the change.
|
TextChange |
getTextChange()
Returns the text change that is invoked when the change is applied.
|
String |
toString() |
getChange, getName, getRelevance, performChange, setDisplayName, setRelevance
public CUCorrectionProposalCore(ICUCorrectionProposal proposal, String name, ICompilationUnit cu, TextChange change, int relevance)
proposal
- ICUCorrectionProposal to usename
- the name that is displayed in the proposal selection dialogcu
- the compilation unit to which the change can be appliedchange
- the change that is executed when the proposal is applied or null
if implementors override addEdits(IDocument, TextEdit)
to provide the
text edits or createTextChange()
to provide a text changerelevance
- the relevance of this proposalpublic CUCorrectionProposalCore(String name, ICompilationUnit cu, TextChange change, int relevance)
name
- the name that is displayed in the proposal selection dialogcu
- the compilation unit to which the change can be appliedchange
- the change that is executed when the proposal is applied or null
if implementors override addEdits(IDocument, TextEdit)
to provide the
text edits or createTextChange()
to provide a text changerelevance
- the relevance of this proposalprotected CUCorrectionProposalCore(String name, ICompilationUnit cu, int relevance)
Users have to override addEdits(IDocument, TextEdit)
to provide the text edits or
createTextChange()
to provide a text change.
name
- the name that is displayed in the proposal selection dialogcu
- the compilation unit on that the change worksrelevance
- the relevance of this proposalprotected void addEdits(IDocument document, TextEdit editRoot) throws CoreException
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 ChangeCorrectionProposalCore.getChange()
.
The default implementation does not add any edits
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.public Object getAdditionalProposalInfo(IProgressMonitor monitor)
getAdditionalProposalInfo
in class ChangeCorrectionProposalCore
public void apply() throws CoreException
apply
in class ChangeCorrectionProposalCore
CoreException
public TextChange getNewChange()
public TextChange createTextChange() throws CoreException
CoreException
- if the creation of the text change failedprotected Change createChange() throws CoreException
ChangeCorrectionProposalCore
createChange
in class ChangeCorrectionProposalCore
CoreException
- if the creation of the change failedpublic final TextChange getTextChange() throws CoreException
getTextChange
in interface ICUCorrectionProposal
CoreException
- if accessing the change failedpublic ICompilationUnit getCompilationUnit()
public String getPreviewContent() throws CoreException
CoreException
- if the creation of the change failed
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.