protected void okPressed() { // CODINGSPECTATOR: This method gets invoked when the user presses OK. So, record the time of // the occurrence of this event. fWizard.addNavigationHistoryItem( new NavigationHistoryItem(fCurrentPage.getName(), IDialogConstants.OK_LABEL)); IWizardPage current = fCurrentPage; saveInitialSize(); if (fWizard.performFinish()) { saveSize(); super.okPressed(); return; } if (fCurrentPage == current) return; Assert.isTrue(IErrorWizardPage.PAGE_NAME.equals(fCurrentPage.getName())); if (fHasAdditionalPages) { // Show error page as a normal page showCurrentPage(); } else if (showErrorDialog((ErrorWizardPage) fCurrentPage)) { // Show error page as a dialog if (fWizard.performFinish()) { super.okPressed(); return; } } }
protected void cancelPressed() { // CODINGSPECTATOR: Record the time of pressing the cancel button on the current page. fWizard.addNavigationHistoryItem( new NavigationHistoryItem(fCurrentPage.getName(), IDialogConstants.CANCEL_LABEL)); if (fActiveRunningOperations == 0) { if (fWizard.performCancel()) super.cancelPressed(); } }
protected void handleShellCloseEvent() { // CODINGSPECTATOR: Record the time of quitting the refactoring by clicking on the close button // or pressing ESC. fWizard.addNavigationHistoryItem( new NavigationHistoryItem(fCurrentPage.getName(), NavigationHistoryItem.QUIT_DIALOG_EVENT)); if (fActiveRunningOperations == 0) { if (fWizard.performCancel()) super.handleShellCloseEvent(); } }
private void backPressed() { IWizardPage current = fCurrentPage; fCurrentPage = fCurrentPage.getPreviousPage(); if (current == fCurrentPage) return; // CODINGSPECTATOR: Record the time of pressing the back button on the current page. fWizard.addNavigationHistoryItem( new NavigationHistoryItem(fCurrentPage.getName(), IDialogConstants.BACK_LABEL)); showCurrentPage(); }
// CODINGSPECTATOR: Update the navigation history whenever the user presses a button on the error // dialog. private boolean showErrorDialog(ErrorWizardPage page) { RefactoringStatusDialog dialog = new RefactoringStatusDialog( getShell(), page, fWizard.internalShowBackButtonOnStatusDialog(InternalAPI.INSTANCE)); switch (dialog.open()) { case IDialogConstants.OK_ID: // See RefactoringStatusDialog#createButtonsForButtonBar() for the labels of the buttons fWizard.addNavigationHistoryItem( new NavigationHistoryItem( page.getName(), RefactoringUIMessages.RefactoringStatusDialog_Continue)); return true; case IDialogConstants.BACK_ID: fWizard.addNavigationHistoryItem( new NavigationHistoryItem(page.getName(), IDialogConstants.BACK_LABEL)); fCurrentPage = fCurrentPage.getPreviousPage(); break; case IDialogConstants.CANCEL_ID: cancelPressed(); } return false; }
// CODINGSPECTATOR: Added button as a parameter to the method so that it can tell which one was // pressed "next" or "preview". private void nextOrPreviewPressed(Button button) { // CODINGSPECTATOR: Record the event of pressing the button on the current page. fWizard.addNavigationHistoryItem( new NavigationHistoryItem(fCurrentPage.getName(), button.getText())); IWizardPage current = fCurrentPage; saveInitialSize(); fCurrentPage = fCurrentPage.getNextPage(); if (current == fCurrentPage) return; if (!fHasAdditionalPages && IErrorWizardPage.PAGE_NAME.equals(fCurrentPage.getName())) { if (showErrorDialog((ErrorWizardPage) fCurrentPage)) { fCurrentPage = fCurrentPage.getNextPage(); } else { return; } } fCurrentPage.setPreviousPage(current); showCurrentPage(); }