List of usage examples for org.eclipse.jface.wizard IWizardPage getControl
Control getControl();
From source file:com.codesourcery.internal.installer.ui.WizardDialog.java
License:Open Source License
/** * Calculates the difference in size between the given page and the page * container. A larger page results in a positive delta. * // w w w .j a v a2 s . c o m * @param page * the page * @return the size difference encoded as a * <code>new Point(deltaWidth,deltaHeight)</code> */ private Point calculatePageSizeDelta(IWizardPage page) { Control pageControl = page.getControl(); if (pageControl == null) { // control not created yet return new Point(0, 0); } Point contentSize = pageControl.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); Rectangle rect = pageContainerLayout.getClientArea(pageContainer); Point containerSize = new Point(rect.width, rect.height); return new Point(Math.max(0, contentSize.x - containerSize.x), Math.max(0, contentSize.y - containerSize.y)); }
From source file:com.codesourcery.internal.installer.ui.WizardDialog.java
License:Open Source License
/** * Allow the wizard's pages to pre-create their page controls. This allows * the wizard dialog to open to the correct size. *//*from www . ja v a 2 s . co m*/ private void createPageControls() { // Allow the wizard pages to precreate their page controls // This allows the wizard to open to the correct size wizard.createPageControls(pageContainer); // Ensure that all of the created pages are initially not visible IWizardPage[] pages = wizard.getPages(); for (int i = 0; i < pages.length; i++) { IWizardPage page = pages[i]; if (page.getControl() != null) { page.getControl().setVisible(false); } } // Mentor Graphics: Set page progress control if (wizard.needsProgressMonitor()) { progressMonitorPart = getPageProgressMonitor(); } }
From source file:com.codesourcery.internal.installer.ui.WizardDialog.java
License:Open Source License
/** * Update the receiver for the new page. * //w w w . ja v a 2s . c o m * @param page */ private void updateForPage(IWizardPage page) { // ensure this page belongs to the current wizard if (wizard != page.getWizard()) { setWizard(page.getWizard()); } // ensure that page control has been created // (this allows lazy page control creation) if (page.getControl() == null) { page.createControl(pageContainer); // the page is responsible for ensuring the created control is // accessible via getControl. Assert.isNotNull(page.getControl(), JFaceResources.format(JFaceResources.getString("WizardDialog.missingSetControl"), //$NON-NLS-1$ new Object[] { page.getName() })); // ensure the dialog is large enough for this page updateSize(page); } // make the new page visible IWizardPage oldPage = currentPage; currentPage = page; currentPage.setVisible(true); if (oldPage != null) { oldPage.setVisible(false); } // update the dialog controls update(); }
From source file:com.codesourcery.internal.installer.ui.WizardDialog.java
License:Open Source License
/** * Computes the correct dialog size for the current page and resizes its shell if necessary. * Also causes the container to refresh its layout. * /* ww w.j a va 2 s . co m*/ * @param page the wizard page to use to resize the dialog * @since 2.0 */ protected void updateSize(IWizardPage page) { if (page == null || page.getControl() == null) { return; } updateSizeForPage(page); pageContainerLayout.layoutPage(page.getControl()); }
From source file:com.microsoft.tfs.client.common.ui.framework.wizard.ExtendedWizard.java
License:Open Source License
/** * We override getPreviousPage in order to handle ExtendedWizard behavior * which adds all the pages up front. If they haven't been drawn, then we * return null.//from w w w. j a v a 2 s .c o m */ @Override public IWizardPage getPreviousPage(final IWizardPage page) { final IWizardPage previousPage = super.getPreviousPage(page); if (previousPage == null || previousPage.getControl() == null) { return null; } return previousPage; }
From source file:com.microsoft.tfs.client.common.ui.framework.wizard.ExtendedWizardPage.java
License:Open Source License
/** * <p>/*w ww .j av a 2s . c o m*/ * {@link ExtendedWizardPage} overrides this {@link IWizardPage} method. It * uses <code>setVisible()</code> as a hook point to perform some additional * tasks when the page is shown or hidden. When the page is shown, * {@link #refresh()} is called to give the {@link ExtendedWizardPage} * subclass a chance to refresh page state. When the page is hidden, * {@link #onMovingToPreviousPage()} is called if navigating to the previous * page, and {@link #saveState(IDialogSettings)} is called to give the * subclass a chance to persist state. * </p> * * <p> * {@link ExtendedWizardPage} subclasses typically will not override this * method. * </p> */ @Override public void setVisible(final boolean visible) { /* * The DialogPage setVisible implementation just calls setVisible on the * control (getControl()) with the argument. */ super.setVisible(visible); if (visible) { final IWizardPage previousPage = getPreviousPage(); if (previousPage != null && previousPage.getControl() != null) { previousPage.setVisible(false); } refresh(); } else { final IWizardPage curPage = getContainer().getCurrentPage(); final IWizardPage prevPage = getPreviousPage(); if (curPage == prevPage) { onMovingToPreviousPage(); } saveState(getDialogSettings()); } }
From source file:net.geoprism.shapefile.LocalizedWizardDialog.java
License:Open Source License
/** * Allow the wizard's pages to pre-create their page controls. This allows the * wizard dialog to open to the correct size. *//*from w w w. ja va 2 s . co m*/ private void createPageControls() { // Allow the wizard pages to precreate their page controls // This allows the wizard to open to the correct size wizard.createPageControls(pageContainer); // Ensure that all of the created pages are initially not visible IWizardPage[] pages = wizard.getPages(); for (int i = 0; i < pages.length; i++) { IWizardPage page = pages[i]; if (page.getControl() != null) { page.getControl().setVisible(false); } } }
From source file:org.bonitasoft.studio.common.jface.ExtensibleWizard.java
License:Open Source License
public void removeAdditionalPage(IWizardPage page, boolean disposePage) { if (additionalPages.contains(page)) { if (disposePage && page.getControl() != null && !page.getControl().isDisposed()) { page.getControl().dispose(); }/*from www . j ava 2 s. c om*/ additionalPages.remove(page); } }
From source file:org.bonitasoft.studio.configuration.ui.wizard.ConfigurationWizardDialog.java
License:Open Source License
@Override public void showPage(IWizardPage page) { super.showPage(page); page.setPreviousPage(null);/*www . ja v a 2 s . c o m*/ setControlEnabled(page.getControl(), ((ConfigurationWizard) getWizard()).getProcess() != null); ConfigurationWizard confWizard = (ConfigurationWizard) getWizard(); confWizard.updatePages(); page.setVisible(true); pageChooserViewer.setSelection(new StructuredSelection(getCurrentPage())); group.setText(page.getTitle()); String processName = getProcess().getName() + " (" + getProcess().getVersion() + ")"; setTitle(Messages.bind(Messages.configurationWizardTitle, processName)); if (((IProcessConfigurationWizardPage) page).isConfigurationPageValid(getConfiguration()) == null) { setMessage(Messages.bind(Messages.configurationWizardDesc, processName)); } }
From source file:org.bonitasoft.studio.connector.model.definition.dialog.ConnectorDefinitionWizardDialog.java
License:Open Source License
@Override public void cancelPressed() { if (getCurrentPage() instanceof PageWidgetsWizardPage) { ExtensibleWizard wizard = (ExtensibleWizard) getWizard(); IWizardPage page = getCurrentPage(); wizard.removeAdditionalPage(page, false); backPressed();/*from w w w .j av a2 s.c om*/ if (page.getControl() != null) { page.getControl().dispose(); } } else { super.cancelPressed(); } }