mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
Test fixes
This commit is contained in:
parent
48a7542e47
commit
f7c1714bb1
3 changed files with 37 additions and 21 deletions
|
@ -41,8 +41,8 @@ public class BookmarkEditCmd implements Command<Program> {
|
|||
private String presentationName;
|
||||
|
||||
/**
|
||||
* Edit a Bookmark. When editing a bookmark, all fields are used except the address
|
||||
* which is determined by the first address within each range of the set.
|
||||
* Constructor
|
||||
*
|
||||
* @param set list of bookmark addresses.
|
||||
* @param type the bookmark type.
|
||||
* @param category the bookmark category.
|
||||
|
@ -53,14 +53,15 @@ public class BookmarkEditCmd implements Command<Program> {
|
|||
this.category = category;
|
||||
this.comment = comment;
|
||||
this.set = set;
|
||||
if (set == null || set.isEmpty() || type == null || type.length() == 0)
|
||||
if (set == null || set.isEmpty() || type == null || type.length() == 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
presentationName = "Add " + type + " Bookmark(s)";
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit a Bookmark. When editing a bookmark, all fields are used except the address
|
||||
* which is provided by the addrs parameter.
|
||||
* Constructor
|
||||
*
|
||||
* @param addr the bookmark address.
|
||||
* @param type the bookmark type.
|
||||
* @param category the bookmark category.
|
||||
|
@ -71,8 +72,9 @@ public class BookmarkEditCmd implements Command<Program> {
|
|||
this.category = category;
|
||||
this.comment = comment;
|
||||
this.addr = addr;
|
||||
if (addr == null || type == null || type.length() == 0)
|
||||
if (addr == null || type == null || type.length() == 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
presentationName = "Add " + type + " Bookmark";
|
||||
}
|
||||
|
||||
|
@ -80,13 +82,14 @@ public class BookmarkEditCmd implements Command<Program> {
|
|||
this.bookmark = bookmark;
|
||||
this.category = category;
|
||||
this.comment = comment;
|
||||
if (bookmark == null)
|
||||
if (bookmark == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
presentationName = "Edit " + bookmark.getTypeString() + " Bookmark";
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the edit action.
|
||||
* {@return The name of the edit action.}
|
||||
*/
|
||||
public String getPresentationName() {
|
||||
return presentationName;
|
||||
|
|
|
@ -82,16 +82,35 @@ public class BookmarkNavigator {
|
|||
|
||||
Icon icon = bmt.getIcon();
|
||||
if (icon == null) {
|
||||
if (bookmarkManager.isDefinedType(type)) {
|
||||
// This implies the client defined a type, but did not pass a valid icon. In this
|
||||
// case we will show a special icon.
|
||||
icon = DEFAULT_ICON;
|
||||
}
|
||||
}
|
||||
|
||||
Color color = bmt.getMarkerColor();
|
||||
if (color == null) {
|
||||
color = DEFAULT_COLOR;
|
||||
}
|
||||
|
||||
markerSet = markerService.createPointMarker(type + " Bookmarks", type + " Bookmarks",
|
||||
//
|
||||
// Be default, bookmarks appear with an icon on the left side of the Listing. If there is
|
||||
// no icon, then skip the icon and instead add a color marker on the right side of the
|
||||
// Listing so the user can see the bookmark. As long as clients call BookmarkManager's
|
||||
// defineType() method with a valid icon, then we will show the icon, which is the expected
|
||||
// behavior.
|
||||
//
|
||||
String markerName = type + " Bookmarks";
|
||||
if (icon != null) {
|
||||
markerSet = markerService.createPointMarker(markerName, markerName,
|
||||
bookmarkMgr.getProgram(), priority, true, true, false, color, icon);
|
||||
}
|
||||
else {
|
||||
markerSet =
|
||||
markerService.createAreaMarker(markerName, markerName, bookmarkMgr.getProgram(),
|
||||
priority, false, true, false, color);
|
||||
}
|
||||
|
||||
markerSet.setMarkerDescriptor(new MarkerDescriptor() {
|
||||
|
||||
|
|
|
@ -306,12 +306,6 @@ public class BookmarkPlugin extends ProgramPlugin implements PopupActionProvider
|
|||
}
|
||||
|
||||
BookmarkManager bookmarkManager = currentProgram.getBookmarkManager();
|
||||
if (!bookmarkManager.isDefinedType(typeString)) {
|
||||
// This implies the bookmark was created by a plugin that is no longer available in
|
||||
// the current tool.
|
||||
return null;
|
||||
}
|
||||
|
||||
nav = new BookmarkNavigator(markerService, bookmarkManager, type);
|
||||
bookmarkNavigators.put(typeString, nav);
|
||||
return nav;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue