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

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

Introduction

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

Prototype

public Object getCurrentPage() 

Source Link

Document

Returns the current page from which the page change originates.

Usage

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);//from w w  w  .  j  a v  a 2s  .  c  o 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 ww .  java 2 s  .  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  www .  j  a  v a 2s . co  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;/*from   www .  j  av a 2s.co m*/
    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;/*from w w  w  . ja  va  2 s  .  c  o m*/

    // 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 {/* w  ww  .java 2 s.co  m*/
        event.doit = true;
    }
}

From source file:com.nokia.testfw.codegen.ui.wizard.AbstractTemplateWizard.java

License:Open Source License

public void addPages() {
    if (iShowNewProjectPage) {
        iNewProjectPage = new NewProjectPage("Symbian Test Framework",
                "Create a new Symbian Test Framework project") {
            @Override/*from  w  ww .  j  a  v a 2  s  .  c  o m*/
            public void createControl(Composite parent) {
                super.createControl(parent);
                ((WizardDialog) getContainer()).addPageChangingListener(new IPageChangingListener() {
                    public void handlePageChanging(PageChangingEvent event) {
                        if (event.getCurrentPage() instanceof NewProjectPage) {
                            iProjectName = iNewProjectPage.getProjectName();
                            iProjectLocation = iNewProjectPage.getLocationPath().append(iProjectName)
                                    .toOSString();
                            iDataMap.put(PROJECT_NAME, iProjectName);
                        }
                    }
                });
            }
        };
        addPage(iNewProjectPage);

        iBuildTargetsPage = new BuildTargetsPage() {
            @Override
            public void createControl(Composite parent) {
                super.createControl(parent);
                ((WizardDialog) getContainer()).addPageChangingListener(new IPageChangingListener() {
                    public void handlePageChanging(PageChangingEvent event) {
                        if (event.getCurrentPage() instanceof BuildTargetsPage) {
                            iBuildConfigs = getSelectedBuildConfigs();
                            iDefaultSDK = iBuildConfigs.get(0).getSDK();
                            initPages();
                        }
                    }
                });
            }

            protected boolean validatePage() {
                boolean valid = super.validatePage();
                if (valid)
                    checkPathWithSDKs(iNewProjectPage.getLocationPath());
                return valid;
            }
        };
        addPage(iBuildTargetsPage);
    }
}

From source file:com.nokia.testfw.codegen.ui.wizard.ChooseProjectPage.java

License:Open Source License

public void handlePageChanging(PageChangingEvent event) {
    if (event.getCurrentPage() instanceof ChooseProjectPage) {
        if (iTargetProject != null) {
            ((AbstractTemplateWizard) getWizard()).setSelection(iSelection);
            ((AbstractTemplateWizard) getWizard()).setTargetProject(iTargetProject);
            ((AbstractTemplateWizard) getWizard())
                    .setProjectLocation(iTargetProject.getLocation().toOSString());
            ((AbstractTemplateWizard) getWizard()).getDataMap().put(AbstractTemplateWizard.PROJECT_NAME,
                    iTargetProject.getName());
            ((AbstractTemplateWizard) getWizard()).initPages();
        }//  www .j a  v  a 2 s . co m
    }
}

From source file:com.nokia.testfw.codegen.ui.wizard.TestCasePreviewPage.java

License:Open Source License

public void handlePageChanging(PageChangingEvent event) {
    if (event.getCurrentPage() instanceof TestCasePreviewPage) {
        ((IPreviewResult) getWizard()).setPreviewResult(null);
    }/* w w  w .  j  a  va 2s . c  o m*/
}

From source file:com.nokia.tools.variant.compare.ui.actions.ImportDataAction.java

License:Open Source License

public void run(IAction action) {

    final ImportDataWizard wizard;

    if (modelPart == null) {
        // no CPF is open
        wizard = new ImportDataWizard();
    } else {/*  ww  w .  j  a v a2s .c  o  m*/
        // Opened CPF is set as target
        wizard = new ImportDataWizard(modelPart);
        wizard.setTargetModel((ViewEditorModel) modelPart.getAdapter(ViewEditorModel.class));
    }

    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    WizardDialog dialog = new WizardDialog(window.getShell(), wizard) {
        @Override
        protected void configureShell(Shell newShell) {
            super.configureShell(newShell);
            Image image = ExtendedImageRegistry.INSTANCE
                    .getImage(ImportDataUIPlugin.INSTANCE.getImage("copyvalues_16_tlb.png"));
            newShell.setImage(image);
        }
    };
    dialog.addPageChangingListener(new IPageChangingListener() {
        public void handlePageChanging(PageChangingEvent event) {
            if (event.getCurrentPage() == wizard.getPage(ImportDataWizardPageOne.PAGE_ID)) {
                try {
                    if (!wizard.isCpfOpened()) {
                        wizard.loadSourceAndTargetModel();
                    } else {
                        wizard.loadSourceModel();
                    }
                    event.doit = true;
                } catch (Exception ex) {
                    event.doit = false;
                    ((WizardPage) event.getCurrentPage()).setErrorMessage(ex.toString());
                }
            }
        }
    });

    GC gc = new GC(window.getShell());
    FontMetrics fm = gc.getFontMetrics();
    gc.dispose();
    int minWidth = Dialog.convertWidthInCharsToPixels(fm, 35);
    int minHeight = Dialog.convertHeightInCharsToPixels(fm, 25);
    dialog.setMinimumPageSize(minWidth, minHeight);
    dialog.open();

}