File file = getLayoutFile();
if (file != null && file.canRead()) {
Assert.isTrue(SwingUtilities.isEventDispatchThread());
Assert.isTrue(rootComponent.isVisible());
FileInputStream inputStream = new FileInputStream(file);
// load layout, but add the requested content before (via callback)!
toolWindowManager.getPersistenceDelegate().merge(
inputStream, MergePolicy.UNION,
new PersistenceDelegateCallback() {
// @Override
// public ToolWindow toolwindowNotFound(ToolWindowManager toolWindowManager, String toolWindowId, PersistenceNode node) {
// //logger.info("'toolwindow not found' Not supported yet.");
// return null;
// }
//
// @Override
// public Content contentNotFound(ToolWindowManager toolWindowManager, String contentId, PersistenceNode node) {
// addView(contentId);
// return contentAndPageComponentById.get(contentId).getKey();
// }
//
// @Override
// public String validate(PersistenceNode node, String attribute, String attributeValue, Object attributeDefaultValue) {
// return attributeValue;
// }
@Override
public Content contentNotFound(ToolWindowManager toolWindowManager, String contentId) {
addView(contentId);
return contentAndPageComponentById.get(contentId).getKey();
}
});
inputStream.close();
logger.info("Loaded " + contentManager.getContentCount() + " view(s).");
return true;
}
return false;
}