1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 07:05:24 +02:00

[186848] check for hasChildren() before adding the go into action

This commit is contained in:
David McKnight 2007-05-14 20:08:49 +00:00
parent 332a08db68
commit 32d8bf8bd0

View file

@ -854,8 +854,22 @@ public class SystemView extends SafeTreeViewer
// OPEN IN NEW WINDOW ACTION...
if (fromSystemViewPart) {
GoIntoAction goIntoAction = getGoIntoAction();
goIntoAction.setEnabled(selection.size() == 1);
menu.appendToGroup(ISystemContextMenuConstants.GROUP_GOTO, goIntoAction);
boolean singleSelection = selection.size() == 1;
goIntoAction.setEnabled(singleSelection);
if (singleSelection)
{
// dkm - first find out if the selection will have children
// only add this action if there are children
Object selectedObject = selection.getFirstElement();
ISystemViewElementAdapter adapter = getViewAdapter(selectedObject);
if (adapter != null)
{
if (adapter.hasChildren((IAdaptable)selectedObject))
{
menu.appendToGroup(ISystemContextMenuConstants.GROUP_GOTO, goIntoAction);
}
}
}
if (showOpenViewActions()) {
SystemOpenExplorerPerspectiveAction openToPerspectiveAction = getOpenToPerspectiveAction();