private boolean shouldBeEnabled () {
// check if current project supports this action
Project p = MainProjectManager.getDefault ().getMainProject ();
if (p == null) return false;
ActionProvider actionProvider = (ActionProvider) p.getLookup ().
lookup (ActionProvider.class);
if (actionProvider == null) return false;
String[] sa = actionProvider.getSupportedActions ();
int i, k = sa.length;
for (i = 0; i < k; i++)
if (ActionProvider.COMMAND_DEBUG_STEP_INTO.equals (sa [i]))
break;
if (i == k) return false;
if (DebuggerManager.getDebuggerManager().getDebuggerEngines().length > 0) {
// Do not enable this non-contextual action when some debugging session is already running.
return false;
}
// check if this action should be enabled
return actionProvider.isActionEnabled (
ActionProvider.COMMAND_DEBUG_STEP_INTO,
MainProjectManager.getDefault ().getMainProject ().getLookup ()
);
}