Class 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:

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).
  • Constructor Details

    • ChangeCorrectionProposal

      public ChangeCorrectionProposal(String name, org.eclipse.ltk.core.refactoring.Change change, int relevance, image)
      Constructs a change correction proposal.
      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
      image - the image that is displayed for this proposal or null if 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.
      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.
  • Method Details

    • apply

      public void apply(org.eclipse.jface.text.IDocument document)
      Specified by:
      apply in interface org.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.

      activeEditor - the editor currently active or null if no editor is active
      document - the document of the editor currently active or null if no editor is visible
      org.eclipse.core.runtime.CoreException - when the invocation of the change failed
    • getAdditionalProposalInfo

      public String getAdditionalProposalInfo()
      Specified by:
      getAdditionalProposalInfo in interface org.eclipse.jface.text.contentassist.ICompletionProposal
    • getContextInformation

      public org.eclipse.jface.text.contentassist.IContextInformation getContextInformation()
      Specified by:
      getContextInformation in interface org.eclipse.jface.text.contentassist.ICompletionProposal
    • getDisplayString

      public String getDisplayString()
      Specified by:
      getDisplayString in interface org.eclipse.jface.text.contentassist.ICompletionProposal
    • getStyledDisplayString

      public org.eclipse.jface.viewers.StyledString getStyledDisplayString()
      Specified by:
      getStyledDisplayString in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension6
    • getImage

      public getImage()
      Specified by:
      getImage in interface org.eclipse.jface.text.contentassist.ICompletionProposal
    • getSelection

      public getSelection(org.eclipse.jface.text.IDocument document)
      Specified by:
      getSelection in interface org.eclipse.jface.text.contentassist.ICompletionProposal
    • setImage

      public void setImage( image)
      Sets the proposal's image or null if no image is desired.
      image - the desired image.
    • getChange

      public final org.eclipse.ltk.core.refactoring.Change getChange() throws org.eclipse.core.runtime.CoreException
      Returns the change that will be executed when the proposal is applied. This method calls ChangeCorrectionProposalCore.createChange() to compute the change.
      getChange in class ChangeCorrectionProposalCore
      the change for this proposal, can be null in rare cases if creation of the change failed
      org.eclipse.core.runtime.CoreException - when the change could not be created