TPTP 4.5.0 Platform Project
Public API Specification

org.eclipse.tptp.platform.analysis.codereview.java.quickfix
Class JavaCodeReviewQuickFix

java.lang.Object
  extended by org.eclipse.tptp.platform.analysis.core.quickfix.AbstractAnalysisQuickFix
      extended by org.eclipse.tptp.platform.analysis.codereview.java.quickfix.JavaCodeReviewQuickFix
All Implemented Interfaces:
org.eclipse.core.runtime.IExecutableExtension, IAnalysisQuickFix

public abstract class JavaCodeReviewQuickFix
extends AbstractAnalysisQuickFix

Base class for all quickfixes that can be applied to a CodeReviewResult. This class takes care of updating the results once a quickfix has been applied so that the line numbers are updated and other results that are also fixed by this quickfix do not show up anymore. It defines a method fixCodeReviewResult( IAnalysisResult result ) that must be implemented by every class that wants to perform a quickfix


Field Summary
static org.eclipse.core.runtime.IProgressMonitor EMPTY_MONITOR
           
 
Constructor Summary
JavaCodeReviewQuickFix()
           
 
Method Summary
abstract  org.eclipse.text.edits.TextEdit fixCodeReviewResult(org.eclipse.jdt.core.dom.ASTNode theNode, org.eclipse.jface.text.IDocument docToChange)
          Perform the actual quickfix
 java.lang.String getASTNodeAsString(org.eclipse.jdt.core.dom.ASTNode node)
          Retrun the extact source code contained within the specified node
 CodeReviewResult getCodeReviewResult()
           
 org.eclipse.text.edits.TextEdit getTextEdit()
           
 org.eclipse.jdt.core.ICompilationUnit getWorkingCompilationUnit()
           
 org.eclipse.core.runtime.IStatus quickfix(AbstractAnalysisResult result)
          Makes sure that all the results are updated after a Java CodeReview quickfix has been applied
 
Methods inherited from class org.eclipse.tptp.platform.analysis.core.quickfix.AbstractAnalysisQuickFix
getId, getLabel, setId, setInitializationData, setLabel
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_MONITOR

public static final org.eclipse.core.runtime.IProgressMonitor EMPTY_MONITOR
Constructor Detail

JavaCodeReviewQuickFix

public JavaCodeReviewQuickFix()
Method Detail

fixCodeReviewResult

public abstract org.eclipse.text.edits.TextEdit fixCodeReviewResult(org.eclipse.jdt.core.dom.ASTNode theNode,
                                                                    org.eclipse.jface.text.IDocument docToChange)
Perform the actual quickfix

Parameters:
result - The result that describes the problem in the source code
Returns:
TextEdit instance if the quickfix operated successfully; return null otherwise

quickfix

public org.eclipse.core.runtime.IStatus quickfix(AbstractAnalysisResult result)
Makes sure that all the results are updated after a Java CodeReview quickfix has been applied

Specified by:
quickfix in interface IAnalysisQuickFix
Specified by:
quickfix in class AbstractAnalysisQuickFix
Parameters:
result - The result to be quickfiexed
Returns:
a status

getWorkingCompilationUnit

public final org.eclipse.jdt.core.ICompilationUnit getWorkingCompilationUnit()

getTextEdit

public final org.eclipse.text.edits.TextEdit getTextEdit()

getASTNodeAsString

public final java.lang.String getASTNodeAsString(org.eclipse.jdt.core.dom.ASTNode node)
Retrun the extact source code contained within the specified node

Parameters:
node - The node whose source code will be returned
Returns:
A string containing the exact source code

getCodeReviewResult

public CodeReviewResult getCodeReviewResult()
Returns:
The code review result instance associated with this quickfix

TPTP 4.5.0 Platform Project
Public API Specification