* @param ih
* @param listen
*/
private void enableListening(IHook ih, boolean listen) {
if (ih instanceof HookModel) { // this test returns false if ih is null
HookModel hm = (HookModel) ih;
if (listen) {
hm.addListener(listenerHook);
}
else {
hm.removeListener(listenerHook);
}
if (ih.getCommandsList() != null) {
for (IHookCommand ihc : ih.getCommandsList()) {
enableListening(ihc, listen);
}