public class ReconcileContext extends Object
A reconcile participant can get the AST for the reconcile-operation using
getAST4()
. If the participant modifies in any way the AST
(either by modifying the source of the working copy, or modifying another entity
that would result in different bindings for the AST), it is expected to reset the
AST in the context using resetAST()
.
A reconcile participant can also create and return problems using
putProblems(String, CategorizedProblem[])
. These problems are then reported
to the problem requestor of the reconcile operation.
CompilationParticipant.reconcile(ReconcileContext)
Constructor and Description |
---|
ReconcileContext(org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation operation,
org.eclipse.jdt.internal.core.CompilationUnit workingCopy)
Creates a reconcile context for the given reconcile operation.
|
Modifier and Type | Method and Description |
---|---|
CompilationUnit |
getAST3()
Deprecated.
JLS3 has been deprecated. This method has been replaced by
getAST4() which returns an AST
with JLS4 level. |
CompilationUnit |
getAST4()
Deprecated.
JLS4 has been deprecated. This method has been replaced by
getAST8() which returns an AST
with JLS8 level. |
CompilationUnit |
getAST8()
Returns a resolved AST with
JLS8 level. |
int |
getASTLevel()
Returns the AST level requested by the reconcile operation.
|
IJavaElementDelta |
getDelta()
Returns the delta describing the change to the working copy being reconciled.
|
CategorizedProblem[] |
getProblems(String markerType)
Returns the problems to be reported to the problem requestor of the reconcile operation
for the given marker type.
|
int |
getReconcileFlags()
Returns the reconcile flag of this context.
|
ICompilationUnit |
getWorkingCopy()
Returns the working copy this context refers to.
|
boolean |
isResolvingBindings()
Returns whether the reconcile operation is resolving bindings.
|
void |
putProblems(String markerType,
CategorizedProblem[] problems)
Sets the problems to be reported to the problem requestor of the reconcile operation
for the given marker type.
|
void |
resetAST()
Resets the AST carried by this context.
|
public ReconcileContext(org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation operation, org.eclipse.jdt.internal.core.CompilationUnit workingCopy)
operation
- the reconcile operationpublic CompilationUnit getAST3() throws JavaModelException
getAST4()
which returns an AST
with JLS4 level.JLS3
level.
It is created from the current state of the working copy.
Creates one if none exists yet.
Returns null
if the current state of the working copy
doesn't allow the AST to be created (e.g. if the working copy's content
cannot be parsed).
If the AST level requested during reconciling is not AST.JLS3
or if binding resolutions was not requested, then a different AST is created.
Note that this AST does not become the current AST and it is only valid for
the requestor.
null
if none could be createdJavaModelException
- if the contents of the working copy
cannot be accessed. Reasons include:
public CompilationUnit getAST4() throws JavaModelException
getAST8()
which returns an AST
with JLS8 level.JLS4
level.
It is created from the current state of the working copy.
Creates one if none exists yet.
Returns null
if the current state of the working copy
doesn't allow the AST to be created (e.g. if the working copy's content
cannot be parsed).
If the AST level requested during reconciling is not AST.JLS4
or if binding resolutions was not requested, then a different AST is created.
Note that this AST does not become the current AST and it is only valid for
the requestor.
null
if none could be createdJavaModelException
- if the contents of the working copy
cannot be accessed. Reasons include:
public CompilationUnit getAST8() throws JavaModelException
JLS8
level.
It is created from the current state of the working copy.
Creates one if none exists yet.
Returns null
if the current state of the working copy
doesn't allow the AST to be created (e.g. if the working copy's content
cannot be parsed).
If the AST level requested during reconciling is not AST.JLS8
or if binding resolutions was not requested, then a different AST is created.
Note that this AST does not become the current AST and it is only valid for
the requestor.
null
if none could be createdJavaModelException
- if the contents of the working copy
cannot be accessed. Reasons include:
public int getASTLevel()
ICompilationUnit.NO_AST
, or one of the JLS constants defined on AST
.public boolean isResolvingBindings()
public int getReconcileFlags()
ICompilationUnit
.ICompilationUnit.ENABLE_BINDINGS_RECOVERY
,
ICompilationUnit.ENABLE_STATEMENTS_RECOVERY
,
ICompilationUnit.IGNORE_METHOD_BODIES
public IJavaElementDelta getDelta()
null
if there is no change.
Note that the delta's AST is not yet positioned at this stage. Use getAST4()
to get the current AST.null
if nonepublic CategorizedProblem[] getProblems(String markerType)
null
if no problems need to be reported for this marker type.markerType
- the given marker typepublic ICompilationUnit getWorkingCopy()
public void resetAST()
Note that resetting the AST will not restart the reconcile process. Only further participants will see the new AST. Thus participants running before the one that resets the AST will have a stale view of the AST and its problems. Use the compilation participant extension point to order the participants.
public void putProblems(String markerType, CategorizedProblem[] problems)
null
indicates that no problems need to be reported.
Using this functionality, a participant that resolves problems for a given marker type can hide those problems since they don't exist any longer.
markerType
- the marker type of the given problemsproblems
- the problems to be reported to the problem requestor of the reconcile operation,
or null
if none
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.