Example usage for org.eclipse.jface.wizard IWizardPage getName

List of usage examples for org.eclipse.jface.wizard IWizardPage getName

Introduction

In this page you can find the example usage for org.eclipse.jface.wizard IWizardPage getName.

Prototype

public String getName();

Source Link

Document

Returns this page's name.

Usage

From source file:com.aptana.deploy.engineyard.ui.wizard.EngineYardDeployWizard.java

License:Open Source License

@Override
public boolean performFinish() {
    IWizardPage currentPage = getContainer().getCurrentPage();
    String pageName = currentPage.getName();

    IRunnableWithProgress runnable = null;
    if (EngineYardSignupPage.NAME.equals(pageName)) {
        EngineYardSignupPage page = (EngineYardSignupPage) currentPage;
        runnable = createEngineYardSignupRunnable(page);
    } else if (EngineYardDeployWizardPage.NAME.equals(pageName)) {
        EngineYardDeployWizardPage page = (EngineYardDeployWizardPage) currentPage;
        runnable = createEngineYardDeployRunnable(page);
        DeployPreferenceUtil.setDeployType(getProject(), EngineYardDeployProvider.ID);
    }/*from   w w w  . j a va  2 s  .c om*/

    if (runnable != null) {
        try {
            getContainer().run(true, false, runnable);
        } catch (Exception e) {
            IdeLog.logError(EngineYardPlugin.getDefault(), e);
        }
    }
    return true;
}

From source file:com.aptana.deploy.heroku.ui.wizard.HerokuDeployWizard.java

License:Open Source License

@Override
public boolean performFinish() {
    IWizardPage currentPage = getContainer().getCurrentPage();
    String pageName = currentPage.getName();

    IRunnableWithProgress runnable = null;
    if (HerokuDeployWizardPage.NAME.equals(pageName)) {
        HerokuDeployWizardPage page = (HerokuDeployWizardPage) currentPage;
        runnable = createHerokuDeployRunnable(page);
        DeployPreferenceUtil.setDeployType(getProject(), HerokuDeployProvider.ID);
        DeployPreferenceUtil.setDeployEndpoint(getProject(), page.getAppName());
    } else if (HerokuSignupPage.NAME.equals(pageName)) {
        HerokuSignupPage page = (HerokuSignupPage) currentPage;
        runnable = createHerokuSignupRunnable(page);
    }//  ww w . j a v a 2  s  .  c o m

    if (runnable != null) {
        try {
            getContainer().run(true, false, runnable);
        } catch (Exception e) {
            IdeLog.logError(HerokuPlugin.getDefault(), e);
        }
    }
    return true;
}

From source file:com.aptana.ide.core.ui.wizards.WizardPageExtensionLoader.java

License:Open Source License

/**
 * Creates wizard pages registered for the wizard id
 * /*from  www.j  a v  a 2  s. com*/
 * @param wizard
 * @param id -
 *            wizard id
 * @return - wizard pages
 */
public static IWizardPage[] createWizardPages(BaseWizard wizard, String id) {
    if (pages == null) {
        loadPages();
    }
    List<WizardPageFactory> elements = pages.get(id);
    if (elements != null) {
        List<IWizardPage> wizardPages = new ArrayList<IWizardPage>();
        for (WizardPageFactory element : elements) {
            IWizardPage page = element.createWizardPage(wizard);
            if (page != null) {
                wizardPages.add(page);
            }
        }
        Collections.sort(wizardPages, new Comparator<IWizardPage>() {

            public int compare(IWizardPage w1, IWizardPage w2) {
                return w1.getName().compareTo(w2.getName());
            }

        });
        return wizardPages.toArray(new IWizardPage[0]);
    } else {
        return new IWizardPage[0];
    }

}

From source file:com.codenvy.eclipse.ui.wizard.importer.ImportProjectFromCodenvyWizard.java

License:Open Source License

@Override
public boolean canFinish() {
    final IWizardPage currentWizardPage = getContainer().getCurrentPage();

    return currentWizardPage != null && currentWizardPage.getName().equals(projectWizardPage.getName())
            && currentWizardPage.isPageComplete();
}

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

License:Open Source License

/**
 * Update the receiver for the new page.
 * /*from  www  .  ja va2  s. 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.geofx.epubcrude.wizard.NewProjectWizard.java

License:Open Source License

@Override
public IWizardPage getNextPage(IWizardPage page) {
    System.out.println("Request to get next page: " + page.getName());
    return super.getNextPage(page);
}

From source file:com.liferay.ide.hook.ui.tests.NewHookWizardTests.java

License:Open Source License

@SuppressWarnings("static-access")
@Test//w  ww .j a  va 2  s .  co  m
public void testNextPage() throws Exception {
    wizard.addPages();

    dataModel.setBooleanProperty(CREATE_CUSTOM_JSPS, true);
    IWizardPage currentPage = wizard.getStartingPage();
    IWizardPage nextPage = wizard.getNextPage(currentPage);
    assertEquals(wizard.CUSTOM_JSPS_PAGE, nextPage.getName());

    dataModel.setBooleanProperty(CREATE_CUSTOM_JSPS, false);
    dataModel.setBooleanProperty(CREATE_LANGUAGE_PROPERTIES, true);
    currentPage = wizard.getStartingPage();
    nextPage = wizard.getNextPage(currentPage);
    assertEquals(wizard.LANGUAGE_PROPERTIES_PAGE, nextPage.getName());

    dataModel.setBooleanProperty(CREATE_CUSTOM_JSPS, false);
    dataModel.setBooleanProperty(CREATE_LANGUAGE_PROPERTIES, false);
    dataModel.setBooleanProperty(CREATE_PORTAL_PROPERTIES, true);
    currentPage = wizard.getStartingPage();
    nextPage = wizard.getNextPage(currentPage);
    assertEquals(wizard.PORTAL_PROPERTIES_PAGE, nextPage.getName());

    dataModel.setBooleanProperty(CREATE_CUSTOM_JSPS, false);
    dataModel.setBooleanProperty(CREATE_LANGUAGE_PROPERTIES, false);
    dataModel.setBooleanProperty(CREATE_PORTAL_PROPERTIES, false);
    dataModel.setBooleanProperty(CREATE_SERVICES, true);
    currentPage = wizard.getStartingPage();
    nextPage = wizard.getNextPage(currentPage);
    assertEquals(wizard.SERVICES_PAGE, nextPage.getName());

    // select all
    dataModel.setBooleanProperty(CREATE_CUSTOM_JSPS, true);
    dataModel.setBooleanProperty(CREATE_LANGUAGE_PROPERTIES, true);
    dataModel.setBooleanProperty(CREATE_PORTAL_PROPERTIES, true);
    // check next page
    currentPage = wizard.getStartingPage();
    nextPage = wizard.getNextPage(currentPage);
    assertEquals(wizard.CUSTOM_JSPS_PAGE, nextPage.getName());

    currentPage = nextPage;
    nextPage = wizard.getNextPage(currentPage);
    assertEquals(wizard.PORTAL_PROPERTIES_PAGE, nextPage.getName());

    currentPage = nextPage;
    nextPage = wizard.getNextPage(currentPage);
    assertEquals(wizard.SERVICES_PAGE, nextPage.getName());

    currentPage = nextPage;
    nextPage = wizard.getNextPage(currentPage);
    assertEquals(wizard.LANGUAGE_PROPERTIES_PAGE, nextPage.getName());

    currentPage = nextPage;
    nextPage = wizard.getNextPage(currentPage);
    assertEquals(null, wizard.getNextPage(currentPage));

    // go back and check
    IWizardPage previousPage = wizard.getPreviousPage(currentPage);
    assertEquals(wizard.SERVICES_PAGE, previousPage.getName());

    currentPage = previousPage;
    previousPage = wizard.getPreviousPage(currentPage);
    assertEquals(wizard.PORTAL_PROPERTIES_PAGE, previousPage.getName());

    currentPage = previousPage;
    previousPage = wizard.getPreviousPage(currentPage);
    assertEquals(wizard.CUSTOM_JSPS_PAGE, previousPage.getName());

    currentPage = previousPage;
    previousPage = wizard.getPreviousPage(currentPage);
    assertEquals(wizard.getStartingPage(), previousPage);

    currentPage = previousPage;
    previousPage = wizard.getPreviousPage(currentPage);
    assertEquals(null, previousPage);
}

From source file:com.microsoft.tfs.client.common.ui.framework.wizard.ExtendedWizard.java

License:Open Source License

/**
 * <p>/*from   w w  w  .  j a  v  a  2s .  com*/
 * This {@link IWizard} method is overridden to perform page and wizard page
 * finished callbacks. If these callbacks succeed, the
 * {@link #doPerformFinish()} method is called.
 * </p>
 *
 * <p>
 * {@link ExtendedWizard} subclasses typically will not override this
 * method. Instead, override {@link #doPerformFinish()} to perform wizard
 * finish logic.
 * </p>
 */
@Override
public boolean performFinish() {
    final IWizardPage currentPage = getContainer().getCurrentPage();

    try {
        if (currentPage instanceof ExtendedWizardPage) {
            if (!((ExtendedWizardPage) currentPage).onPageFinished()) {
                return false;
            }
        }

        if (!onPageFinished(currentPage)) {
            return false;
        }
    } catch (final RuntimeException e) {
        final String titleFormat = Messages.getString("ExtendedWizard.ErrorDialogTitleFormat"); //$NON-NLS-1$
        final String title = MessageFormat.format(titleFormat, currentPage.getName());
        final String messageFormat = Messages.getString("ExtendedWizard.ErrorDialogTextFormat"); //$NON-NLS-1$
        final String message = MessageFormat.format(messageFormat, currentPage.getName());

        ErrorDialog.openError(getShell(), title, null,
                new Status(Status.ERROR, TFSCommonUIClientPlugin.PLUGIN_ID, 0, message, e));

        throw e;
    }

    try {
        return doPerformFinish();
    } catch (final RuntimeException e) {
        ErrorDialog.openError(getShell(), Messages.getString("ExtendedWizard.ErrorDialogTitle"), //$NON-NLS-1$
                null,
                new Status(Status.ERROR, TFSCommonUIClientPlugin.PLUGIN_ID, 0,
                        Messages.getString("ExtendedWizard.ErrorDialogText"), //$NON-NLS-1$
                        e));

        throw e;
    }
}

From source file:com.microsoft.tfs.client.common.ui.wizard.connectwizard.ConnectWizard.java

License:Open Source License

@Override
public IWizardPage getPreviousPage(final IWizardPage page) {
    // If the current page is the Project page, make sure the user can
    // go back to the server type selection page
    if (page != null && selectionPage != null && page.getName().equals(selectionPage.getName())) {
        final IWizardPage previousPage = getPage(WizardServerSelectionPage.PAGE_NAME);
        return previousPage;
    }/*from w  ww .j av a 2 s.  co  m*/

    return super.getPreviousPage(page);
}

From source file:com.microsoft.tfs.client.common.ui.wizard.connectwizard.ConnectWizard.java

License:Open Source License

@Override
public void previousPageSet(final IWizardPage currentPage, final IWizardPage previousPage) {
    // if the current page is the selection page, we may want to "fix" the
    // previous page
    if (currentPage != null && selectionPage != null && currentPage.getName().equals(selectionPage.getName())) {
        // Check if the previous page is something other than the server
        // selection page
        if (previousPage != null && !previousPage.getName().equals(WizardServerSelectionPage.PAGE_NAME)) {
            // If so, propagate the previous page to the server selection
            // page and set the selection page to point to the server
            // selection page
            serverSelectionPage.setPreviousPage(previousPage);
            selectionPage.setPreviousPage(serverSelectionPage);
        }//from   w w  w  .  j a  v a2 s  .c o m
    }
}