public class ChangeCorrectionProposal extends ChangeCorrectionProposalCore implements IJavaCompletionProposal, ICommandAccess, ICompletionProposalExtension5, ICompletionProposalExtension6
Change
. The proposal offers additional proposal information (based on
the Change
).fChange, fName, fRelevance
ASSIST_SUFFIX, COMMAND_ID_PREFIX
Constructor and Description |
---|
ChangeCorrectionProposal(String name,
Change change,
int relevance)
Constructs a change correction proposal.
|
ChangeCorrectionProposal(String name,
Change change,
int relevance,
Image image)
Constructs a change correction proposal.
|
Modifier and Type | Method and Description |
---|---|
void |
apply(IDocument document) |
String |
getAdditionalProposalInfo() |
Change |
getChange()
Returns the change that will be executed when the proposal is applied.
|
String |
getCommandId()
Returns the id of the command that should invoke this correction proposal.
|
IContextInformation |
getContextInformation() |
String |
getDisplayString() |
Image |
getImage() |
Point |
getSelection(IDocument document) |
StyledString |
getStyledDisplayString() |
protected void |
performChange(IEditorPart activeEditor,
IDocument document)
Performs the change associated with this proposal.
|
void |
setCommandId(String commandId)
Set the proposal id to allow assigning a shortcut to the correction proposal.
|
void |
setImage(Image image)
Sets the proposal's image or
null if no image is desired. |
apply, createChange, getAdditionalProposalInfo, getName, getRelevance, performChange, setDisplayName, setRelevance
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRelevance
getAdditionalProposalInfo
public ChangeCorrectionProposal(String name, Change change, int relevance, Image image)
name
- the name that is displayed in the proposal selection dialogchange
- the change that is executed when the proposal is applied or null
if the change will be created by implementors of ChangeCorrectionProposalCore.createChange()
relevance
- the relevance of this proposalimage
- the image that is displayed for this proposal or null
if no image
is desiredpublic ChangeCorrectionProposal(String name, Change change, int relevance)
name
- The name that is displayed in the proposal selection dialog.change
- The change that is executed when the proposal is applied or null
if the change will be created by implementors of ChangeCorrectionProposalCore.createChange()
.relevance
- The relevance of this proposal.public void apply(IDocument document)
apply
in interface ICompletionProposal
protected void performChange(IEditorPart activeEditor, IDocument document) throws CoreException
Subclasses may extend, but must call the super implementation.
activeEditor
- the editor currently active or null
if no editor is activedocument
- the document of the editor currently active or null
if no editor
is visibleCoreException
- when the invocation of the change failedpublic String getAdditionalProposalInfo()
getAdditionalProposalInfo
in interface ICompletionProposal
public IContextInformation getContextInformation()
getContextInformation
in interface ICompletionProposal
public String getDisplayString()
getDisplayString
in interface ICompletionProposal
public StyledString getStyledDisplayString()
getStyledDisplayString
in interface ICompletionProposalExtension6
public Image getImage()
getImage
in interface ICompletionProposal
public Point getSelection(IDocument document)
getSelection
in interface ICompletionProposal
public void setImage(Image image)
null
if no image is desired.image
- the desired image.public final Change getChange() throws CoreException
ChangeCorrectionProposalCore.createChange()
to compute the change.getChange
in class ChangeCorrectionProposalCore
null
in rare cases if creation of
the change failedCoreException
- when the change could not be createdpublic String getCommandId()
ICommandAccess
getCommandId
in interface ICommandAccess
null
if this proposal does not have a command.
This id must start with ICommandAccess.COMMAND_ID_PREFIX
to be recognized as a correction
command. In addition, the id must end with ICommandAccess.ASSIST_SUFFIX
to be recognized as
a quick assist command.public void setCommandId(String commandId)
commandId
- The proposal id for this proposal or null
if no command
should be assigned to this proposal.
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.