detailPane.setVisible(context.isHistoryItemVisible() || context.isMethodFormVisible());
detailPane.clear();
if (context.isHistoryItemVisible()) {
HistoryItem item = Iterables.getOnlyElement(context.getHistoryItems());
EmbeddedHistoryItemView view = generateHistoryItemView(item);
detailPane.add(view);
} else if (context.isMethodFormVisible()) {
ApiMethod method = context.getMethod();
// Wrap the callback given by the context so that we may also be notified when a request is
// finished. Pass through events to the original callback.
CallbackWrapper cbWrapper = new CallbackWrapper();
cbWrapper.delegate = context.getRequestFinishedCallback();
cbWrapper.methodName = method.getId();
// Create the view of the request editor and the single history item.
EmbeddedView view = new EmbeddedView(authManager,
context.getService(),
method,
context.getMethodParameters(),
cbWrapper,
HIDE_AUTH,
analytics);
cbWrapper.localView = view;
// If this context came bundled with a history item, that means the navigation references a
// previous executed request, and we should show the result.
List<HistoryItem> historyItems = context.getHistoryItems();
if (!historyItems.isEmpty()) {
view.showHistoryItem(generateHistoryItemView(Iterables.getLast(historyItems)));
}
detailPane.add(view);
}