public abstract class TransformAdapter
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
TransformAdapter.ConstructRegion |
class |
TransformAdapter.LocationRegion |
class |
TransformAdapter.Region |
Constructor and Description |
---|
TransformAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
addHighlight(ModelAdapter model,
java.lang.Object construct)
Adds a highlight region for a construct for this context.
|
void |
addRemovedHighlight(ModelAdapter model,
java.lang.Object construct)
Adds a highlight region for an about-to-be-removed construct in the model
for this context.
|
abstract void |
beginTransform(TransformContext context)
Begins a transform of this type.
|
void |
beginTransform(TransformContext context,
TransformSequenceContext sequenceContext)
Begins a transform of this type within a sequence of transforms of this
type.
|
void |
beginTransformSequence(TransformSequenceContext sequenceContext)
Begins a transform sequence.
|
abstract void |
cancelTransform(TransformContext context)
Cancels a transform of this type.
|
void |
cancelTransformSequence(TransformSequenceContext sequenceContext)
Cancels a transform sequence of this type.
|
abstract TransformContext |
createContext(Transform transform,
Violation violation,
Location location)
Creates a context for a transform over a violation.
|
abstract void |
endTransform(TransformContext context)
Ends a transform of this type.
|
void |
endTransformSequence(TransformSequenceContext sequenceContext)
Ends a transform sequence.
|
boolean |
equals(java.lang.Object object)
Gets whether this adapter is equal to an object.
|
abstract java.lang.Class<? extends TransformContext> |
getContextClass()
Gets the class of the context created by
createContext(oracle.jdeveloper.audit.transform.Transform, oracle.jdeveloper.audit.service.Violation, oracle.jdeveloper.audit.model.Location) . |
java.util.List |
getDeferredCommands()
Gets the commands deferred by the apply method of a transform, or an empty
list if none.
|
java.util.Collection<Location> |
getHighlightRegions(TransformContext context)
Gets the highlight regions set by the apply method of a transform for its
model, or an empty list if none.
|
Location |
getSelection()
Gets the selection set by the apply method of a transform, or null
if none.
|
int |
hashCode()
Gets the hash code value for this adapter.
|
void |
invokeLater(Command command)
Invokes a command after the command currently being executed by the
Audit framework completes.
|
boolean |
isTransformable(Location location)
Gets whether a location is transformable by this transform adapter.
|
boolean |
isTransformable(ModelAdapter model)
Gets whether a model is transformable by this transform adapter.
|
java.lang.Boolean |
makeTransformable(TransformContext context)
Makes a transform location transformable if not already so.
|
protected java.lang.Boolean |
makeWritable(Node node,
Project project,
Workspace workspace) |
void |
setPredecessorApplyData(TransformContext context,
java.lang.Object applyData)
Sets the predecessor apply data for a transform.
|
void |
setSelection(Location location,
int margin,
int endMargin)
Sets the selection to be set after a transform is applied.
|
void |
setSelection(ModelAdapter model,
java.lang.Object construct,
int margin,
int endMargin)
Sets the selection to be set after a transform is applied.
|
public abstract java.lang.Class<? extends TransformContext> getContextClass()
createContext(oracle.jdeveloper.audit.transform.Transform, oracle.jdeveloper.audit.service.Violation, oracle.jdeveloper.audit.model.Location)
.public abstract TransformContext createContext(Transform transform, Violation violation, Location location)
public boolean isTransformable(ModelAdapter model)
This method should return false for any ModelAdapter
subclass it
does not support.
The default TransformAdapter
implementation returns true if the
model is writable or is version-controlled and can be made writable.
model
- The model
to be be transformed.public boolean isTransformable(Location location)
isTransformable(ModelAdapter)
returned true for that model.
The default TransformAdapter
implementation returns true unless
the location is guarded.
location
- The location to be transformed.public java.lang.Boolean makeTransformable(TransformContext context) throws java.lang.Exception
CommandProcessor.beginTrans(java.lang.String)
has been
invoked to start a command processor batch operation;
The default TransformAdapter
implementation uses the
VCSManager
to check out the file containing the location if it is
read-only and version controlled.
context
- A transform context created by this adapter.java.lang.Exception
protected java.lang.Boolean makeWritable(Node node, Project project, Workspace workspace) throws java.lang.Exception
java.lang.Exception
public void beginTransformSequence(TransformSequenceContext sequenceContext) throws java.lang.InterruptedException, java.lang.Exception
TransformAdapter
subclass and are
applied in sequence to the same model. The sequence context allows the
transform adapters to share state through the sequence, typically to allow
optimization (e.g., to coalesce multiple transactions into a single
transaction). The framework ensures the following before invoking this
method:
CommandProcessor.beginTrans(java.lang.String)
has been
invoked to start a command processor batch operation;
The default TransformAdapter
implementation does nothing.
sequenceContext
- The sequence context for the current sequence.java.lang.InterruptedException
java.lang.Exception
public abstract void beginTransform(TransformContext context) throws java.lang.InterruptedException, java.lang.Exception
CommandProcessor.beginTrans(java.lang.String)
has been
invoked to start a command processor batch operation;
beginTransformSequence(oracle.jdeveloper.audit.transform.TransformSequenceContext)
method has been invoked;
context
- A transform context created by this adapter.java.lang.InterruptedException
java.lang.Exception
public void beginTransform(TransformContext context, TransformSequenceContext sequenceContext) throws java.lang.InterruptedException, java.lang.Exception
CommandProcessor.beginTrans(java.lang.String)
has been
invoked to start a command processor batch operation;
beginTransformSequence(oracle.jdeveloper.audit.transform.TransformSequenceContext)
method has been invoked;
The default TransformAdapter)
implementation delegates to beginTransform(TransformContext)
. Adapters that are aware of transform
sequences shoould override this method rather than that one. See beginTransformSequence(oracle.jdeveloper.audit.transform.TransformSequenceContext)
.
context
- A transform context created by this adapter.sequenceContext
- A context for a sequence of transforms created by
this adapter.java.lang.InterruptedException
java.lang.Exception
public abstract void endTransform(TransformContext context) throws java.lang.Exception
beginTransform(oracle.jdeveloper.audit.transform.TransformContext)
has been invoked (its preconditions still
hold);
context
- A transform context created by this adapter.java.lang.Exception
public abstract void cancelTransform(TransformContext context) throws java.lang.Exception
beginTransform(oracle.jdeveloper.audit.transform.TransformContext)
has been invoked (its preconditions still
hold);
endTransform(oracle.jdeveloper.audit.transform.TransformContext)
method has thrown an
exception.
context
- A transform context created by this type.java.lang.Exception
public void setPredecessorApplyData(TransformContext context, java.lang.Object applyData)
context
- applyData
- public void endTransformSequence(TransformSequenceContext sequenceContext) throws java.lang.Exception
beginTransformSequence(oracle.jdeveloper.audit.transform.TransformSequenceContext)
has been invoked and its preconditions still
hold.
The default TransformAdapter
implementation does nothing.
sequenceContext
- The sequence context for the current sequence.java.lang.Exception
public void cancelTransformSequence(TransformSequenceContext sequenceContext) throws java.lang.Exception
beginTransformSequence(oracle.jdeveloper.audit.transform.TransformSequenceContext)
has been invoked (its preconditions still
hold);
endTransformSequence(oracle.jdeveloper.audit.transform.TransformSequenceContext)
method has thrown an
exception.
The default TransformAdapter
implementation does nothing.
sequenceContext
- The sequence context for the current sequence.java.lang.Exception
public void invokeLater(Command command)
public java.util.List getDeferredCommands()
endTransform(oracle.jdeveloper.audit.transform.TransformContext)
and invokes the commands returned in order.List
of Command
s.public void setSelection(ModelAdapter model, java.lang.Object construct, int margin, int endMargin)
TransformContext.setSelection(java.lang.Object, int, int)
.model
- The model containing the construct to select.construct
- The construct at which to place the caret.margin
- Margin from start of construct to start of selection.endMargin
- Margin from end of construct to end of selection.public void setSelection(Location location, int margin, int endMargin)
TransformContext.setSelection(java.lang.Object, int, int)
.location
- The location to select.margin
- Margin from start of construct to start of selection.endMargin
- Margin from end of construct to end of selection.public Location getSelection()
endTransform(oracle.jdeveloper.audit.transform.TransformContext)
.Location
of length 0.public void addHighlight(ModelAdapter model, java.lang.Object construct)
construct
- The construct to highlight.public void addRemovedHighlight(ModelAdapter model, java.lang.Object construct)
construct
- The construct to be removed.public java.util.Collection<Location> getHighlightRegions(TransformContext context)
endTransform(oracle.jdeveloper.audit.transform.TransformContext)
.context
- A transform context created by this adapter.Collection
of {#link Location}s.public boolean equals(java.lang.Object object)
TransformAdapter
implementations will not need to override this method.
The default TransformAdapter
implementation returns getClass().hashCode()
.equals
in class java.lang.Object
public int hashCode()
TransformAdapter
implementations will not need to override this method.
The default TransformAdapter
implementation returns getClass().hashCode()
.hashCode
in class java.lang.Object