GT-308 preserved graph satellite state between graph instantiations.

(also changed the timing for when preferences are loaded into the tool
so that they happen before plugins get initialized)
This commit is contained in:
ghidravore 2020-10-29 15:13:43 -04:00
parent 8dffa0384e
commit 490bc9ffa9
7 changed files with 46 additions and 21 deletions

View file

@ -405,7 +405,7 @@ public abstract class PluginTool extends AbstractDockingTool {
"You cannot persist generic tools: " + getClass().getName());
}
public void restoreWindowingDataFromXml(Element windowData) {
public void restoreWindowingDataFromXml(Element element) {
throw new UnsupportedOperationException(
"You cannot persist generic tools: " + getClass().getName());
}
@ -555,6 +555,7 @@ public abstract class PluginTool extends AbstractDockingTool {
SplashScreen.updateSplashScreenStatus("Loading " + fullName + " ...");
restoreOptionsFromXml(root);
winMgr.restorePreferencesFromXML(root);
setDefaultOptionValues();
boolean hasErrors = false;
try {
@ -565,7 +566,7 @@ public abstract class PluginTool extends AbstractDockingTool {
Msg.showError(this, getToolFrame(), "Error Restoring Plugins", e.getMessage());
}
winMgr.restoreFromXML(root);
winMgr.restoreWindowDataFromXml(root);
winMgr.setToolName(fullName);
return hasErrors;
}

View file

@ -125,8 +125,8 @@ public class GhidraTool extends PluginTool {
}
@Override
public void restoreWindowingDataFromXml(Element windowData) {
winMgr.restoreWindowDataFromXml(windowData);
public void restoreWindowingDataFromXml(Element rootElement) {
winMgr.restoreWindowDataFromXml(rootElement);
}
@Override

View file

@ -166,8 +166,8 @@ class WorkspaceImpl implements Workspace {
Iterator<?> iter = root.getChildren("RUNNING_TOOL").iterator();
while (iter.hasNext()) {
Element elememnt = (Element) iter.next();
String toolName = elememnt.getAttributeValue(ToolTemplate.TOOL_NAME_XML_NAME);
Element element = (Element) iter.next();
String toolName = element.getAttributeValue(ToolTemplate.TOOL_NAME_XML_NAME);
if (toolName == null) {
continue;
}
@ -182,12 +182,9 @@ class WorkspaceImpl implements Workspace {
}
boolean hadChanges = tool.hasConfigChanged();
Element windowData = elememnt.getChild("ROOT_NODE");
if (windowData != null) { // backward compatibility
tool.restoreWindowingDataFromXml(windowData);
}
tool.restoreWindowingDataFromXml(element);
Element toolDataElem = elememnt.getChild("DATA_STATE");
Element toolDataElem = element.getChild("DATA_STATE");
tool.restoreDataStateFromXml(toolDataElem);
if (hadChanges) {
// restore the dirty state, which is cleared by the restoreDataState call