mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-22 04:05:39 +00:00
Merge remote-tracking branch 'origin/patch'
Conflicts: Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java
This commit is contained in:
commit
ddbfbfe198
@ -39,6 +39,9 @@ public class StoredAnalyzerTimes implements CustomOption {
|
|||||||
public void readState(SaveState saveState) {
|
public void readState(SaveState saveState) {
|
||||||
taskTimes.clear();
|
taskTimes.clear();
|
||||||
for (String taskName : saveState.getNames()) {
|
for (String taskName : saveState.getNames()) {
|
||||||
|
if (CustomOption.CUSTOM_OPTION_CLASS_NAME_KEY.equals(taskName)) {
|
||||||
|
continue; // skip this reserved key
|
||||||
|
}
|
||||||
taskTimes.put(taskName, saveState.getLong(taskName, 0));
|
taskTimes.put(taskName, saveState.getLong(taskName, 0));
|
||||||
}
|
}
|
||||||
names = null;
|
names = null;
|
||||||
|
@ -431,7 +431,7 @@ public class DefaultGraphDisplay implements GraphDisplay {
|
|||||||
.popupMenuGroup("z", "5")
|
.popupMenuGroup("z", "5")
|
||||||
.keyBinding("escape")
|
.keyBinding("escape")
|
||||||
.enabledWhen(c -> hasSelection())
|
.enabledWhen(c -> hasSelection())
|
||||||
.onAction(c -> clearSelection())
|
.onAction(c -> clearSelection(true))
|
||||||
.buildAndInstallLocal(componentProvider);
|
.buildAndInstallLocal(componentProvider);
|
||||||
|
|
||||||
new ActionBuilder("Create Subgraph", ACTION_OWNER)
|
new ActionBuilder("Create Subgraph", ACTION_OWNER)
|
||||||
@ -499,9 +499,9 @@ public class DefaultGraphDisplay implements GraphDisplay {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearSelection() {
|
private void clearSelection(boolean fireEvents) {
|
||||||
viewer.getSelectedVertexState().clear();
|
viewer.getSelectedVertexState().clear(fireEvents);
|
||||||
viewer.getSelectedEdgeState().clear();
|
viewer.getSelectedEdgeState().clear(fireEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasSelection() {
|
private boolean hasSelection() {
|
||||||
@ -816,6 +816,8 @@ public class DefaultGraphDisplay implements GraphDisplay {
|
|||||||
* @param attributedGraph the {@link AttributedGraph} to visualize
|
* @param attributedGraph the {@link AttributedGraph} to visualize
|
||||||
*/
|
*/
|
||||||
private void doSetGraphData(AttributedGraph attributedGraph) {
|
private void doSetGraphData(AttributedGraph attributedGraph) {
|
||||||
|
clearSelection(false);
|
||||||
|
focusedVertex = null;
|
||||||
graph = attributedGraph;
|
graph = attributedGraph;
|
||||||
|
|
||||||
layoutTransitionManager.setEdgeComparator(new EdgeComparator(graph, "EdgeType",
|
layoutTransitionManager.setEdgeComparator(new EdgeComparator(graph, "EdgeType",
|
||||||
|
@ -17,6 +17,15 @@ package ghidra.framework.options;
|
|||||||
|
|
||||||
public interface CustomOption {
|
public interface CustomOption {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <code>SaveState</code> key which corresponds to custom option
|
||||||
|
* implementation class. The use of this key/value within the stored
|
||||||
|
* state information is reserved for use by the option storage
|
||||||
|
* implementation and should be ignored by {@link #readState(SaveState)}
|
||||||
|
* implementation
|
||||||
|
*/
|
||||||
|
public final String CUSTOM_OPTION_CLASS_NAME_KEY = "CUSTOM_OPTION_CLASS";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Concrete subclass of WrappedOption should read all of its
|
* Concrete subclass of WrappedOption should read all of its
|
||||||
* state from the given saveState object.
|
* state from the given saveState object.
|
||||||
|
@ -100,14 +100,14 @@ public enum OptionType {
|
|||||||
static class IntStringAdapter extends StringAdapter {
|
static class IntStringAdapter extends StringAdapter {
|
||||||
@Override
|
@Override
|
||||||
Object stringToObject(String string) {
|
Object stringToObject(String string) {
|
||||||
return new Integer(string);
|
return Integer.valueOf(string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class LongStringAdapter extends StringAdapter {
|
static class LongStringAdapter extends StringAdapter {
|
||||||
@Override
|
@Override
|
||||||
Object stringToObject(String string) {
|
Object stringToObject(String string) {
|
||||||
return new Long(string);
|
return Long.valueOf(string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ public enum OptionType {
|
|||||||
static class DoubleStringAdapter extends StringAdapter {
|
static class DoubleStringAdapter extends StringAdapter {
|
||||||
@Override
|
@Override
|
||||||
Object stringToObject(String string) {
|
Object stringToObject(String string) {
|
||||||
return new Double(string);
|
return Double.valueOf(string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ public enum OptionType {
|
|||||||
static class FloatStringAdapter extends StringAdapter {
|
static class FloatStringAdapter extends StringAdapter {
|
||||||
@Override
|
@Override
|
||||||
Object stringToObject(String string) {
|
Object stringToObject(String string) {
|
||||||
return new Float(string);
|
return Float.valueOf(string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,10 +216,11 @@ public enum OptionType {
|
|||||||
@Override
|
@Override
|
||||||
Object stringToObject(String string) {
|
Object stringToObject(String string) {
|
||||||
SaveState saveState = getSaveStateFromXmlString(string);
|
SaveState saveState = getSaveStateFromXmlString(string);
|
||||||
String customOptionClassName = saveState.getString("CUSTOM_OPTION_CLASS", null);
|
String customOptionClassName =
|
||||||
|
saveState.getString(CustomOption.CUSTOM_OPTION_CLASS_NAME_KEY, null);
|
||||||
try {
|
try {
|
||||||
Class<?> c = Class.forName(customOptionClassName);
|
Class<?> c = Class.forName(customOptionClassName);
|
||||||
CustomOption option = (CustomOption) c.newInstance();
|
CustomOption option = (CustomOption) c.getConstructor().newInstance();
|
||||||
option.readState(saveState);
|
option.readState(saveState);
|
||||||
return option;
|
return option;
|
||||||
}
|
}
|
||||||
@ -239,7 +240,8 @@ public enum OptionType {
|
|||||||
String objectToString(Object object) {
|
String objectToString(Object object) {
|
||||||
CustomOption customOption = (CustomOption) object;
|
CustomOption customOption = (CustomOption) object;
|
||||||
SaveState saveState = new SaveState();
|
SaveState saveState = new SaveState();
|
||||||
saveState.putString("CUSTOM_OPTION_CLASS", object.getClass().getName());
|
saveState.putString(CustomOption.CUSTOM_OPTION_CLASS_NAME_KEY,
|
||||||
|
object.getClass().getName());
|
||||||
customOption.writeState(saveState);
|
customOption.writeState(saveState);
|
||||||
return saveToXmlString(saveState);
|
return saveToXmlString(saveState);
|
||||||
}
|
}
|
||||||
|
24
build.gradle
24
build.gradle
@ -304,15 +304,33 @@ List<String> getExternalRuntimeDependencies(Project project) {
|
|||||||
List<String> getExternalDependencies(Configuration configuration) {
|
List<String> getExternalDependencies(Configuration configuration) {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
configuration.dependencies.each { dep ->
|
configuration.dependencies.each { dep ->
|
||||||
|
|
||||||
// if the dependency is an external jar
|
// if the dependency is an external jar
|
||||||
if (dep instanceof ExternalDependency) {
|
if (dep instanceof ExternalDependency) {
|
||||||
|
String name = dep.getName()
|
||||||
|
Set<String> classifiers = dep.artifacts.classifier
|
||||||
|
String group = dep.getGroup()
|
||||||
|
String version = dep.getVersion()
|
||||||
|
String searchString = name
|
||||||
|
|
||||||
|
if (version != null) {
|
||||||
|
searchString = name+"-"+version;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!classifiers.empty) {
|
||||||
|
String cls = classifiers.first()
|
||||||
|
if (cls != null) {
|
||||||
|
searchString+= "-$cls"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// loop back through all the dependency files, looking for one that contains the dependency name.
|
// loop back through all the dependency files, looking for one that contains the dependency name.
|
||||||
String depPath = configuration.find {
|
String depPath = configuration.find {
|
||||||
it.name.contains(dep.name)
|
it.name.contains(searchString)
|
||||||
|
}
|
||||||
|
if (depPath == null) {
|
||||||
|
println("****************DID NOT FIND DEPENDENCY: name = "+name+" version = "+version)
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we found the path, then add it to the list
|
// if we found the path, then add it to the list
|
||||||
if (depPath) {
|
if (depPath) {
|
||||||
list.add(depPath)
|
list.add(depPath)
|
||||||
|
Loading…
Reference in New Issue
Block a user