Example usage for org.eclipse.jface.dialogs PageChangingEvent getTargetPage

List of usage examples for org.eclipse.jface.dialogs PageChangingEvent getTargetPage

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs PageChangingEvent getTargetPage.

Prototype

public Object getTargetPage() 

Source Link

Document

Returns the target page to change to.

Usage

From source file:com.codenvy.eclipse.ui.wizard.common.pages.AuthenticationWizardPage.java

License:Open Source License

@Override
public void handlePageChanging(final PageChangingEvent event) {
    if (isCurrentPage() && !event.getTargetPage().equals(getPreviousPage())) {
        // Check that Codenvy authentication is OK
        try {/*w  ww  . j a va 2  s  .com*/

            CodenvyPlugin.getDefault().getCodenvyBuilder(getURL(), getUsername())
                    .withCredentials(CodenvyAPI.getClient().newCredentialsBuilder().withUsername(getUsername())
                            .withPassword(getPassword()).build())
                    .build().user().current().execute();

            // Add the new location to preferences
            final IPreferenceStore codenvyPreferenceStore = CodenvyUIPlugin.getDefault().getPreferenceStore();
            final String[] locations = CodenvyPreferencesInitializer.parseString(codenvyPreferenceStore
                    .getString(CodenvyPreferencesInitializer.REMOTE_REPOSITORIES_LOCATION_KEY_NAME));

            if (!asList(locations).contains(urls.getText())) {
                codenvyPreferenceStore.setValue(
                        CodenvyPreferencesInitializer.REMOTE_REPOSITORIES_LOCATION_KEY_NAME,
                        CodenvyPreferencesInitializer
                                .createList(ObjectArrays.concat(urls.getText(), locations)));
            }

            setErrorMessage(null);

        } catch (CodenvyException e) {
            setErrorMessage(AUTHENTICATION_ERROR_MESSAGE);
            event.doit = false;
        }
    }
}

From source file:com.google.gdt.eclipse.gph.wizards.AbstractWizardPage.java

License:Open Source License

public final void createControl(Composite parent) {
    Control contents = createPageContents(parent);

    setControl(contents);/*w  w  w .ja v  a2s. co m*/

    IWizardContainer container = getWizard().getContainer();

    if (container instanceof WizardDialog) {
        WizardDialog dialog = (WizardDialog) container;

        dialog.addPageChangingListener(new IPageChangingListener() {
            public void handlePageChanging(PageChangingEvent event) {
                if (event.getCurrentPage() == AbstractWizardPage.this
                        && event.getTargetPage() != getPreviousPage()) {
                    if (!exitingPage()) {
                        event.doit = false;
                    }
                }
            }
        });
    }
}

From source file:com.google.gdt.eclipse.managedapis.ui.ApiImportWizard.java

License:Open Source License

@Override
public void addPages() {
    if (getContainer() instanceof WizardDialog) {
        WizardDialog dialog = (WizardDialog) getContainer();

        dialog.addPageChangingListener(new IPageChangingListener() {
            public void handlePageChanging(PageChangingEvent event) {
                if (event.getCurrentPage() == projectSelectionPage && event.getTargetPage() == apiListingPage) {
                    event.doit = updateFromProjectSelectionPage();
                }//from   w w w .  j  a  v  a  2s  .c  o  m
            }
        });
    }

    ImageDescriptor wizardIcon = null;

    try {
        wizardIcon = resources.getManagedApiImportIcon();
    } catch (MalformedURLException e) {
        ManagedApiLogger.warn("Unable to load Managed Api icon due to malformed URL");
    }

    // Add a project selection page.
    if (project == null) {
        projectSelectionPage = new ProjectSelectionPage(this, wizardIcon);

        addPage(projectSelectionPage);
    }

    // Add the API listings page.
    apiListingPage = new ApiListingPage("GoogleApiPage", managedApiListingSourceFactory);
    apiListingPage.setImageDescriptor(wizardIcon);
    apiListingPage.setResources(resources);

    addPage(apiListingPage);
}

From source file:com.ibm.xsp.extlib.designer.bluemix.wizard.ConfigBluemixWizard.java

License:Open Source License

@Override
public void handlePageChanging(PageChangingEvent event) {
    event.doit = true;/*from w  w  w.j  a v a  2s  . c  o  m*/
    advancing = false;
    if (event.getCurrentPage() == _dirPage) {
        if (_dirPage.hasChanged()) {
            _configPage.setFirstDisplay(true);
            _manifestPage.setFirstDisplay(true);
            _dirPage.setHasChanged(false);
        }
        if (event.getTargetPage() == _configPage) {
            advancing = true;
        } else if (event.getTargetPage() == _copyMethodPage) {
            advancing = true;
        }
    } else if (event.getCurrentPage() == _configPage) {
        if (event.getTargetPage() == _copyMethodPage) {
            advancing = true;
        }
    } else if (event.getCurrentPage() == _copyMethodPage) {
        if (event.getTargetPage() == _cloudSpacePage) {
            advancing = true;
            if (_cloudSpacePage.isFirstDisplay()) {
                if (!runJob(_cloudSpacePage.getOrgsAndSpaces)) {
                    event.doit = false;
                }
            }
        }
    } else if (event.getCurrentPage() == _cloudSpacePage) {
        if (_cloudSpacePage.hasChanged()) {
            _namePage.setFirstDisplay(true);
            _cloudSpacePage.setHasChanged(false);
        }
        if (event.getTargetPage() == _namePage) {
            advancing = true;
            if (_namePage.isFirstDisplay()) {
                _namePage.setCloudSpace(_cloudSpacePage.getOrg(), _cloudSpacePage.getSpace());
                if (!runJob(_namePage.getApplications)) {
                    event.doit = false;
                }
            }
        } else if (event.getTargetPage() == _manifestPage) {
            advancing = true;
        }
    } else if (event.getCurrentPage() == _manifestPage) {
        if (event.getTargetPage() == _namePage) {
            advancing = true;
            if (_namePage.isFirstDisplay()) {
                _namePage.setCloudSpace(_cloudSpacePage.getOrg(), _cloudSpacePage.getSpace());
                if (!runJob(_namePage.getApplications)) {
                    event.doit = false;
                }
            }
        }
    }
}

From source file:com.ibm.xsp.extlib.designer.bluemix.wizard.ImportBluemixWizard.java

License:Open Source License

@Override
public void handlePageChanging(PageChangingEvent event) {
    event.doit = true;//ww  w. j  a v a2 s  . c  om
    advancing = false;
    if (event.getCurrentPage() == _zipFilePage) {
        if (event.getTargetPage() == _importCopyMethodPage) {
            advancing = true;
        }
    } else if (event.getCurrentPage() == _importCopyMethodPage) {
        if (event.getTargetPage() == _dirPage) {
            advancing = true;
        }
    } else if (event.getCurrentPage() == _dirPage) {
        if (event.getTargetPage() == _deployCopyMethodPage) {
            advancing = true;
        }
    } else if (event.getCurrentPage() == _deployCopyMethodPage) {
        if (event.getTargetPage() == _orgSpacePage) {
            advancing = true;
            if (_orgSpacePage.isFirstDisplay()) {
                if (!runJob(_orgSpacePage.getOrgsAndSpaces)) {
                    event.doit = false;
                }
            }
        }
    }
}

From source file:com.ibm.xsp.extlib.designer.tooling.palette.applicationlayout.ApplicationLayoutDropWizard.java

License:Open Source License

@Override
public void handlePageChanging(final PageChangingEvent event) {
    // Assume success
    event.doit = true;// w w w  . j  ava 2  s .  com

    // Get the current and target pages
    WizardPage currPage = (WizardPage) event.getCurrentPage();
    WizardPage targetPage = (WizardPage) event.getTargetPage();

    if ((currPage instanceof AlwStartPage) && (targetPage instanceof AlwPropertiesPage)) {
        // Moving from first to second page
        LayoutConfig lc = getStartPage().getSelectedLayoutConfig();
        if (lc != null) {
            String errorMsg = "This configuration is in a library that is not yet enabled in this application.\nEnabling the library will add it as a dependency in Xsp Properties.\nXsp Properties is currently open in another editor and cannot be modified.\nClose Xsp Properties in order to proceed."; // $NLX-ApplicationLayoutDropWizard.Thisconfigurationisinalibrarythat-1$
            String proceedMsg = "This configuration is in a library that is not yet enabled in this application.\nEnabling the library will add it as a dependency in Xsp Properties.\nClick Continue to update your Xsp Properties."; // $NLX-ApplicationLayoutDropWizard.Thisconfigurationisinalibrarythat.1-1$
            event.doit = WizardUtils.findStandardDefAndAddDependency(lc.facesDef.getNamespaceUri(), lc.tagName,
                    _panelData.getDesignerProject(), errorMsg, proceedMsg);
        }
    }
}

From source file:com.ibm.xsp.extlib.designer.tooling.palette.singlepageapp.SinglePageAppDropWizard.java

License:Open Source License

@Override
public void handlePageChanging(PageChangingEvent event) {
    // Get the current and target pages
    WizardBasePage currPage = (WizardBasePage) event.getCurrentPage();
    WizardBasePage targetPage = (WizardBasePage) event.getTargetPage();

    // Check that the Next button has been pressed
    if ((currPage.getStepNumber() < targetPage.getStepNumber()) || (targetPage.getStepNumber() < 0)) {
        event.doit = currPage.validatePage();
    } else {/*from ww  w  . j  av  a 2s. co m*/
        event.doit = true;
    }
}

From source file:com.quantcomponents.ui.marketdata.NewHistoricalData.java

License:Open Source License

@Override
public void handlePageChanging(PageChangingEvent event) {
    if (event.getCurrentPage() == page1 && event.getTargetPage() == page2) {
        List<IContract> contracts = searchContracts();
        if (contracts.isEmpty()) {
            event.doit = false;/*w  w w  .  ja v a 2s . c om*/
        } else {
            page2.getContractListViewer().setInput(contracts);
        }
    } else if (event.getTargetPage() == page3) {
        page3.setSelectedContract(page2.getSelectedContract());
    }
}

From source file:com.siteview.mde.internal.ui.wizards.imports.PluginImportWizard.java

License:Open Source License

public void handlePageChanging(PageChangingEvent event) {
    if (event.getCurrentPage() instanceof BaseImportWizardSecondPage
            && event.getTargetPage() instanceof IScmUrlImportWizardPage) {
        IMonitorModelBase[] models = getModelsToImport();
        page1.configureBundleImportPages(models);
    }//from  www .j a v a  2  s.  com
}

From source file:com.symbian.tdep.templates.carbide.GetTestableItemsUnitPage.java

License:Open Source License

/**
 * Implement method of IDialogPage to create UI of this wizard page
 *///from w w  w. j a  va  2s  .c om
public void createControl(Composite aComposite) {
    initializeDialogUnits(aComposite);
    sProjects.clear();

    IWizardPage lpage = this;
    while ((lpage = lpage.getPreviousPage()) != null) {
        if (lpage instanceof GenerateUnitFromPage) {
            iGenerateUnitFromPage = (GenerateUnitFromPage) lpage;
            break;
        }
    }

    final Composite lComposite = new Composite(aComposite, SWT.NONE);
    {
        lComposite.setLayout(new GridLayout(1, false));
        lComposite.setLayoutData(new GridData(GridData.FILL_BOTH));

        setControl(lComposite);

        iCheckboxTreeViewer = new ContainerCheckedTreeViewer(lComposite, SWT.BORDER);

        // Content Provider
        iCheckboxTreeViewer.setContentProvider(new ClassMethodContentProvider());

        // Label Provider
        iCheckboxTreeViewer.setLabelProvider(new ClassMethodLabelProvider());

        iTree = iCheckboxTreeViewer.getTree();
        iTree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

        // Add Checked Listener
        iCheckboxTreeViewer.addCheckStateListener(new ICheckStateListener() {
            public void checkStateChanged(CheckStateChangedEvent aChangedEvent) {
                ITestItem lITestItem = (ITestItem) aChangedEvent.getElement();
                lITestItem.setSelected(aChangedEvent.getChecked());
                setPageComplete(isPageComplete());
            }
        });
    }

    ((WizardDialog) getContainer()).addPageChangingListener(new IPageChangingListener() {
        public void handlePageChanging(PageChangingEvent event) {
            IWizardPage lCurPage = (IWizardPage) event.getCurrentPage();
            IWizardPage lTarPage = (IWizardPage) event.getTargetPage();
            if (lTarPage instanceof GetTestableItemsUnitPage) {
                if (lCurPage instanceof GenerateUnitFromPage) {
                    if (iGenerateUnitFromPage.isChanged() == false) {
                        return;
                    }
                    Set<ProjectItem> iProjects = (Set<ProjectItem>) iGenerateUnitFromPage.getPageValues()
                            .get(GenerateUnitFromPage.TESTPROJECTS);
                    iCheckboxTreeViewer.setInput(iProjects);
                    iCheckboxTreeViewer.setAllChecked(true);
                    iCheckboxTreeViewer.expandAll();
                }
            }
        }
    });

}