org.eclipse.jdt.core.compiler
Class ReconcileContext
java.lang.Object
org.eclipse.jdt.core.compiler.ReconcileContext
-
public class ReconcileContext
- extends
Object
The context of a reconcile event that is notified to interested compilation
participants while a reconcile operation is running.
A reconcile participant can get the AST for the reconcile-operation using
getAST3()
. 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.
-
Since:
- 3.2
-
See Also:
-
CompilationParticipant.reconcile(ReconcileContext)
-
Restriction:
- This class is not intended to be subclassed by clients.
-
Restriction:
- This class is not intended to be instantiated by clients.
Constructor Summary
|
ReconcileContext
(org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation operation,
org.eclipse.jdt.internal.core.CompilationUnit workingCopy)
Creates a reconcile context for the given reconcile operation. |
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
ReconcileContext
public ReconcileContext(org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation operation,
org.eclipse.jdt.internal.core.CompilationUnit workingCopy)
- Creates a reconcile context for the given reconcile operation.
-
Parameters:
-
operation
- the reconcile operation -
Restriction:
- This constructor is not intended to be called by clients.
getAST3
public
CompilationUnit getAST3()
throws
JavaModelException
- Returns a resolved AST with
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.
-
-
Returns:
- the AST created from the current state of the working copy,
or
null
if none could be created
-
Throws:
-
JavaModelException
- if the contents of the working copy
cannot be accessed. Reasons include:
- The working copy does not exist (ELEMENT_DOES_NOT_EXIST)
getASTLevel
public int getASTLevel()
- Returns the AST level requested by the reconcile operation.
It is either
ICompilationUnit.NO_AST
, or one of the JLS constants defined on
AST
.
-
-
Returns:
- the AST level requested by the reconcile operation
isResolvingBindings
public boolean isResolvingBindings()
- Returns whether the reconcile operation is resolving bindings.
-
-
Returns:
- whether the reconcile operation is resolving bindings
getDelta
public
IJavaElementDelta getDelta()
- Returns the delta describing the change to the working copy being reconciled.
Returns
null
if there is no change.
Note that the delta's AST is not yet positionnned at this stage. Use
getAST3()
to get the current AST.
-
-
Returns:
- the delta describing the change, or
null
if none
getProblems
public
CategorizedProblem[] getProblems(
String markerType)
- Returns the problems to be reported to the problem requestor of the reconcile operation
for the given marker type.
Returns
null
if no problems need to be reported for this marker type.
-
-
Parameters:
-
markerType
- the given marker type
-
Returns:
- problems to be reported to the problem requesto
getWorkingCopy
public
ICompilationUnit getWorkingCopy()
- Returns the working copy this context refers to.
-
-
Returns:
- the working copy this context refers to
resetAST
public void resetAST()
- Resets the AST carried by this context.
A compilation participant that modifies the environment that would result in different
bindings for the AST is expected to reset the AST on this context, so that other
participants don't get a stale AST.
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.
-
putProblems
public 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.
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.
-
-
Parameters:
-
markerType
- the marker type of the given problems -
problems
- the problems to be reported to the problem requestor of the reconcile operation,
or null
if none
Copyright (c) IBM Corp. and others 2000, 2008. All Rights Reserved.