protected void assertCanRemoveDynamicWizardPage(IWizardPage page) { if (dynamicWizardDialog == null) return; IWizardPage currentPage = dynamicWizardDialog.getCurrentPage(); if (currentPage == null) return; if (getPageCount() == 0 && getDynamicWizardPageCount() == 0) { throw new IllegalStateException( "Cannot remove wizard page! Nothing to remove!"); //$NON-NLS-1$ } IWizardPage pageToCheck = getFirstPage(); while (pageToCheck != null && pageToCheck != currentPage) { if (pageToCheck == page) throw new IllegalStateException( "Cannot remove page \"" + page.getName() + "\", because it is part of the path BEFORE the current page! Can only remove pages that are following the current page!"); //$NON-NLS-1$ //$NON-NLS-2$ pageToCheck = pageToCheck.getNextPage(); } if (!dynamicWizardPages.contains(page)) throw new IllegalStateException( "Cannot remove page \"" + page.getName() + "\", because it is not registered as dynamic page! If it is static, you cannot remove it and if it is part of a WizardHop, you must remove it there!"); //$NON-NLS-1$ //$NON-NLS-2$ }
/** * Test whether a page can be added at the given index. * * @param index The index to test * @throws IllegalStateException if the value of index is illegal */ protected void assertCanInsertDynamicWizardPage(int index) { int lastReadOnlyIndex = -1; IWizardPage currentPage = dynamicWizardDialog.getCurrentPage(); if (currentPage == null) return; if (getPageCount() == 0 && getDynamicWizardPageCount() == 0) { if (index == 0) return; else throw new IllegalStateException( "Cannot add a wizard page at index " + index + ", it is the first page for this wizard!"); //$NON-NLS-1$ //$NON-NLS-2$ } IWizardPage page = getFirstPage(); while (page != null && page != currentPage) { if (page instanceof IDynamicPathWizardPage) { int i = getDynamicWizardPageIndex(page); if (i > lastReadOnlyIndex) lastReadOnlyIndex = i; } page = page.getNextPage(); } if (index <= lastReadOnlyIndex) throw new IllegalStateException( "Cannot add a wizard page at index " + index + ", because the current page forces all indices <=" + lastReadOnlyIndex + " to be unchangeable!"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ }
/** * This method does (if the wizard is currently shown) the same as if the finish-button has been * pressed. */ public void cancel() { if (dynamicWizardDialog != null) dynamicWizardDialog.cancelPressed(); }
/** * This method does (if the wizard is currently shown) the same as if the finish-button has been * pressed. */ public void finish() { if (dynamicWizardDialog != null) dynamicWizardDialog.finishPressed(); }
public void updateDialog() { if (dynamicWizardDialog != null) dynamicWizardDialog.update(); }