public abstract class Operation
extends java.lang.Object
AbstractSingleFlavorOperation
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
OPERATION_ICON
Meta data key for fetching an icon from a given TransferDataInfo for use
in a menu item associated with this Operation.
|
static float |
STANDARD_OPERATIONS_RANK
The rank that built-in standard operations (move, copy, etc) use.
|
Constructor and Description |
---|
Operation() |
Modifier and Type | Method and Description |
---|---|
boolean |
apply(CmtModel model,
UIPosition pos,
oracle.javatools.datatransfer.TransferDataInfo data)
Applies this operation, returning whether it was applied successfully.
|
javax.swing.Action |
createAsAction(CmtModel model,
java.util.List listOfDataAndPositions)
Creates an
Action that represents the way(s) in which this
operation could be applied to the given model and the given list
of DataAndPositions (which was returned from
getApplicableDataAndPositions(oracle.jdeveloper.cmt.CmtModel, java.util.List, oracle.javatools.datatransfer.ExtendedTransferable) . |
boolean |
doesActionMutateModel()
Hook for an action to be able to say it doesn't mutate the model.
|
abstract java.util.List |
getApplicableDataAndPositions(CmtModel model,
java.util.List positions,
oracle.javatools.datatransfer.ExtendedTransferable transferable)
Gets the possible
TransferDataInfo s upon which this action could
be applied near the given position, and also returns the actual position
at which the operation could be performed. |
abstract java.lang.String |
getDisplayName(CmtModel model,
oracle.javatools.datatransfer.TransferDataInfo info)
Gets the display name for this operation, inserting the display name
of the given data info.
|
protected java.lang.String |
getPositionDisplayName(CmtModel model,
UIPosition position) |
abstract float |
getSuitabilityRank()
Gets a floating point number indicating how suitable this operation is
TODO: Should this take data info, position, model?
|
abstract int |
getSupportedActions()
Gets supported dnd action, using DnD's constants
|
public static final float STANDARD_OPERATIONS_RANK
public static final java.lang.String OPERATION_ICON
public abstract int getSupportedActions()
public boolean doesActionMutateModel()
public abstract java.util.List getApplicableDataAndPositions(CmtModel model, java.util.List positions, oracle.javatools.datatransfer.ExtendedTransferable transferable)
TransferDataInfo
s upon which this action could
be applied near the given position, and also returns the actual position
at which the operation could be performed.model
- Model on which the operation may be appliedpositions
- List of CmtModelNode
s to consider. The order of
this list should be preserved in any return
DataAndPosition.transferable
- Data being transferedDataAndPositions
to be applied "near" the given
position list, ordered by suitability (first return is most
preferable datum). Each DataAndPosition's position list should
be in a similar order to the positions parameter.public boolean apply(CmtModel model, UIPosition pos, oracle.javatools.datatransfer.TransferDataInfo data) throws java.io.IOException
model
- Model to apply the operation onpos
- Position to consider, which is guaranteed to be the result
of an earlier call to #convertOperationPosition
for
this model and data.data
- Data to use, which is guaranteed to be a result of an
earlier call to #getApplicableData
with this model
and position.java.io.IOException
- if there is an I/O error fetching the datapublic javax.swing.Action createAsAction(CmtModel model, java.util.List listOfDataAndPositions)
Action
that represents the way(s) in which this
operation could be applied to the given model and the given list
of DataAndPositions
(which was returned from
getApplicableDataAndPositions(oracle.jdeveloper.cmt.CmtModel, java.util.List, oracle.javatools.datatransfer.ExtendedTransferable)
.
The default behavior is as follows:
PerformOperationAction
,
for how to return more than one
public abstract java.lang.String getDisplayName(CmtModel model, oracle.javatools.datatransfer.TransferDataInfo info)
info
- Data being operated on, or null if none in particularprotected final java.lang.String getPositionDisplayName(CmtModel model, UIPosition position)
public abstract float getSuitabilityRank()