Class ASTRewriteCorrectionProposal

    • Constructor Detail

      • ASTRewriteCorrectionProposal

        public ASTRewriteCorrectionProposal​(String name,
                                            ICompilationUnit cu,
                                            ASTRewrite rewrite,
                                            int relevance,
                                            Image image)
        Constructs an AST rewrite correction proposal.
        Parameters:
        name - the display name of the proposal
        cu - the compilation unit that is modified
        rewrite - the AST rewrite that is invoked when the proposal is applied or null if getRewrite() is overridden
        relevance - the relevance of this proposal
        image - the image that is displayed for this proposal or null if no image is desired
      • ASTRewriteCorrectionProposal

        public ASTRewriteCorrectionProposal​(String name,
                                            ICompilationUnit cu,
                                            ASTRewrite rewrite,
                                            int relevance)
        Constructs an AST rewrite correction proposal. Uses the default image for this proposal.
        Parameters:
        name - the display name of the proposal
        cu - the compilation unit that is modified
        rewrite - the AST rewrite that is invoked when the proposal is applied or null if getRewrite() is overridden
        relevance - The relevance of this proposal
    • Method Detail

      • getImportRewrite

        public ImportRewrite getImportRewrite()
        Returns the import rewrite used for this compilation unit.
        Returns:
        the import rewrite or null if no import rewrite has been set
        Restriction:
        This method is not intended to be re-implemented or extended by clients.
      • setImportRewrite

        public void setImportRewrite​(ImportRewrite rewrite)
        Sets the import rewrite used for this compilation unit.
        Parameters:
        rewrite - the import rewrite
        Restriction:
        This method is not intended to be re-implemented or extended by clients.
      • createImportRewrite

        public ImportRewrite createImportRewrite​(CompilationUnit astRoot)
        Creates and sets the import rewrite used for this compilation unit.
        Parameters:
        astRoot - the AST for the current CU
        Returns:
        the created import rewrite
        Restriction:
        This method is not intended to be re-implemented or extended by clients.
      • getRewrite

        protected ASTRewrite getRewrite()
                                 throws CoreException
        Returns the rewrite that has been passed in the constructor. Implementors can override this method to create the rewrite lazily. This method will only be called once.
        Returns:
        the rewrite to be used
        Throws:
        CoreException - when the rewrite could not be created