Class ChangeCorrectionProposalCore
java.lang.Object
org.eclipse.jdt.core.manipulation.ChangeCorrectionProposalCore
- All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable
- Direct Known Subclasses:
ChangeCorrectionProposal,CUCorrectionProposalCore
public class ChangeCorrectionProposalCore
extends Object
implements org.eclipse.core.runtime.IAdaptable
- Since:
- 1.11
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.eclipse.ltk.core.refactoring.Changeprotected Stringprotected int -
Constructor Summary
ConstructorsConstructorDescriptionChangeCorrectionProposalCore(String name, org.eclipse.ltk.core.refactoring.Change change, int relevance) Constructs a change correction proposal. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply()protected org.eclipse.ltk.core.refactoring.ChangeCreates the change for this proposal.<T> TgetAdapter(Class<T> adapter) getAdditionalProposalInfo(org.eclipse.core.runtime.IProgressMonitor monitor) org.eclipse.ltk.core.refactoring.ChangeReturns the change that will be executed when the proposal is applied.org.eclipse.ltk.core.refactoring.ChangegetName()Returns the name of the proposal.intprotected voidPerforms the change associated with this proposal.voidsetCommandId(String commandId) Set the proposal id to allow assigning a shortcut to the correction proposal.voidsetDisplayName(String name) Sets the display name.voidsetRelevance(int relevance) Sets the relevance.
-
Field Details
-
fChange
protected org.eclipse.ltk.core.refactoring.Change fChange -
fName
-
fRelevance
protected int fRelevance
-
-
Constructor Details
-
ChangeCorrectionProposalCore
public ChangeCorrectionProposalCore(String name, org.eclipse.ltk.core.refactoring.Change change, int relevance) 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 ofcreateChange()relevance- the relevance of this proposal
-
-
Method Details
-
apply
public void apply() throws org.eclipse.core.runtime.CoreException- Throws:
org.eclipse.core.runtime.CoreException
-
performChange
protected void performChange() throws org.eclipse.core.runtime.CoreExceptionPerforms the change associated with this proposal.Subclasses may extend, but must call the super implementation.
- Throws:
org.eclipse.core.runtime.CoreException- when the invocation of the change failed
-
getAdditionalProposalInfo
-
getName
Returns the name of the proposal.- Returns:
- the name of the proposal
-
getChange
public 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 callscreateChange()to compute the change.- 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
-
getCurrentChange
public org.eclipse.ltk.core.refactoring.Change getCurrentChange()- Returns:
- The current change, or null if not initialized yet
- Since:
- 1.20
-
createChange
protected org.eclipse.ltk.core.refactoring.Change createChange() throws org.eclipse.core.runtime.CoreExceptionCreates the change for this proposal. This method is only called once and only when no change has been passed in {#ChangeCorrectionProposal(String, Change, int, Image)}. Subclasses may override.- Returns:
- the created change
- Throws:
org.eclipse.core.runtime.CoreException- if the creation of the change failed
-
setDisplayName
Sets the display name.- Parameters:
name- the name to set
-
getRelevance
public int getRelevance() -
setRelevance
public void setRelevance(int relevance) Sets the relevance.- Parameters:
relevance- the relevance to set- See Also:
-
getCommandId
- Returns:
- the command id
- Since:
- 1.20
-
setCommandId
Set the proposal id to allow assigning a shortcut to the correction proposal.- Parameters:
commandId- The proposal id for this proposal ornullif no command should be assigned to this proposal.- Since:
- 1.20
-
getAdapter
- Specified by:
getAdapterin interfaceorg.eclipse.core.runtime.IAdaptable
-