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);
|
||||
}
|
||||
|
||||
private final Set<String> definedTypes = new HashSet<>();
|
||||
protected final Map<String, DBTraceBookmarkType> typesByName = new HashMap<>();
|
||||
protected final Collection<DBTraceBookmarkType> typesView =
|
||||
Collections.unmodifiableCollection(typesByName.values());
|
||||
|
@ -155,6 +156,10 @@ public class DBTraceBookmarkManager extends AbstractDBTraceSpaceBasedManager<DBT
|
|||
return type;
|
||||
}
|
||||
|
||||
public boolean isDefinedType(String type) {
|
||||
return definedTypes.contains(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized DBTraceBookmarkType defineBookmarkType(String typeName, Icon icon,
|
||||
Color color, int priority) {
|
||||
|
@ -169,6 +174,7 @@ public class DBTraceBookmarkManager extends AbstractDBTraceSpaceBasedManager<DBT
|
|||
}
|
||||
type = new DBTraceBookmarkType(this, typeName, icon, color, priority);
|
||||
typesByName.put(typeName, type);
|
||||
definedTypes.add(typeName);
|
||||
}
|
||||
trace.setChanged(new TraceChangeRecord<>(TraceEvents.BOOKMARK_TYPE_ADDED, null, type));
|
||||
return type;
|
||||
|
|
|
@ -54,6 +54,11 @@ public class DBTraceProgramViewBookmarkManager implements TraceProgramViewBookma
|
|||
return bookmarkManager.defineBookmarkType(type, icon, color, priority);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefinedType(String type) {
|
||||
return bookmarkManager.isDefinedType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BookmarkType[] getBookmarkTypes() {
|
||||
Collection<? extends TraceBookmarkType> types = bookmarkManager.getDefinedBookmarkTypes();
|
||||
|
|
|
@ -298,12 +298,22 @@ public class BookmarkPlugin extends ProgramPlugin implements PopupActionProvider
|
|||
if (type == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String typeString = type.getTypeString();
|
||||
BookmarkNavigator nav = bookmarkNavigators.get(typeString);
|
||||
if (nav == null) {
|
||||
nav = new BookmarkNavigator(markerService, currentProgram.getBookmarkManager(), type);
|
||||
bookmarkNavigators.put(typeString, nav);
|
||||
if (nav != null) {
|
||||
return 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -351,12 +351,11 @@ public class WindowUtilities {
|
|||
// '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.
|
||||
int pad = 50;
|
||||
int screenArea = screen.width * screen.height;
|
||||
int boundsArea = bounds.width * bounds.height;
|
||||
if (boundsArea > screenArea) {
|
||||
int newWidth = screen.width - pad;
|
||||
int newHeight = screen.height - pad;
|
||||
bounds.setSize(newWidth, newHeight);
|
||||
if (bounds.width > screen.width) {
|
||||
bounds.width = screen.width - pad;
|
||||
}
|
||||
if (bounds.height > screen.height) {
|
||||
bounds.height = screen.height - pad;
|
||||
}
|
||||
|
||||
// Next, move the window as little as possible to get fully on-screen.
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -52,6 +52,7 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
|
|||
private boolean upgrade = false;
|
||||
|
||||
private Map<String, BookmarkType> typesByName = new TreeMap<>();
|
||||
private Set<String> definedTypes = new HashSet<>();
|
||||
private ObjectArray typesArray = new ObjectArray();
|
||||
private Lock lock;
|
||||
|
||||
|
@ -235,6 +236,11 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
|
|||
return (BookmarkTypeDB) typesArray.get(typeID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefinedType(String type) {
|
||||
return definedTypes.contains(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BookmarkType defineType(String type, Icon icon, Color color, int priority) {
|
||||
lock.acquire();
|
||||
|
@ -251,6 +257,7 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
|
|||
bmt.setIcon(icon);
|
||||
bmt.setMarkerColor(color);
|
||||
bmt.setMarkerPriority(priority);
|
||||
definedTypes.add(type);
|
||||
}
|
||||
catch (IOException e) {
|
||||
dbError(e);
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -66,6 +66,15 @@ public interface BookmarkManager {
|
|||
*/
|
||||
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
|
||||
* @return list of known bookmark types
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue