Source:
public Object execute(ExecutionEvent event) { IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event); if (activeWorkbenchWindow != null) { WorkbenchPage page = (WorkbenchPage) activeWorkbenchWindow.getActivePage(); if (page != null) { IPerspectiveDescriptor descriptor = page.getPerspective(); if (descriptor != null) { boolean offerRevertToBase = false; if (descriptor instanceof PerspectiveDescriptor) { PerspectiveDescriptor desc = (PerspectiveDescriptor) descriptor; offerRevertToBase = desc.isPredefined() && desc.hasCustomDefinition(); } if (offerRevertToBase) { String message = NLS.bind(WorkbenchMessages.RevertPerspective_message, descriptor.getLabel()); boolean toggleState = false; MessageDialogWithToggle dialog = MessageDialogWithToggle.open( MessageDialog.QUESTION, activeWorkbenchWindow.getShell(), WorkbenchMessages.RevertPerspective_title, message, WorkbenchMessages.RevertPerspective_option, toggleState, null, null, SWT.SHEET); if (dialog.getReturnCode() == IDialogConstants.YES_ID) { if (dialog.getToggleState()) { PerspectiveRegistry reg = (PerspectiveRegistry) PlatformUI .getWorkbench().getPerspectiveRegistry(); reg.revertPerspective(descriptor); } page.resetPerspective(); } } else { String message = NLS.bind(WorkbenchMessages.ResetPerspective_message, descriptor.getLabel()); final String[] options = { WorkbenchMessages.ResetPerspective_buttonLabel, IDialogConstants.NO_LABEL }; int result = MessageDialog.open(MessageDialog.CONFIRM, activeWorkbenchWindow.getShell(), WorkbenchMessages.ResetPerspective_title, message, SWT.SHEET, options); if (result == RETURNCODE_RESET_PERSPECTIVE) { page.resetPerspective(); } } } } } return null; }

Target:
public Object execute(ExecutionEvent event) { IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event); if (activeWorkbenchWindow != null) { WorkbenchPage page = (WorkbenchPage) activeWorkbenchWindow.getActivePage(); if (page != null) { IPerspectiveDescriptor descriptor = page.getPerspective(); if (descriptor != null) { boolean offerRevertToBase = false; if (descriptor instanceof PerspectiveDescriptor) { PerspectiveDescriptor desc = (PerspectiveDescriptor) descriptor; offerRevertToBase = desc.isPredefined() && desc.hasCustomDefinition(); } if (offerRevertToBase) { String message = NLS.bind(WorkbenchMessages.RevertPerspective_message, descriptor.getLabel()); boolean toggleState = false; MessageDialogWithToggle dialog = MessageDialogWithToggle.open( MessageDialog.QUESTION, activeWorkbenchWindow.getShell(), WorkbenchMessages.RevertPerspective_title, message, WorkbenchMessages.RevertPerspective_option, toggleState, null, null, SWT.SHEET); if (dialog.getReturnCode() == IDialogConstants.YES_ID) { if (dialog.getToggleState()) { PerspectiveRegistry reg = (PerspectiveRegistry) PlatformUI .getWorkbench().getPerspectiveRegistry(); reg.revertPerspective(descriptor); } page.resetPerspective(); } } else { String message = NLS.bind(WorkbenchMessages.ResetPerspective_message, descriptor.getLabel()); final String[] options = { WorkbenchMessages.ResetPerspective_buttonLabel, IDialogConstants.NO_LABEL }; int result = MessageDialog.open(MessageDialog.CONFIRM, activeWorkbenchWindow.getShell(), WorkbenchMessages.ResetPerspective_title, message, SWT.SHEET, options); if (result == Window.OK) { page.resetPerspective(); } } } } } return null; }