Example usage for org.eclipse.jface.wizard IWizard setContainer

List of usage examples for org.eclipse.jface.wizard IWizard setContainer

Introduction

In this page you can find the example usage for org.eclipse.jface.wizard IWizard setContainer.

Prototype

void setContainer(IWizardContainer wizardContainer);

Source Link

Document

Sets or clears the container of this wizard.

Usage

From source file:com.codesourcery.internal.installer.ui.WizardDialog.java

License:Open Source License

/**
 * Closes this window./*  w  w  w  .  j  a va 2  s .com*/
 * 
 * @return <code>true</code> if the window is (or was already) closed, and
 *         <code>false</code> if it is still open
 */
private boolean hardClose() {
    // inform wizards
    for (int i = 0; i < createdWizards.size(); i++) {
        IWizard createdWizard = (IWizard) createdWizards.get(i);
        try {
            createdWizard.dispose();
        } catch (Exception e) {
            Status status = new Status(IStatus.ERROR, Policy.JFACE, IStatus.ERROR, e.getMessage(), e);
            Policy.getLog().log(status);
        }
        // Remove this dialog as a parent from the managed wizard.
        // Note that we do this after calling dispose as the wizard or
        // its pages may need access to the container during
        // dispose code
        createdWizard.setContainer(null);
    }
    // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=202534
    // disposing the wizards could cause the image currently set in
    // this dialog to be disposed.  A subsequent repaint event during
    // close would then fail.  To prevent this case, we null out the image.
    setTitleImage(null);
    return super.close();
}

From source file:com.microsoft.tfs.client.common.ui.teambuild.wizards.CreateBuildConfigurationWizard.java

License:Open Source License

@Override
public boolean performFinish() {
    // if we're finishing from the main page then perform finish on the
    // selected wizard.
    if (getContainer().getCurrentPage() == mainPage) {
        if (mainPage.canFinishEarly()) {
            final IWizard wizard = mainPage.getSelectedNode().getWizard();
            wizard.setContainer(getContainer());
            return wizard.performFinish();
        }//from   w w  w .j  a v  a  2  s .com
    }
    return true;
}

From source file:net.geoprism.shapefile.LocalizedWizardDialog.java

License:Open Source License

/**
 * Closes this window.//from  w  w w. j ava  2 s.  c o m
 * 
 * @return <code>true</code> if the window is (or was already) closed, and
 *         <code>false</code> if it is still open
 */
private boolean hardClose() {
    // inform wizards
    for (int i = 0; i < createdWizards.size(); i++) {
        IWizard createdWizard = (IWizard) createdWizards.get(i);
        createdWizard.dispose();
        // Remove this dialog as a parent from the managed wizard.
        // Note that we do this after calling dispose as the wizard or
        // its pages may need access to the container during
        // dispose code
        createdWizard.setContainer(null);
    }
    // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=202534
    // disposing the wizards could cause the image currently set in
    // this dialog to be disposed. A subsequent repaint event during
    // close would then fail. To prevent this case, we null out the image.
    setTitleImage(null);
    return super.close();
}

From source file:net.sf.eclipsensis.config.NSISConfigSelectionWizard.java

License:Open Source License

@Override
public boolean performFinish() {
    if (getContainer().getCurrentPage() == mMainPage) {
        if (mMainPage.canFinishEarly()) {
            IWizard wizard = mMainPage.getSelectedNode().getWizard();
            wizard.setContainer(getContainer());
            return wizard.performFinish();
        }/*from  w ww. j av a 2s  . c  o m*/
    }
    return true;
}

From source file:org.eclipse.launchbar.ui.internal.target.NewLaunchTargetWizard.java

License:Open Source License

/**
 * The user has pressed Finish. Instruct self's pages to finish, and answer
 * a boolean indicating success.//from  ww  w  .  j  av a  2s  . c  o m
 *
 * @return boolean
 */
@Override
public boolean performFinish() {
    //save our selection state
    mainPage.saveWidgetValues();
    // if we're finishing from the main page then perform finish on the selected wizard.
    if (getContainer().getCurrentPage() == mainPage) {
        if (mainPage.canFinishEarly()) {
            IWizard wizard = mainPage.getSelectedNode().getWizard();
            wizard.setContainer(getContainer());
            return wizard.performFinish();
        }
    }
    return true;
}

From source file:org.eclipse.php.internal.ui.actions.newprojectwizard.NewWizard.java

License:Open Source License

/**
 * The user has pressed Finish. Instruct self's pages to finish, and answer
 * a boolean indicating success.//ww  w.j  a v  a2  s .  com
 * 
 * @return boolean
 */
public boolean performFinish() {
    // save our selection state
    mainPage.saveWidgetValues();
    // if we're finishing from the main page then perform finish on the
    // selected wizard.
    if (getContainer().getCurrentPage() == mainPage) {
        if (mainPage.canFinishEarly()) {
            IWizard wizard = mainPage.getSelectedNode().getWizard();
            wizard.setContainer(getContainer());
            return wizard.performFinish();
        }
    }
    return true;
}

From source file:org.eclipse.tcf.te.ui.wizards.newWizard.NewWizard.java

License:Open Source License

@Override
public boolean performFinish() {
    if (mainPage != null) {
        // Trigger the saving of the widget values of
        // the main wizard selection page
        mainPage.saveWidgetValues();/*from   w  w w.j  a v a2  s .  c  om*/

        // If the finish is invoked directly from the main page,
        // call performFinish() for the selected wizard too.
        if (mainPage.equals(getContainer().getCurrentPage())) {
            if (mainPage.canFinishEarly() && mainPage.getSelectedNode() != null) {
                // Get the selected wizard
                IWizard wizard = mainPage.getSelectedNode().getWizard();
                if (wizard != null) {
                    wizard.setContainer(getContainer());
                    wizard.performFinish();
                }
            }
        }
    }
    return true;
}

From source file:org.eclipse.ui.internal.dialogs.NewWizard.java

License:Open Source License

/**
 * The user has pressed Finish. Instruct self's pages to finish, and answer
 * a boolean indicating success.//from ww w.  ja  v a 2 s  .co m
 * 
 * @return boolean
 */
public boolean performFinish() {
    //save our selection state
    mainPage.saveWidgetValues();
    // if we're finishing from the main page then perform finish on the selected wizard.
    if (getContainer().getCurrentPage() == mainPage) {
        if (mainPage.canFinishEarly()) {
            IWizard wizard = mainPage.getSelectedNode().getWizard();
            wizard.setContainer(getContainer());
            return wizard.performFinish();
        }
    }
    return true;
}

From source file:org.kalypso.contribs.eclipse.jface.wizard.view.WizardView.java

License:Open Source License

/** Sets an new wizard and immediately displays its first page */
private void setWizard(final IWizard wizard, final int reason) {
    // clean wizard
    if (m_wizard != null) {
        // IMPORTANT: set the image to null, because it probably gets disposed
        // by m_wizard.dispose();
        setWizardTitleImage(null);/*from   w  ww  .  jav  a 2  s .  c om*/

        m_wizard.setContainer(null);
        m_wizard.dispose();
        m_wizard = null;
    }

    // clean components
    if (m_pageAndButtonArea != null && !m_pageAndButtonArea.isDisposed()) {
        final Control[] children = m_pageAndButtonArea.getChildren();
        for (final Control element : children)
            element.dispose();
    }

    // first time set this wizard
    boolean doLayout = false;
    if (wizard != null && wizard != m_wizard) {
        wizard.setContainer(this);
        wizard.addPages();
        doLayout = true;
    }

    m_wizard = wizard;

    if (m_wizard == null) {
        // HACK: only set the message, if at least one message was set. Else we may destroy the background color
        // of the message label
        if (m_normalMsgAreaBackground != null)
            setErrorMessage(Messages.getString("org.kalypso.contribs.eclipse.jface.wizard.view.WizardView0")); //$NON-NLS-1$
    } else {
        createRightPanel(m_pageAndButtonArea);

        int initialBrowserSize = 25;
        if (m_wizard instanceof IWizard2) {
            final int wizardInitialBrowserSize = ((IWizard2) m_wizard).getInitialBrowserSize();
            // force into [5, 95]
            initialBrowserSize = Math.min(95, Math.max(5, wizardInitialBrowserSize));

            m_useDefaultButton = ((IWizard2) m_wizard).useDefaultButton();
            if (!m_useDefaultButton)
                getShell().setDefaultButton(null);
        } else
            m_useDefaultButton = true;

        m_mainSash.setWeights(new int[] { initialBrowserSize, 100 - initialBrowserSize });
    }

    fireWizardChanged(wizard, reason);

    if (m_wizard != null)
        showStartingPage();

    if (m_workArea != null && !m_workArea.isDisposed() && doLayout) {
        // WORKAROUND: no layout() or redraw() on any of the involved composites
        // causes a real repaint -> panel stays empty after wizard is newly set.
        // So we minimize maximize the sashform (backdraw, it flickers!)
        final Control maximizedControl = m_mainSash.getMaximizedControl();
        m_mainSash.setMaximizedControl(null);
        m_mainSash.setMaximizedControl(maximizedControl);
    }
}

From source file:org.modelio.api.ui.ModelioWizardDialog.java

License:Apache License

/**
 * Closes this window./*from w  ww .j av a2s  . com*/
 * @return <code>true</code> if the window is (or was already) closed, and
 * <code>false</code> if it is still open
 */
@objid("d65afcd5-910f-11e0-9de7-002564c97630")
private boolean hardClose() {
    // inform wizards
    for (int i = 0; i < this.createdWizards.size(); i++) {
        IWizard createdWizard = this.createdWizards.get(i);
        createdWizard.dispose();
        // Remove this dialog as a parent from the managed wizard.
        // Note that we do this after calling dispose as the wizard or
        // its pages may need access to the container during
        // dispose code
        createdWizard.setContainer(null);
    }
    // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=202534
    // disposing the wizards could cause the image currently set in
    // this dialog to be disposed.  A subsequent repaint event during
    // close would then fail.  To prevent this case, we null out the image.
    setTitleLeftImage(null);
    return super.close();
}