mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +02:00
Merge remote-tracking branch 'origin/GP-4023-dragonmacher-debugger-markers-issue--SQUASHED'
This commit is contained in:
commit
8d20806d93
6 changed files with 49 additions and 13 deletions
|
@ -89,6 +89,7 @@ public class DBTraceBookmarkManager extends AbstractDBTraceSpaceBasedManager<DBT
|
||||||
return addressFactory.getAddressSpace(spaceId);
|
return addressFactory.getAddressSpace(spaceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final Set<String> definedTypes = new HashSet<>();
|
||||||
protected final Map<String, DBTraceBookmarkType> typesByName = new HashMap<>();
|
protected final Map<String, DBTraceBookmarkType> typesByName = new HashMap<>();
|
||||||
protected final Collection<DBTraceBookmarkType> typesView =
|
protected final Collection<DBTraceBookmarkType> typesView =
|
||||||
Collections.unmodifiableCollection(typesByName.values());
|
Collections.unmodifiableCollection(typesByName.values());
|
||||||
|
@ -155,6 +156,10 @@ public class DBTraceBookmarkManager extends AbstractDBTraceSpaceBasedManager<DBT
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isDefinedType(String type) {
|
||||||
|
return definedTypes.contains(type);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized DBTraceBookmarkType defineBookmarkType(String typeName, Icon icon,
|
public synchronized DBTraceBookmarkType defineBookmarkType(String typeName, Icon icon,
|
||||||
Color color, int priority) {
|
Color color, int priority) {
|
||||||
|
@ -169,6 +174,7 @@ public class DBTraceBookmarkManager extends AbstractDBTraceSpaceBasedManager<DBT
|
||||||
}
|
}
|
||||||
type = new DBTraceBookmarkType(this, typeName, icon, color, priority);
|
type = new DBTraceBookmarkType(this, typeName, icon, color, priority);
|
||||||
typesByName.put(typeName, type);
|
typesByName.put(typeName, type);
|
||||||
|
definedTypes.add(typeName);
|
||||||
}
|
}
|
||||||
trace.setChanged(new TraceChangeRecord<>(TraceEvents.BOOKMARK_TYPE_ADDED, null, type));
|
trace.setChanged(new TraceChangeRecord<>(TraceEvents.BOOKMARK_TYPE_ADDED, null, type));
|
||||||
return type;
|
return type;
|
||||||
|
|
|
@ -54,6 +54,11 @@ public class DBTraceProgramViewBookmarkManager implements TraceProgramViewBookma
|
||||||
return bookmarkManager.defineBookmarkType(type, icon, color, priority);
|
return bookmarkManager.defineBookmarkType(type, icon, color, priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDefinedType(String type) {
|
||||||
|
return bookmarkManager.isDefinedType(type);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BookmarkType[] getBookmarkTypes() {
|
public BookmarkType[] getBookmarkTypes() {
|
||||||
Collection<? extends TraceBookmarkType> types = bookmarkManager.getDefinedBookmarkTypes();
|
Collection<? extends TraceBookmarkType> types = bookmarkManager.getDefinedBookmarkTypes();
|
||||||
|
|
|
@ -298,12 +298,22 @@ public class BookmarkPlugin extends ProgramPlugin implements PopupActionProvider
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String typeString = type.getTypeString();
|
String typeString = type.getTypeString();
|
||||||
BookmarkNavigator nav = bookmarkNavigators.get(typeString);
|
BookmarkNavigator nav = bookmarkNavigators.get(typeString);
|
||||||
if (nav == null) {
|
if (nav != null) {
|
||||||
nav = new BookmarkNavigator(markerService, currentProgram.getBookmarkManager(), type);
|
return nav;
|
||||||
bookmarkNavigators.put(typeString, nav);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
return nav;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -351,12 +351,11 @@ public class WindowUtilities {
|
||||||
// 'pad' is for checking to avoid full-size windows with odd OS borders. This is an
|
// 'pad' is for checking to avoid full-size windows with odd OS borders. This is an
|
||||||
// arbitrary number that is larger than the 'move' amount below.
|
// arbitrary number that is larger than the 'move' amount below.
|
||||||
int pad = 50;
|
int pad = 50;
|
||||||
int screenArea = screen.width * screen.height;
|
if (bounds.width > screen.width) {
|
||||||
int boundsArea = bounds.width * bounds.height;
|
bounds.width = screen.width - pad;
|
||||||
if (boundsArea > screenArea) {
|
}
|
||||||
int newWidth = screen.width - pad;
|
if (bounds.height > screen.height) {
|
||||||
int newHeight = screen.height - pad;
|
bounds.height = screen.height - pad;
|
||||||
bounds.setSize(newWidth, newHeight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next, move the window as little as possible to get fully on-screen.
|
// Next, move the window as little as possible to get fully on-screen.
|
||||||
|
|
|
@ -52,6 +52,7 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
|
||||||
private boolean upgrade = false;
|
private boolean upgrade = false;
|
||||||
|
|
||||||
private Map<String, BookmarkType> typesByName = new TreeMap<>();
|
private Map<String, BookmarkType> typesByName = new TreeMap<>();
|
||||||
|
private Set<String> definedTypes = new HashSet<>();
|
||||||
private ObjectArray typesArray = new ObjectArray();
|
private ObjectArray typesArray = new ObjectArray();
|
||||||
private Lock lock;
|
private Lock lock;
|
||||||
|
|
||||||
|
@ -235,6 +236,11 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
|
||||||
return (BookmarkTypeDB) typesArray.get(typeID);
|
return (BookmarkTypeDB) typesArray.get(typeID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDefinedType(String type) {
|
||||||
|
return definedTypes.contains(type);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BookmarkType defineType(String type, Icon icon, Color color, int priority) {
|
public BookmarkType defineType(String type, Icon icon, Color color, int priority) {
|
||||||
lock.acquire();
|
lock.acquire();
|
||||||
|
@ -251,6 +257,7 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
|
||||||
bmt.setIcon(icon);
|
bmt.setIcon(icon);
|
||||||
bmt.setMarkerColor(color);
|
bmt.setMarkerColor(color);
|
||||||
bmt.setMarkerPriority(priority);
|
bmt.setMarkerPriority(priority);
|
||||||
|
definedTypes.add(type);
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
dbError(e);
|
dbError(e);
|
||||||
|
|
|
@ -66,6 +66,15 @@ public interface BookmarkManager {
|
||||||
*/
|
*/
|
||||||
BookmarkType defineType(String type, Icon icon, Color color, int priority);
|
BookmarkType defineType(String type, Icon icon, Color color, int priority);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the given bookmark type has been defined via a call to
|
||||||
|
* {@link #defineType(String, Icon, Color, int)}. This allows clients to know whether the
|
||||||
|
* given type should be displayed.
|
||||||
|
* @param type the type to check
|
||||||
|
* @return true if defined
|
||||||
|
*/
|
||||||
|
boolean isDefinedType(String type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of known bookmark types
|
* Returns list of known bookmark types
|
||||||
* @return list of known bookmark types
|
* @return list of known bookmark types
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue