public class CorrectionEngine extends Object
Modifier and Type | Field and Description |
---|---|
protected static int |
CLASSES
This field is not intended to be used by client.
|
protected ICompilationUnit |
compilationUnit
This field is not intended to be used by client.
|
protected CompletionRequestor |
completionRequestor
This field is not intended to be used by client.
|
protected int |
correctionEnd
This field is not intended to be used by client.
|
protected ICorrectionRequestor |
correctionRequestor
This field is not intended to be used by client.
|
protected int |
correctionStart
This field is not intended to be used by client.
|
protected static int |
FIELD
This field is not intended to be used by client.
|
protected int |
filter
This field is not intended to be used by client.
|
protected static int |
IMPORT
This field is not intended to be used by client.
|
protected static int |
INTERFACES
This field is not intended to be used by client.
|
protected static int |
LOCAL
This field is not intended to be used by client.
|
protected static int |
METHOD
This field is not intended to be used by client.
|
protected int |
prefixLength
This field is not intended to be used by client.
|
Constructor and Description |
---|
CorrectionEngine(Map setting)
The CorrectionEngine is responsible for computing problem corrections.
|
Modifier and Type | Method and Description |
---|---|
void |
computeCorrections(IMarker marker,
ICompilationUnit targetUnit,
int positionOffset,
ICorrectionRequestor requestor)
Performs code correction for the given marker,
reporting results to the given correction requestor.
|
void |
computeCorrections(IProblem problem,
ICompilationUnit targetUnit,
ICorrectionRequestor requestor)
Performs code correction for the given IProblem,
reporting results to the given correction requestor.
|
static String[] |
getAllWarningTokens()
Return an array of strings which contains one entry per warning token
accepted by the
@SuppressWarnings annotation. |
static String[] |
getProblemArguments(IMarker problemMarker)
Helper method for decoding problem marker attributes.
|
static String |
getWarningToken(int problemID)
Returns a token which can be used to suppress a given warning using
@SuppressWarnings annotation, for a given problem ID
(IProblem ). |
protected int correctionStart
protected int correctionEnd
protected int prefixLength
protected ICompilationUnit compilationUnit
protected ICorrectionRequestor correctionRequestor
protected static final int CLASSES
protected static final int INTERFACES
protected static final int IMPORT
protected static final int METHOD
protected static final int FIELD
protected static final int LOCAL
protected int filter
protected CompletionRequestor completionRequestor
public CorrectionEngine(Map setting)
setting
- java.util.Map
set of options used to configure the code correction engine.
CURRENTLY THERE IS NO CORRECTION SPECIFIC SETTINGS.public void computeCorrections(IMarker marker, ICompilationUnit targetUnit, int positionOffset, ICorrectionRequestor requestor) throws JavaModelException
marker
- the marker which describe the problem to correct.targetUnit
- replace the compilation unit given by the marker. Ignored if null.positionOffset
- the offset of position given by the marker.requestor
- the given correction requestorIllegalArgumentException
- if requestor
is null
JavaModelException
- currently this exception is never thrown, but the opportunity to thrown an exception
when the correction failed is kept for later.public void computeCorrections(IProblem problem, ICompilationUnit targetUnit, ICorrectionRequestor requestor) throws JavaModelException
problem
- the problem which describe the problem to correct.targetUnit
- denote the compilation unit in which correction occurs. Cannot be null.requestor
- the given correction requestorIllegalArgumentException
- if targetUnit
or requestor
is null
JavaModelException
- currently this exception is never thrown, but the opportunity to thrown an exception
when the correction failed is kept for later.public static String[] getAllWarningTokens()
@SuppressWarnings
annotation. This array is
neither null nor empty, it contains at least the String all
.
It should not be modified by the caller (please take a copy if modifications
are needed).@SuppressWarnings
annotation in the Java source code, the effects (if any) may vary from
compiler to compiler.@SuppressWarnings
annotation.public static String[] getProblemArguments(IMarker problemMarker)
null
if the marker
"arguments" attribute is missing or ill-formed.problemMarker
- the problem marker to decode arguments from.null
if unable to extract argumentspublic static String getWarningToken(int problemID)
@SuppressWarnings
annotation, for a given problem ID
(IProblem
). If a particular problem is not suppressable,
null
will be returned.
Note: @SuppressWarnings
can only suppress warnings,
which means that if some problems got promoted to ERROR using custom compiler
settings (IJavaProject.setOption(String, String)
), the
@SuppressWarnings
annotation will be ineffective.
Note: @SuppressWarnings
can be argumented with
"all"
so as to suppress all possible warnings at once.
Note: The tokens returned are not necessarily standardized across Java compilers. If you were to use one of these tokens in an @SuppressWarnings annotation in the Java source code, the effects (if any) may vary from compiler to compiler.
problemID
- the ID of a given warning to suppress@SuppressWarnings
annotation,
or null
if unable to suppress this warning.
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.