mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-21 19:42:14 +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) {
|
||||
taskTimes.clear();
|
||||
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));
|
||||
}
|
||||
names = null;
|
||||
|
@ -431,7 +431,7 @@ public class DefaultGraphDisplay implements GraphDisplay {
|
||||
.popupMenuGroup("z", "5")
|
||||
.keyBinding("escape")
|
||||
.enabledWhen(c -> hasSelection())
|
||||
.onAction(c -> clearSelection())
|
||||
.onAction(c -> clearSelection(true))
|
||||
.buildAndInstallLocal(componentProvider);
|
||||
|
||||
new ActionBuilder("Create Subgraph", ACTION_OWNER)
|
||||
@ -499,9 +499,9 @@ public class DefaultGraphDisplay implements GraphDisplay {
|
||||
}
|
||||
}
|
||||
|
||||
private void clearSelection() {
|
||||
viewer.getSelectedVertexState().clear();
|
||||
viewer.getSelectedEdgeState().clear();
|
||||
private void clearSelection(boolean fireEvents) {
|
||||
viewer.getSelectedVertexState().clear(fireEvents);
|
||||
viewer.getSelectedEdgeState().clear(fireEvents);
|
||||
}
|
||||
|
||||
private boolean hasSelection() {
|
||||
@ -816,6 +816,8 @@ public class DefaultGraphDisplay implements GraphDisplay {
|
||||
* @param attributedGraph the {@link AttributedGraph} to visualize
|
||||
*/
|
||||
private void doSetGraphData(AttributedGraph attributedGraph) {
|
||||
clearSelection(false);
|
||||
focusedVertex = null;
|
||||
graph = attributedGraph;
|
||||
|
||||
layoutTransitionManager.setEdgeComparator(new EdgeComparator(graph, "EdgeType",
|
||||
|
@ -17,6 +17,15 @@ package ghidra.framework.options;
|
||||
|
||||
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
|
||||
* state from the given saveState object.
|
||||
|
@ -100,14 +100,14 @@ public enum OptionType {
|
||||
static class IntStringAdapter extends StringAdapter {
|
||||
@Override
|
||||
Object stringToObject(String string) {
|
||||
return new Integer(string);
|
||||
return Integer.valueOf(string);
|
||||
}
|
||||
}
|
||||
|
||||
static class LongStringAdapter extends StringAdapter {
|
||||
@Override
|
||||
Object stringToObject(String string) {
|
||||
return new Long(string);
|
||||
return Long.valueOf(string);
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ public enum OptionType {
|
||||
static class DoubleStringAdapter extends StringAdapter {
|
||||
@Override
|
||||
Object stringToObject(String string) {
|
||||
return new Double(string);
|
||||
return Double.valueOf(string);
|
||||
}
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ public enum OptionType {
|
||||
static class FloatStringAdapter extends StringAdapter {
|
||||
@Override
|
||||
Object stringToObject(String string) {
|
||||
return new Float(string);
|
||||
return Float.valueOf(string);
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,10 +216,11 @@ public enum OptionType {
|
||||
@Override
|
||||
Object stringToObject(String 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 {
|
||||
Class<?> c = Class.forName(customOptionClassName);
|
||||
CustomOption option = (CustomOption) c.newInstance();
|
||||
CustomOption option = (CustomOption) c.getConstructor().newInstance();
|
||||
option.readState(saveState);
|
||||
return option;
|
||||
}
|
||||
@ -239,7 +240,8 @@ public enum OptionType {
|
||||
String objectToString(Object object) {
|
||||
CustomOption customOption = (CustomOption) object;
|
||||
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);
|
||||
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> list = new ArrayList<>();
|
||||
configuration.dependencies.each { dep ->
|
||||
|
||||
|
||||
// if the dependency is an external jar
|
||||
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.
|
||||
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 (depPath) {
|
||||
list.add(depPath)
|
||||
|
Loading…
Reference in New Issue
Block a user