private boolean shouldRestoreAppearance(IHandler handler) { // if no handler or handler doesn't implement IElementUpdater, // restore the contributed elements if (handler == null) return true; if (!(handler instanceof IElementUpdater)) return true; // special case, if its HandlerProxy, then check the actual handler if (handler instanceof HandlerProxy) { HandlerProxy handlerProxy = (HandlerProxy) handler; IHandler actualHandler = handlerProxy.getHandler(); return shouldRestoreAppearance(actualHandler); } return false; }
if (shouldRestoreAppearance(handler)) { label = contributedLabel; tooltip = contributedTooltip;