Class ChangeCorrectionProposal
java.lang.Object
org.eclipse.jdt.core.manipulation.ChangeCorrectionProposalCore
org.eclipse.jdt.ui.text.java.correction.ChangeCorrectionProposal
- All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable,ICommandAccess,IJavaCompletionProposal,org.eclipse.jface.text.contentassist.ICompletionProposal,org.eclipse.jface.text.contentassist.ICompletionProposalExtension5,org.eclipse.jface.text.contentassist.ICompletionProposalExtension6
- Direct Known Subclasses:
CUCorrectionProposal
public class ChangeCorrectionProposal
extends ChangeCorrectionProposalCore
implements IJavaCompletionProposal, ICommandAccess, org.eclipse.jface.text.contentassist.ICompletionProposalExtension5, org.eclipse.jface.text.contentassist.ICompletionProposalExtension6
Implementation of a Java completion proposal to be used for quick fix and quick assist proposals
that are based on a
Change. The proposal offers additional proposal information (based on
the Change).- Since:
- 3.8
-
Field Summary
Fields inherited from class org.eclipse.jdt.core.manipulation.ChangeCorrectionProposalCore
fChange, fName, fRelevanceFields inherited from interface org.eclipse.jdt.ui.text.java.correction.ICommandAccess
ASSIST_SUFFIX, COMMAND_ID_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionChangeCorrectionProposal(String name, org.eclipse.ltk.core.refactoring.Change change, int relevance) Constructs a change correction proposal.ChangeCorrectionProposal(String name, org.eclipse.ltk.core.refactoring.Change change, int relevance, org.eclipse.swt.graphics.Image image) Constructs a change correction proposal. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(org.eclipse.jface.text.IDocument document) final org.eclipse.ltk.core.refactoring.ChangeReturns the change that will be executed when the proposal is applied.org.eclipse.jface.text.contentassist.IContextInformationorg.eclipse.swt.graphics.ImagegetImage()org.eclipse.swt.graphics.PointgetSelection(org.eclipse.jface.text.IDocument document) org.eclipse.jface.viewers.StyledStringprotected voidperformChange(org.eclipse.ui.IEditorPart activeEditor, org.eclipse.jface.text.IDocument document) Performs the change associated with this proposal.voidsetImage(org.eclipse.swt.graphics.Image image) Sets the proposal's image ornullif no image is desired.Methods inherited from class org.eclipse.jdt.core.manipulation.ChangeCorrectionProposalCore
apply, createChange, getAdapter, getAdditionalProposalInfo, getCommandId, getCurrentChange, getName, getRelevance, performChange, setCommandId, setDisplayName, setRelevanceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jdt.ui.text.java.correction.ICommandAccess
getCommandIdMethods inherited from interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension5
getAdditionalProposalInfoMethods inherited from interface org.eclipse.jdt.ui.text.java.IJavaCompletionProposal
getRelevance
-
Constructor Details
-
ChangeCorrectionProposal
public ChangeCorrectionProposal(String name, org.eclipse.ltk.core.refactoring.Change change, int relevance, org.eclipse.swt.graphics.Image image) Constructs a change correction proposal.- Parameters:
name- the name that is displayed in the proposal selection dialogchange- the change that is executed when the proposal is applied ornullif the change will be created by implementors ofChangeCorrectionProposalCore.createChange()relevance- the relevance of this proposalimage- the image that is displayed for this proposal ornullif no image is desired
-
ChangeCorrectionProposal
public ChangeCorrectionProposal(String name, org.eclipse.ltk.core.refactoring.Change change, int relevance) Constructs a change correction proposal. Uses the default image for this proposal.- Parameters:
name- The name that is displayed in the proposal selection dialog.change- The change that is executed when the proposal is applied ornullif the change will be created by implementors ofChangeCorrectionProposalCore.createChange().relevance- The relevance of this proposal.
-
-
Method Details
-
apply
public void apply(org.eclipse.jface.text.IDocument document) - Specified by:
applyin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposal
-
performChange
protected void performChange(org.eclipse.ui.IEditorPart activeEditor, org.eclipse.jface.text.IDocument document) throws org.eclipse.core.runtime.CoreException Performs the change associated with this proposal.Subclasses may extend, but must call the super implementation.
- Parameters:
activeEditor- the editor currently active ornullif no editor is activedocument- the document of the editor currently active ornullif no editor is visible- Throws:
org.eclipse.core.runtime.CoreException- when the invocation of the change failed
-
getAdditionalProposalInfo
- Specified by:
getAdditionalProposalInfoin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposal
-
getContextInformation
public org.eclipse.jface.text.contentassist.IContextInformation getContextInformation()- Specified by:
getContextInformationin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposal
-
getDisplayString
- Specified by:
getDisplayStringin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposal
-
getStyledDisplayString
public org.eclipse.jface.viewers.StyledString getStyledDisplayString()- Specified by:
getStyledDisplayStringin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposalExtension6
-
getImage
public org.eclipse.swt.graphics.Image getImage()- Specified by:
getImagein interfaceorg.eclipse.jface.text.contentassist.ICompletionProposal
-
getSelection
public org.eclipse.swt.graphics.Point getSelection(org.eclipse.jface.text.IDocument document) - Specified by:
getSelectionin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposal
-
setImage
public void setImage(org.eclipse.swt.graphics.Image image) Sets the proposal's image ornullif no image is desired.- Parameters:
image- the desired image.
-
getChange
public final org.eclipse.ltk.core.refactoring.Change getChange() throws org.eclipse.core.runtime.CoreExceptionReturns the change that will be executed when the proposal is applied. This method callsChangeCorrectionProposalCore.createChange()to compute the change.- Overrides:
getChangein classChangeCorrectionProposalCore- Returns:
- the change for this proposal, can be
nullin rare cases if creation of the change failed - Throws:
org.eclipse.core.runtime.CoreException- when the change could not be created
-