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;
|
private String presentationName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit a Bookmark. When editing a bookmark, all fields are used except the address
|
* Constructor
|
||||||
* which is determined by the first address within each range of the set.
|
*
|
||||||
* @param set list of bookmark addresses.
|
* @param set list of bookmark addresses.
|
||||||
* @param type the bookmark type.
|
* @param type the bookmark type.
|
||||||
* @param category the bookmark category.
|
* @param category the bookmark category.
|
||||||
|
@ -53,14 +53,15 @@ public class BookmarkEditCmd implements Command<Program> {
|
||||||
this.category = category;
|
this.category = category;
|
||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
this.set = set;
|
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();
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
presentationName = "Add " + type + " Bookmark(s)";
|
presentationName = "Add " + type + " Bookmark(s)";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit a Bookmark. When editing a bookmark, all fields are used except the address
|
* Constructor
|
||||||
* which is provided by the addrs parameter.
|
*
|
||||||
* @param addr the bookmark address.
|
* @param addr the bookmark address.
|
||||||
* @param type the bookmark type.
|
* @param type the bookmark type.
|
||||||
* @param category the bookmark category.
|
* @param category the bookmark category.
|
||||||
|
@ -71,8 +72,9 @@ public class BookmarkEditCmd implements Command<Program> {
|
||||||
this.category = category;
|
this.category = category;
|
||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
this.addr = addr;
|
this.addr = addr;
|
||||||
if (addr == null || type == null || type.length() == 0)
|
if (addr == null || type == null || type.length() == 0) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
presentationName = "Add " + type + " Bookmark";
|
presentationName = "Add " + type + " Bookmark";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,13 +82,14 @@ public class BookmarkEditCmd implements Command<Program> {
|
||||||
this.bookmark = bookmark;
|
this.bookmark = bookmark;
|
||||||
this.category = category;
|
this.category = category;
|
||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
if (bookmark == null)
|
if (bookmark == null) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
presentationName = "Edit " + bookmark.getTypeString() + " Bookmark";
|
presentationName = "Edit " + bookmark.getTypeString() + " Bookmark";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the edit action.
|
* {@return The name of the edit action.}
|
||||||
*/
|
*/
|
||||||
public String getPresentationName() {
|
public String getPresentationName() {
|
||||||
return presentationName;
|
return presentationName;
|
||||||
|
|
|
@ -82,7 +82,11 @@ public class BookmarkNavigator {
|
||||||
|
|
||||||
Icon icon = bmt.getIcon();
|
Icon icon = bmt.getIcon();
|
||||||
if (icon == null) {
|
if (icon == null) {
|
||||||
icon = DEFAULT_ICON;
|
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();
|
Color color = bmt.getMarkerColor();
|
||||||
|
@ -90,8 +94,23 @@ public class BookmarkNavigator {
|
||||||
color = DEFAULT_COLOR;
|
color = DEFAULT_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
markerSet = markerService.createPointMarker(type + " Bookmarks", type + " Bookmarks",
|
//
|
||||||
bookmarkMgr.getProgram(), priority, true, true, false, color, icon);
|
// 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() {
|
markerSet.setMarkerDescriptor(new MarkerDescriptor() {
|
||||||
|
|
||||||
|
|
|
@ -306,12 +306,6 @@ public class BookmarkPlugin extends ProgramPlugin implements PopupActionProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
BookmarkManager bookmarkManager = currentProgram.getBookmarkManager();
|
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);
|
nav = new BookmarkNavigator(markerService, bookmarkManager, type);
|
||||||
bookmarkNavigators.put(typeString, nav);
|
bookmarkNavigators.put(typeString, nav);
|
||||||
return nav;
|
return nav;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue