Clean up context menu building.

Even if the inspect action is unavailable, continue building the rest
of the actions, since they can apply regardless of the value location.
This commit is contained in:
Rene Gollent 2013-05-04 20:28:46 -04:00
parent 309f473c0f
commit 9187efd1a9

View File

@ -1953,19 +1953,19 @@ VariablesView::_GetContextActionsForNode(ModelNode* node,
ContextActionList* actions)
{
ValueLocation* location = node->NodeChild()->Location();
// if the location's stored somewhere other than in memory,
// then we won't be able to inspect it this way.
if (location->PieceAt(0).type != VALUE_PIECE_LOCATION_MEMORY)
return B_OK;
status_t result = B_OK;
BMessage* message = NULL;
status_t result = _AddContextAction("Inspect", MSG_SHOW_INSPECTOR_WINDOW,
actions, message);
if (result != B_OK)
return result;
message->AddUInt64("address", location->PieceAt(0).address);
// only show the Inspect option if the value is in fact located
// in memory.
if (location->PieceAt(0).type == VALUE_PIECE_LOCATION_MEMORY) {
result = _AddContextAction("Inspect", MSG_SHOW_INSPECTOR_WINDOW,
actions, message);
if (result != B_OK)
return result;
message->AddUInt64("address", location->PieceAt(0).address);
}
result = _AddContextAction("Cast as" B_UTF8_ELLIPSIS,
MSG_SHOW_TYPECAST_NODE_PROMPT, actions, message);