Package ghidra.program.model.listing
Interface BookmarkManager
-
- All Known Implementing Classes:
BookmarkDBManager
public interface BookmarkManager
Interface for managing bookmarks.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
OLD_BOOKMARK_PROPERTY_OBJECT_CLASS1
1st version of bookmark property object class (schema change and class moved)static java.lang.String
OLD_BOOKMARK_PROPERTY_OBJECT_CLASS2
2nd version of bookmark property object class (class moved, property map no longer used)
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BookmarkType
defineType(java.lang.String type, javax.swing.ImageIcon icon, java.awt.Color color, int priority)
Define a bookmark type with its marker icon and color.Bookmark
getBookmark(long id)
Returns the bookmark that has the given id or null if no such bookmark exists.Bookmark
getBookmark(Address addr, java.lang.String type, java.lang.String category)
Get a specific bookmarkAddressSetView
getBookmarkAddresses(java.lang.String type)
Get addresses for bookmarks of a specified type.int
getBookmarkCount()
Returns the total number of bookmarks in the program.int
getBookmarkCount(java.lang.String type)
Return the number of bookmarks of the given type.Bookmark[]
getBookmarks(Address addr)
Get all bookmarks on a specific addressBookmark[]
getBookmarks(Address address, java.lang.String type)
Get bookmarks of the indicated type on a specific addressjava.util.Iterator<Bookmark>
getBookmarksIterator()
Returns an iterator over all bookmarks.java.util.Iterator<Bookmark>
getBookmarksIterator(Address startAddress, boolean forward)
Returns an iterator over all bookmark types, starting at the given address, with traversal in the given direction.java.util.Iterator<Bookmark>
getBookmarksIterator(java.lang.String type)
Get iterator over all bookmarks of the specified type.BookmarkType
getBookmarkType(java.lang.String type)
Get a bookmark typeBookmarkType[]
getBookmarkTypes()
Returns list of known bookmark types.java.lang.String[]
getCategories(java.lang.String type)
Get list of categories used for a specified typeProgram
getProgram()
Returns the program associated with this BookmarkManager.boolean
hasBookmarks(java.lang.String type)
Returns true if program contains one or more bookmarks of the given type.void
removeBookmark(Bookmark bookmark)
Remove bookmarkvoid
removeBookmarks(AddressSetView set, TaskMonitor monitor)
Removes all bookmarks over the given address set.void
removeBookmarks(AddressSetView set, java.lang.String type, TaskMonitor monitor)
Removes all bookmarks of the given type over the given address setvoid
removeBookmarks(AddressSetView set, java.lang.String type, java.lang.String category, TaskMonitor monitor)
Removes all bookmarks of the given type and category over the given address setvoid
removeBookmarks(java.lang.String type)
Removes all bookmarks of the given type.void
removeBookmarks(java.lang.String type, java.lang.String category, TaskMonitor monitor)
Removes all bookmarks with the given type and category.Bookmark
setBookmark(Address addr, java.lang.String type, java.lang.String category, java.lang.String comment)
Set a bookmark.
-
-
-
Field Detail
-
OLD_BOOKMARK_PROPERTY_OBJECT_CLASS1
static final java.lang.String OLD_BOOKMARK_PROPERTY_OBJECT_CLASS1
1st version of bookmark property object class (schema change and class moved)- See Also:
- Constant Field Values
-
OLD_BOOKMARK_PROPERTY_OBJECT_CLASS2
static final java.lang.String OLD_BOOKMARK_PROPERTY_OBJECT_CLASS2
2nd version of bookmark property object class (class moved, property map no longer used)- See Also:
- Constant Field Values
-
-
Method Detail
-
defineType
BookmarkType defineType(java.lang.String type, javax.swing.ImageIcon icon, java.awt.Color color, int priority)
Define a bookmark type with its marker icon and color. The icon and color values are not permanently stored. Therefor, this method must be re-invoked by a plugin each time a program is opened if a custom icon and color are desired.- Parameters:
type
- bookmark typeicon
- marker icon which may get scaledcolor
- marker color- Returns:
- bookmark type object
- Throws:
java.io.IOException
- if a database error occurs while adding the new type.
-
getBookmarkTypes
BookmarkType[] getBookmarkTypes()
Returns list of known bookmark types.
-
getBookmarkType
BookmarkType getBookmarkType(java.lang.String type)
Get a bookmark type- Parameters:
type
- bookmark type name- Returns:
- bookmark type or null if type is unknown
-
getCategories
java.lang.String[] getCategories(java.lang.String type)
Get list of categories used for a specified type- Parameters:
type
- bookmark type- Returns:
- array of category strings
-
setBookmark
Bookmark setBookmark(Address addr, java.lang.String type, java.lang.String category, java.lang.String comment)
Set a bookmark.- Parameters:
addr
- the address at which to set a bookmarktype
- the name of the bookmark type.category
- the category for the bookmark.comment
- the comment to associate with the bookmark.
-
getBookmark
Bookmark getBookmark(Address addr, java.lang.String type, java.lang.String category)
Get a specific bookmark- Parameters:
addr
- the address of the bookmark to retrievetype
- the name of the bookmark type.category
- the category of the bookmark.- Returns:
- the bookmark with the given attributes, or null if no bookmarks match.
-
removeBookmark
void removeBookmark(Bookmark bookmark)
Remove bookmark- Parameters:
bookmark
- the bookmark to remove.
-
removeBookmarks
void removeBookmarks(java.lang.String type)
Removes all bookmarks of the given type.- Parameters:
type
- bookmark type
-
removeBookmarks
void removeBookmarks(java.lang.String type, java.lang.String category, TaskMonitor monitor) throws CancelledException
Removes all bookmarks with the given type and category.- Parameters:
type
- the type of the bookmarks to be removed.category
- bookmark category of the types to be removed.monitor
- a task monitor to report the progress.- Throws:
CancelledException
- if the user (via the monitor) cancelled the operation.
-
removeBookmarks
void removeBookmarks(AddressSetView set, TaskMonitor monitor) throws CancelledException
Removes all bookmarks over the given address set.- Parameters:
set
- the set of addresses from which to remove all bookmarks.monitor
- a taskmonitor to report the progress.- Throws:
CancelledException
- if the user (via the monitor) cancelled the operation.
-
removeBookmarks
void removeBookmarks(AddressSetView set, java.lang.String type, TaskMonitor monitor) throws CancelledException
Removes all bookmarks of the given type over the given address set- Parameters:
set
- the set of addresses from which to remove all bookmarks of the given type.type
- the type of bookmarks to remove.monitor
- a taskmonitor to report the progress.- Throws:
CancelledException
- if the user (via the monitor) cancelled the operation.
-
removeBookmarks
void removeBookmarks(AddressSetView set, java.lang.String type, java.lang.String category, TaskMonitor monitor) throws CancelledException
Removes all bookmarks of the given type and category over the given address set- Parameters:
set
- the set of addresses from which to remove all bookmarks of the given type and category.type
- the type of bookmarks to remove.category
- the category of bookmarks to remove.monitor
- a taskmonitor to report the progress.- Throws:
CancelledException
- if the user (via the monitor) cancelled the operation.
-
getBookmarks
Bookmark[] getBookmarks(Address address, java.lang.String type)
Get bookmarks of the indicated type on a specific address- Parameters:
address
- the address at which to search for bookmarks.type
- bookmark type to search for- Returns:
- array of bookmarks
-
getBookmarks
Bookmark[] getBookmarks(Address addr)
Get all bookmarks on a specific address- Parameters:
addr
- the address at which to retrieve all bookmarks.- Returns:
- array of bookmarks
-
getBookmarkAddresses
AddressSetView getBookmarkAddresses(java.lang.String type)
Get addresses for bookmarks of a specified type.- Parameters:
type
- bookmark type- Returns:
- address set containing bookmarks of the specified type.
-
getBookmarksIterator
java.util.Iterator<Bookmark> getBookmarksIterator(java.lang.String type)
Get iterator over all bookmarks of the specified type.- Parameters:
type
- the bookmark type to search for- Returns:
- an iterator over all bookmarks of the specified type.
-
getBookmarksIterator
java.util.Iterator<Bookmark> getBookmarksIterator()
Returns an iterator over all bookmarks.
-
getBookmarksIterator
java.util.Iterator<Bookmark> getBookmarksIterator(Address startAddress, boolean forward)
Returns an iterator over all bookmark types, starting at the given address, with traversal in the given direction.- Parameters:
startAddress
- the address at which to startforward
- true to iterate in the forward direction; false for backwards- Returns:
- an iterator over all bookmark types, starting at the given address, with traversal in the given direction.
-
getBookmark
Bookmark getBookmark(long id)
Returns the bookmark that has the given id or null if no such bookmark exists.- Parameters:
id
- the id of the bookmark to be retrieved.
-
hasBookmarks
boolean hasBookmarks(java.lang.String type)
Returns true if program contains one or more bookmarks of the given type.- Parameters:
type
- the type of bookmark to check for.
-
getBookmarkCount
int getBookmarkCount(java.lang.String type)
Return the number of bookmarks of the given type.- Parameters:
type
- the type of bookmarks to count.
-
getBookmarkCount
int getBookmarkCount()
Returns the total number of bookmarks in the program.
-
getProgram
Program getProgram()
Returns the program associated with this BookmarkManager.- Returns:
- the program associated with this BookmarkManager.
-
-