Class InteractiveWrapperUnit
- All Implemented Interfaces:
IUnitCreator,IUserDataSupport,IAddressableUnit,IInteractiveUnit,IUnit,com.pnfsoftware.jeb.corei.IWrap<IInteractiveUnit>,IEventSource
IInteractiveUnit.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddressToLocation(String address) Convert a unit-specific address to location information relative to the input.booleancanExecuteAction(ActionContext actionContext) Verify if an action can be executed.booleanexecuteAction(ActionContext actionContext, IActionData actionData) Execute an action.booleanexecuteAction(ActionContext actionContext, IActionData actionData, boolean notify) Execute an action and optionally notify clients if the action was executed successfully and modified the unit contents.getAddressActions(String address) Provide a list of actions that may be executed at the given address.getAddressLabel(String address) Retrieve the label at a given address.Retrieve all labels.getAddressOfItem(long id) Attempt to determine the best address for a given item.Provide a list of actions that may be executed globally.getInlineComment(String address) Retrieve the primary comment at a given address.Retrieve all primary comments.getItemActions(long id) Provide a list of actions that may be executed on the item with the given id.longgetItemAtAddress(String address) Attempt to determine the best item for a given address.getItemObject(long id) Optionally provide an object associated with the given item.Get a reference to the metadata manager for this unit.getRelatedItems(long id) Retrieve items related to the provided item id.booleanisValidAddress(String address) Determine if the provided address is a valid address for this unit.locationToAddress(IInputLocation location) Convert a location relative to the input to a unit-specific address.booleanprepareExecution(ActionContext actionContext, IActionData actionData) Prepare the execution of an action.booleansetInlineComment(String address, String comment) Set or delete the primary comment at a given address.Methods inherited from class com.pnfsoftware.jeb.core.units.impl.WrapperUnit
addChild, addChild, addListener, canBePersisted, clearAllData, countListeners, dispose, generateQuickState, getAllData, getChildren, getContributions, getCreationTimestamp, getData, getDescription, getFormatter, getFormatType, getIconData, getInterpreters, getListeners, getLock, getName, getNotes, getNotificationManager, getParent, getParentSource, getPropertyDefinitionManager, getPropertyManager, getRealName, getStatus, getUid, getUnitProcessor, getWrap, initializePropertyObjects, insertListener, isDisposed, isProcessed, isStale, isTransientChild, notifyListeners, postDeserialization, process, removeChild, removeListener, setData, setName, setNotes, setParent, setParentSource, setRealName, setUnitProcessorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.pnfsoftware.jeb.core.units.IAddressableUnit
getCanonicalAddress, getWellKnownAddressesMethods inherited from interface com.pnfsoftware.jeb.util.events.IEventSource
addListener, countListeners, getListeners, getParentSource, insertListener, notifyListeners, removeListener, setParentSourceMethods inherited from interface com.pnfsoftware.jeb.core.units.IInteractiveUnit
getCommentManager, getFullComment, getFullCommentsMethods inherited from interface com.pnfsoftware.jeb.core.units.IUnit
addChild, addChild, canBePersisted, dispose, execprvfunc, generateQuickState, getChildren, getContributions, getCreationTimestamp, getDescription, getExtraInputs, getFormatter, getFormatType, getIconData, getInput, getInterpreters, getLock, getName, getNotes, getNotificationManager, getParent, getParentArtifact, getParentProject, getPropertyDefinitionManager, getPropertyManager, getRealName, getStatus, getUid, getUnitProcessor, initializePropertyObjects, isDisposed, isProcessed, isStale, isTransientChild, notifyGenericChange, postDeserialization, process, removeChild, setName, setNotes, setParent, setRealName, setUnitProcessorMethods inherited from interface com.pnfsoftware.jeb.core.IUserDataSupport
clearAllData, getAllData, getData, setData
-
Constructor Details
-
InteractiveWrapperUnit
- Parameters:
unit-IUnitto be delegatedprovider- provider that extends the unit behavior
-
-
Method Details
-
addressToLocation
Description copied from interface:IInteractiveUnitConvert a unit-specific address to location information relative to the input. The default implementation returns null.Example: the location information could contain an (offset, size) tuple if the input is a sequence of bytes, such as for
IBinaryUnit.Note: The addressing scheme is unit specific, and defined by the plugin developer. Addresses should not start with the reserved '@' prefix.
- Specified by:
addressToLocationin interfaceIInteractiveUnit- Parameters:
address- mandatory address- Returns:
- the location, null if none, error, or not supported
-
canExecuteAction
Description copied from interface:IInteractiveUnitVerify if an action can be executed. Clients must call this method before attempting to callprepareExecutionorexecuteAction.- Specified by:
canExecuteActionin interfaceIInteractiveUnit- Parameters:
actionContext- location context for the action- Returns:
- true
-
executeAction
Description copied from interface:IInteractiveUnitExecute an action. On success, the plugin should notify listeners if the unit contents has changed, by issuing aJ.UnitChangeevent.- Specified by:
executeActionin interfaceIInteractiveUnit- Parameters:
actionContext- location context for the actionactionData- data for the action- Returns:
- true if the execution was successful. Upon successful execution, actionData will contain plugin-set post-execution data
-
executeAction
Description copied from interface:IInteractiveUnitExecute an action and optionally notify clients if the action was executed successfully and modified the unit contents.Note: setting `notify` to false can be handy when executing many actions in a short time span (which could result in many events being generated). However, since clients will not be notified that the unit has changed, it is good practice for code to manually issue a single
J.UnitChangeafter the unit has received that series of modification.- Specified by:
executeActionin interfaceIInteractiveUnit- Parameters:
actionContext- context for the actionactionData- data for the actionnotify- true to notify clients if the action was successfully executed and the unit contents has changed- Returns:
- action success indicator
-
getAddressActions
Description copied from interface:IInteractiveUnitProvide a list of actions that may be executed at the given address. Global actions should not be returned by this method, even though they may be executed on the given (or any) address as well.- Specified by:
getAddressActionsin interfaceIInteractiveUnit- Parameters:
address- the target address- Returns:
- the list of actions
- See Also:
-
getMetadataManager
Description copied from interface:IInteractiveUnitGet a reference to the metadata manager for this unit. The metadata manager is optional; units may decide to not provide one. Units inheriting fromAbstractInteractiveUnitorAbstractInteractiveBinaryUnitdo offer adefault metadata manager.- Specified by:
getMetadataManagerin interfaceIInteractiveUnit- Returns:
- the manager, null if none
-
getAddressLabel
Description copied from interface:IAddressableUnitRetrieve the label at a given address. The default implementation returns null.- Specified by:
getAddressLabelin interfaceIAddressableUnit- Parameters:
address- mandatory address- Returns:
- the label, null if none
-
getAddressLabels
Description copied from interface:IAddressableUnitRetrieve all labels. The default implementation returns an empty map.- Specified by:
getAddressLabelsin interfaceIAddressableUnit- Returns:
- a map of "address: label" value pairs
-
getAddressOfItem
Description copied from interface:IAddressableUnitAttempt to determine the best address for a given item. Implementors may return null if a conversion is deemed impossible, inaccurate or irrelevant.Clients use this method to provide navigation capability, for example, jumping from an item to the master (main) related item, that would be located at the resulting address.
Plugin developers are recommended to implement this method.
- Specified by:
getAddressOfItemin interfaceIAddressableUnit- Parameters:
id- the item id- Returns:
- an address best representing or matching the provided item, null otherwise
-
getRelatedItems
Description copied from interface:IAddressableUnitRetrieve items related to the provided item id. The definition and context of 'relation' is implementation dependent.- Specified by:
getRelatedItemsin interfaceIAddressableUnit- Parameters:
id- an item id- Returns:
- a list of related items (not containing the provided id), may be empty - never null
-
getInlineComment
Description copied from interface:IInteractiveUnitRetrieve the primary comment at a given address. The default implementation returns null.- Specified by:
getInlineCommentin interfaceIInteractiveUnit- Parameters:
address- mandatory address- Returns:
- the comment, null if none
-
getInlineComments
Description copied from interface:IInteractiveUnitRetrieve all primary comments. The default implementation returns an empty map.- Specified by:
getInlineCommentsin interfaceIInteractiveUnit- Returns:
- a map of "address: comment" value pairs
-
setInlineComment
Description copied from interface:IInteractiveUnitSet or delete the primary comment at a given address. The default implementation returns false.- Specified by:
setInlineCommentin interfaceIInteractiveUnitcomment- the new comment; null to remove any previous comment- Returns:
- success indicator
-
getItemObject
Description copied from interface:IAddressableUnitOptionally provide an object associated with the given item. This method may return null, an opaque object, or an object defined by the contract of the implementing object or sub-interface. The SPI of sub-interfaces should specify the item id formats, if any, as well as types and semantics associated with the objects returned by this method.- Specified by:
getItemObjectin interfaceIAddressableUnit- Parameters:
id- the item id- Returns:
- an object, whose type is defined by contract, potentially null
-
getGlobalActions
Description copied from interface:IInteractiveUnitProvide a list of actions that may be executed globally.- Specified by:
getGlobalActionsin interfaceIInteractiveUnit- Returns:
- the list of actions
-
getItemActions
Description copied from interface:IInteractiveUnitProvide a list of actions that may be executed on the item with the given id. Global actions should not be returned by this method, even though they may be executed on the given (or any) item id as well.- Specified by:
getItemActionsin interfaceIInteractiveUnit- Parameters:
id- the target item identifier- Returns:
- the list of actions
-
isValidAddress
Description copied from interface:IAddressableUnitDetermine if the provided address is a valid address for this unit.- Specified by:
isValidAddressin interfaceIAddressableUnit- Returns:
-
getItemAtAddress
Description copied from interface:IAddressableUnitAttempt to determine the best item for a given address. Implementors may return 0 if a conversion is deemed impossible, inaccurate or irrelevant.- Specified by:
getItemAtAddressin interfaceIAddressableUnit- Parameters:
address- the address- Returns:
- an item best representing or matching the provided address, 0 otherwise
-
locationToAddress
Description copied from interface:IInteractiveUnitConvert a location relative to the input to a unit-specific address. The default implementation returns null.Note: The addressing scheme is unit specific, and defined by the plugin developer. Addresses should not start with the reserved '@' prefix.
- Specified by:
locationToAddressin interfaceIInteractiveUnit- Parameters:
location- mandatory location- Returns:
- the address, null if none, error, or not supported
-
prepareExecution
Description copied from interface:IInteractiveUnitPrepare the execution of an action. Clients must call this method before attempting to callexecuteAction.- Specified by:
prepareExecutionin interfaceIInteractiveUnit- Parameters:
actionContext- location context for the actionactionData- data for the action- Returns:
- true if the preparation was successful, and the action may be executed. Upon successful preparation, actionData will contain plugin-set pre-execution data
-