diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/StoredAnalyzerTimes.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/StoredAnalyzerTimes.java index b32cff7388..8072ec72d5 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/StoredAnalyzerTimes.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/StoredAnalyzerTimes.java @@ -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; diff --git a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java index f08eaea9d7..856126f516 100644 --- a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java +++ b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java @@ -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", diff --git a/Ghidra/Framework/Generic/src/main/java/ghidra/framework/options/CustomOption.java b/Ghidra/Framework/Generic/src/main/java/ghidra/framework/options/CustomOption.java index 531691d803..d5fe87f61e 100644 --- a/Ghidra/Framework/Generic/src/main/java/ghidra/framework/options/CustomOption.java +++ b/Ghidra/Framework/Generic/src/main/java/ghidra/framework/options/CustomOption.java @@ -17,6 +17,15 @@ package ghidra.framework.options; public interface CustomOption { + /** + * SaveState 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. diff --git a/Ghidra/Framework/Generic/src/main/java/ghidra/framework/options/OptionType.java b/Ghidra/Framework/Generic/src/main/java/ghidra/framework/options/OptionType.java index 9be0fc9bfc..060c11f852 100644 --- a/Ghidra/Framework/Generic/src/main/java/ghidra/framework/options/OptionType.java +++ b/Ghidra/Framework/Generic/src/main/java/ghidra/framework/options/OptionType.java @@ -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); } diff --git a/build.gradle b/build.gradle index b5539e3409..bbe7667495 100644 --- a/build.gradle +++ b/build.gradle @@ -304,15 +304,33 @@ List getExternalRuntimeDependencies(Project project) { List getExternalDependencies(Configuration configuration) { List list = new ArrayList<>(); configuration.dependencies.each { dep -> - + // if the dependency is an external jar if (dep instanceof ExternalDependency) { + String name = dep.getName() + Set 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)