Source:
<code>public void checkStateChanged(CheckStateChangedEvent event) { DisplayItem item = (DisplayItem) event.getElement(); ViewerFilter[] filters = viewer.getFilters(); boolean isEffectivelyAvailable = CustomizePerspectiveDialog.isEffectivelyAvailable(item, filters.length > 0 ? filters[0] : null); if (isEffectivelyAvailable) { originalListener.checkStateChanged(event); return; } boolean isAvailable = CustomizePerspectiveDialog.isAvailable(item); viewer.update(event.getElement(), null); if (isAvailable) { if (viewer.getExpandedState(item)) { MessageBox mb = new MessageBox(viewer.getControl().getShell(), SWT.OK | SWT.ICON_WARNING | SWT.SHEET); mb.setText(WorkbenchMessages.HideItemsCannotMakeVisible_dialogTitle); mb.setMessage(NLS.bind(WorkbenchMessages.HideItemsCannotMakeVisible_unavailableChildrenText, item.getLabel())); mb.open(); } else { <START> MessageBox mb = new MessageBox(viewer.getControl().getShell(), SWT.OK | SWT.ICON_WARNING | SWT.SHEET); <END> mb.setText(WorkbenchMessages.HideItemsCannotMakeVisible_dialogTitle); mb.setMessage(NLS.bind(WorkbenchMessages.HideItemsCannotMakeVisible_unavailableChildrenText, item.getLabel())); mb.open(); } } else { MessageBox mb = new MessageBox(viewer.getControl().getShell(), SWT.YES | SWT.NO | SWT.ICON_WARNING | SWT.SHEET); mb.setText(WorkbenchMessages.HideItemsCannotMakeVisible_dialogTitle); final String errorExplanation = NLS.bind( WorkbenchMessages.HideItemsCannotMakeVisible_unavailableCommandGroupText, item.getLabel(), item.getActionSet()); final String message = NLS .bind("{0}{1}{1}{2}", new Object[] { errorExplanation, CustomizePerspectiveDialog.NEW_LINE, WorkbenchMessages.HideItemsCannotMakeVisible_switchToCommandGroupTab }); mb.setMessage(message); if (mb.open() == SWT.YES) { dialog.showActionSet(item); } } }</code><technical_language>I a hard time spotting difference code in if clause. move common part if (viewer.getExpandedState()) statement</technical_language>

Target:
public void checkStateChanged(CheckStateChangedEvent event) { DisplayItem item = (DisplayItem) event.getElement(); ViewerFilter[] filters = viewer.getFilters(); boolean isEffectivelyAvailable = CustomizePerspectiveDialog.isEffectivelyAvailable(item, filters.length > 0 ? filters[0] : null); if (isEffectivelyAvailable) { originalListener.checkStateChanged(event); return; } boolean isAvailable = CustomizePerspectiveDialog.isAvailable(item); viewer.update(event.getElement(), null); if (isAvailable) { MessageBox mb = new MessageBox(viewer.getControl().getShell(), SWT.OK | SWT.ICON_WARNING | SWT.SHEET); mb.setText(WorkbenchMessages.HideItemsCannotMakeVisible_dialogTitle); mb.setMessage(NLS.bind(WorkbenchMessages.HideItemsCannotMakeVisible_unavailableChildrenText, item.getLabel())); mb.open(); viewer.getExpandedState(item); } else { MessageBox mb = new MessageBox(viewer.getControl().getShell(), SWT.YES | SWT.NO | SWT.ICON_WARNING | SWT.SHEET); mb.setText(WorkbenchMessages.HideItemsCannotMakeVisible_dialogTitle); final String errorExplanation = NLS.bind( WorkbenchMessages.HideItemsCannotMakeVisible_unavailableCommandGroupText, item.getLabel(), item.getActionSet()); final String message = NLS .bind("{0}{1}{1}{2}", new Object[] { errorExplanation, CustomizePerspectiveDialog.NEW_LINE, WorkbenchMessages.HideItemsCannotMakeVisible_switchToCommandGroupTab }); mb.setMessage(message); if (mb.open() == SWT.YES) { dialog.showActionSet(item); } } }