Example usage for org.eclipse.jface.wizard Wizard Wizard

List of usage examples for org.eclipse.jface.wizard Wizard Wizard

Introduction

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

Prototype

protected Wizard() 

Source Link

Document

Creates a new empty wizard.

Usage

From source file:be.ibridge.kettle.chef.Chef.java

License:LGPL

/**
 * Create a job that extracts tables & data from a database.<p><p>
 * /*  w w w  . j  a  va  2  s  . co  m*/
 * 0) Select the database to rip<p>
 * 1) Select the tables in the database to rip<p>
 * 2) Select the database to dump to<p>
 * 3) Select the repository directory in which it will end up<p>
 * 4) Select a name for the new job<p>
 * 5) Create an empty job with the selected name.<p>
 * 6) Create 1 transformation for every selected table<p>
 * 7) add every created transformation to the job & evaluate<p>
 * 
 */
private void ripDBWizard() {
    final RipDatabaseWizardPage1 page1 = new RipDatabaseWizardPage1("1", jobMeta.databases); //$NON-NLS-1$
    page1.createControl(shell);
    final RipDatabaseWizardPage2 page2 = new RipDatabaseWizardPage2("2"); //$NON-NLS-1$
    page2.createControl(shell);
    final RipDatabaseWizardPage3 page3 = new RipDatabaseWizardPage3("3", rep); //$NON-NLS-1$
    page3.createControl(shell);

    Wizard wizard = new Wizard() {
        public boolean performFinish() {
            return ripDB(page3.getJobname(), page3.getRepositoryDirectory(), page1.getSourceDatabase(),
                    page1.getTargetDatabase(), page2.getSelection());
        }

        /**
         * @see org.eclipse.jface.wizard.Wizard#canFinish()
         */
        public boolean canFinish() {
            return page3.canFinish();
        }
    };

    wizard.addPage(page1);
    wizard.addPage(page2);
    wizard.addPage(page3);

    WizardDialog wd = new WizardDialog(shell, wizard);
    wd.setMinimumPageSize(700, 400);
    wd.open();
}

From source file:be.ibridge.kettle.core.wizards.createdatabase.CreateDatabaseWizard.java

License:LGPL

/**
 * Shows a wizard that creates a new database connection...
 * @param shell/*from  w  w w.j  a v a  2 s  . com*/
 * @param props
 * @param databases
 * @return DatabaseMeta when finished or null when canceled
 */
public DatabaseMeta createAndRunDatabaseWizard(Shell shell, Props props, ArrayList databases) {

    DatabaseMeta newDBInfo = new DatabaseMeta();

    final CreateDatabaseWizardPage1 page1 = new CreateDatabaseWizardPage1("1", props, newDBInfo, databases);
    page1.createControl(shell);

    final CreateDatabaseWizardPageInformix pageifx = new CreateDatabaseWizardPageInformix("ifx", props,
            newDBInfo);
    pageifx.createControl(shell);

    final CreateDatabaseWizardPageJDBC pagejdbc = new CreateDatabaseWizardPageJDBC("jdbc", props, newDBInfo);
    pagejdbc.createControl(shell);

    final CreateDatabaseWizardPageOCI pageoci = new CreateDatabaseWizardPageOCI("oci", props, newDBInfo);
    pageoci.createControl(shell);

    final CreateDatabaseWizardPageODBC pageodbc = new CreateDatabaseWizardPageODBC("odbc", props, newDBInfo);
    pageodbc.createControl(shell);

    final CreateDatabaseWizardPageOracle pageoracle = new CreateDatabaseWizardPageOracle("oracle", props,
            newDBInfo);

    final CreateDatabaseWizardPageSAPR3 pageSAPR3 = new CreateDatabaseWizardPageSAPR3("SAPR3", props,
            newDBInfo);
    pageSAPR3.createControl(shell);

    final CreateDatabaseWizardPageGeneric pageGeneric = new CreateDatabaseWizardPageGeneric("generic", props,
            newDBInfo);
    pageGeneric.createControl(shell);

    final CreateDatabaseWizardPage2 page2 = new CreateDatabaseWizardPage2("2", props, newDBInfo);
    page2.createControl(shell);

    wizardFinished = false; // set to false for safety only

    Wizard wizard = new Wizard() {
        /**
         * @see org.eclipse.jface.wizard.Wizard#performFinish()
         */
        public boolean performFinish() {
            wizardFinished = true;
            return true;
        }

        /**
         * @see org.eclipse.jface.wizard.Wizard#canFinish()
         */
        public boolean canFinish() {
            return page2.canFinish();
        }
    };

    wizard.addPage(page1);
    wizard.addPage(pageoci);
    wizard.addPage(pageodbc);
    wizard.addPage(pagejdbc);
    wizard.addPage(pageoracle);
    wizard.addPage(pageifx);
    wizard.addPage(pageSAPR3);
    wizard.addPage(pageGeneric);
    wizard.addPage(page2);

    WizardDialog wd = new WizardDialog(shell, wizard);
    wd.setMinimumPageSize(700, 400);
    wd.open();

    if (!wizardFinished) {
        newDBInfo = null;
    }
    return newDBInfo;
}

From source file:be.ibridge.kettle.spoon.Spoon.java

License:LGPL

/**
 * Create a transformation that extracts tables & data from a database.<p><p>
 * //from  w  ww. j  av a2s  .c  om
 * 0) Select the database to rip<p>
 * 1) Select the table in the database to copy<p>
 * 2) Select the database to dump to<p>
 * 3) Select the repository directory in which it will end up<p>
 * 4) Select a name for the new transformation<p>
 * 6) Create 1 transformation for the selected table<p> 
 */
private void copyTableWizard() {
    ArrayList databases = getActiveDatabases();
    if (databases.size() == 0)
        return; // Nothing to do here

    final CopyTableWizardPage1 page1 = new CopyTableWizardPage1("1", databases);
    page1.createControl(shell);
    final CopyTableWizardPage2 page2 = new CopyTableWizardPage2("2");
    page2.createControl(shell);

    Wizard wizard = new Wizard() {
        public boolean performFinish() {
            return copyTable(page1.getSourceDatabase(), page1.getTargetDatabase(), page2.getSelection());
        }

        /**
         * @see org.eclipse.jface.wizard.Wizard#canFinish()
         */
        public boolean canFinish() {
            return page2.canFinish();
        }
    };

    wizard.addPage(page1);
    wizard.addPage(page2);

    WizardDialog wd = new WizardDialog(shell, wizard);
    wd.setMinimumPageSize(700, 400);
    wd.open();
}

From source file:be.ibridge.kettle.spoon.Spoon.java

License:LGPL

/**
 * Create a job that extracts tables & data from a database.<p><p>
 * //from  www .  j a  v a  2  s.c o m
 * 0) Select the database to rip<p>
 * 1) Select the tables in the database to rip<p>
 * 2) Select the database to dump to<p>
 * 3) Select the repository directory in which it will end up<p>
 * 4) Select a name for the new job<p>
 * 5) Create an empty job with the selected name.<p>
 * 6) Create 1 transformation for every selected table<p>
 * 7) add every created transformation to the job & evaluate<p>
 * 
 */
private void ripDBWizard() {
    final ArrayList databases = getActiveDatabases();
    if (databases.size() == 0)
        return; // Nothing to do here

    final RipDatabaseWizardPage1 page1 = new RipDatabaseWizardPage1("1", databases); //$NON-NLS-1$
    page1.createControl(shell);
    final RipDatabaseWizardPage2 page2 = new RipDatabaseWizardPage2("2"); //$NON-NLS-1$
    page2.createControl(shell);
    final RipDatabaseWizardPage3 page3 = new RipDatabaseWizardPage3("3", rep); //$NON-NLS-1$
    page3.createControl(shell);

    Wizard wizard = new Wizard() {
        public boolean performFinish() {
            JobMeta jobMeta = ripDB(databases, page3.getJobname(), page3.getRepositoryDirectory(),
                    page3.getDirectory(), page1.getSourceDatabase(), page1.getTargetDatabase(),
                    page2.getSelection());
            if (jobMeta == null)
                return false;

            if (page3.getRepositoryDirectory() != null) {
                saveJobRepository(jobMeta);
            } else {
                saveJobFile(jobMeta);
            }

            addChefGraph(jobMeta);
            return true;
        }

        /**
         * @see org.eclipse.jface.wizard.Wizard#canFinish()
         */
        public boolean canFinish() {
            return page3.canFinish();
        }
    };

    wizard.addPage(page1);
    wizard.addPage(page2);
    wizard.addPage(page3);

    WizardDialog wd = new WizardDialog(shell, wizard);
    wd.setMinimumPageSize(700, 400);
    wd.open();
}

From source file:com.nextep.datadesigner.gui.model.InvokableController.java

License:Open Source License

/**
 * Opens a wizard on the specified wizard pages
 * //from  w ww  .  ja  v  a 2  s.c  om
 * @param title wizard title
 * @param pages wizard pages
 * @return the wizard
 */
protected int openWizard(final String title, IWizardPage... pages) {
    Wizard w = new Wizard() {

        @Override
        public boolean performFinish() {
            return true;
        }
    };
    w.setWindowTitle(title);
    for (IWizardPage p : pages) {
        w.addPage(p);
    }
    return openWizardDialog(w);
}

From source file:com.siteview.mde.internal.ui.shared.target.AddBundleContainerSelectionPage.java

License:Open Source License

/**
 * Returns the standard choices of bundle containers to create
 * @return list of wizard nodes//from ww  w.j  a  va 2s  .co m
 */
private List getStandardChoices() {
    List standardChoices = new ArrayList(4);
    // Directory Containers
    standardChoices.add(new AbstractBundleContainerNode(Messages.AddBundleContainerSelectionPage_3,
            Messages.AddBundleContainerSelectionPage_4,
            PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER)) {
        public IWizard createWizard() {
            Wizard wizard = new Wizard() {
                private EditDirectoryContainerPage fPage1;

                public void addPages() {
                    IDialogSettings settings = MDEPlugin.getDefault().getDialogSettings()
                            .getSection(SETTINGS_SECTION);
                    if (settings == null) {
                        settings = MDEPlugin.getDefault().getDialogSettings().addNewSection(SETTINGS_SECTION);
                    }
                    setDialogSettings(settings);
                    fPage1 = new EditDirectoryContainerPage();
                    addPage(fPage1);
                    addPage(new PreviewContainerPage(fTarget, fPage1));
                    setNeedsProgressMonitor(true);
                }

                public boolean performFinish() {
                    IBundleContainer container = fPage1.getBundleContainer();
                    if (container != null) {
                        fPage1.storeSettings();
                        IBundleContainer[] oldContainers = fTarget.getBundleContainers();
                        if (oldContainers == null) {
                            fTarget.setBundleContainers(new IBundleContainer[] { container });
                        } else {
                            IBundleContainer[] newContainers = new IBundleContainer[oldContainers.length + 1];
                            System.arraycopy(oldContainers, 0, newContainers, 0, oldContainers.length);
                            newContainers[newContainers.length - 1] = container;
                            fTarget.setBundleContainers(newContainers);
                        }
                    }
                    return true;
                }
            };
            wizard.setWindowTitle(Messages.AddBundleContainerSelectionPage_1);
            return wizard;
        }
    });
    // Installation/Profile Containers
    standardChoices.add(new AbstractBundleContainerNode(Messages.AddBundleContainerSelectionPage_6,
            Messages.AddBundleContainerSelectionPage_7,
            MDEPlugin.getDefault().getLabelProvider().get(MDEPluginImages.DESC_PRODUCT_DEFINITION)) {
        public IWizard createWizard() {
            Wizard wizard = new Wizard() {
                private EditProfileContainerPage fPage1;

                public void addPages() {
                    IDialogSettings settings = MDEPlugin.getDefault().getDialogSettings()
                            .getSection(SETTINGS_SECTION);
                    if (settings == null) {
                        settings = MDEPlugin.getDefault().getDialogSettings().addNewSection(SETTINGS_SECTION);
                    }
                    setDialogSettings(settings);
                    setDialogSettings(settings);
                    fPage1 = new EditProfileContainerPage();
                    addPage(fPage1);
                    addPage(new PreviewContainerPage(fTarget, fPage1));
                    setNeedsProgressMonitor(true);
                }

                public boolean performFinish() {
                    IBundleContainer container = fPage1.getBundleContainer();
                    if (container != null) {
                        fPage1.storeSettings();
                        IBundleContainer[] oldContainers = fTarget.getBundleContainers();
                        if (oldContainers == null) {
                            fTarget.setBundleContainers(new IBundleContainer[] { container });
                        } else {
                            IBundleContainer[] newContainers = new IBundleContainer[oldContainers.length + 1];
                            System.arraycopy(oldContainers, 0, newContainers, 0, oldContainers.length);
                            newContainers[newContainers.length - 1] = container;
                            fTarget.setBundleContainers(newContainers);
                        }
                    }
                    return true;
                }
            };
            wizard.setWindowTitle(Messages.AddBundleContainerSelectionPage_1);
            return wizard;
        }
    });
    // Feature Containers
    standardChoices.add(new AbstractBundleContainerNode(Messages.AddBundleContainerSelectionPage_9,
            Messages.AddBundleContainerSelectionPage_10,
            MDEPlugin.getDefault().getLabelProvider().get(MDEPluginImages.DESC_FEATURE_OBJ)) {
        public IWizard createWizard() {
            Wizard wizard = new Wizard() {
                public void addPages() {
                    IDialogSettings settings = MDEPlugin.getDefault().getDialogSettings()
                            .getSection(SETTINGS_SECTION);
                    if (settings == null) {
                        settings = MDEPlugin.getDefault().getDialogSettings().addNewSection(SETTINGS_SECTION);
                    }
                    setDialogSettings(settings);
                    addPage(new AddFeatureContainersPage());
                }

                public boolean performFinish() {
                    try {
                        IBundleContainer[] containers = ((AddFeatureContainersPage) getPages()[0])
                                .getBundleContainers();
                        if (containers != null) {
                            ((AddFeatureContainersPage) getPages()[0]).storeSettings();
                            IBundleContainer[] oldContainers = fTarget.getBundleContainers();
                            if (oldContainers == null) {
                                fTarget.setBundleContainers(containers);
                            } else {
                                IBundleContainer[] newContainers = new IBundleContainer[oldContainers.length
                                        + containers.length];
                                System.arraycopy(oldContainers, 0, newContainers, 0, oldContainers.length);
                                System.arraycopy(containers, 0, newContainers, oldContainers.length,
                                        containers.length);
                                fTarget.setBundleContainers(newContainers);
                            }
                        }
                        return true;
                    } catch (CoreException e) {
                        setErrorMessage(e.getMessage());
                        return false;
                    }
                }
            };
            wizard.setWindowTitle(Messages.AddBundleContainerSelectionPage_1);
            return wizard;
        }
    });
    // Repository and Update Site Container
    standardChoices.add(new AbstractBundleContainerNode(Messages.AddBundleContainerSelectionPage_8,
            Messages.AddBundleContainerSelectionPage_11,
            MDEPlugin.getDefault().getLabelProvider().get(MDEPluginImages.DESC_REPOSITORY_OBJ)) {
        public IWizard createWizard() {
            Wizard wizard = new Wizard() {
                public void addPages() {
                    IDialogSettings settings = MDEPlugin.getDefault().getDialogSettings()
                            .getSection(SETTINGS_SECTION);
                    if (settings == null) {
                        settings = MDEPlugin.getDefault().getDialogSettings().addNewSection(SETTINGS_SECTION);
                    }
                    setDialogSettings(settings);
                    addPage(new EditIUContainerPage(fTarget));
                }

                public boolean performFinish() {
                    IBundleContainer container = ((EditIUContainerPage) getPages()[0]).getBundleContainer();
                    if (container != null) {
                        ((EditIUContainerPage) getPages()[0]).storeSettings();
                        IBundleContainer[] oldContainers = fTarget.getBundleContainers();
                        if (oldContainers == null) {
                            fTarget.setBundleContainers(new IBundleContainer[] { container });
                        } else {
                            IBundleContainer[] newContainers = new IBundleContainer[oldContainers.length + 1];
                            System.arraycopy(oldContainers, 0, newContainers, 0, oldContainers.length);
                            newContainers[newContainers.length - 1] = container;
                            fTarget.setBundleContainers(newContainers);
                        }
                    }
                    return true;
                }
            };
            wizard.setWindowTitle(Messages.AddBundleContainerSelectionPage_1);
            return wizard;
        }
    });
    return standardChoices;
}

From source file:com.siteview.mde.internal.ui.shared.target.AddBundleContainerSelectionPage.java

License:Open Source License

/**
 * Creates a wizard node that will get the pages from the contributed wizard and create a directory bundle container from the result
 * @param element wizard element representing the extension
 * @return wizard node//from   ww w  .j a va2 s. c om
 */
private AbstractBundleContainerNode createExtensionNode(final WizardElement element) {
    return new AbstractBundleContainerNode(element.getLabel(), element.getDescription(), element.getImage()) {
        public IWizard createWizard() {
            Wizard wizard = new Wizard() {
                private IProvisionerWizard fWizard;

                public void addPages() {
                    try {
                        fWizard = (IProvisionerWizard) element.createExecutableExtension();
                    } catch (CoreException e) {
                        MDEPlugin.log(e);
                        MessageDialog.openError(getContainer().getShell(), Messages.Errors_CreationError,
                                Messages.Errors_CreationError_NoWizard);
                    }
                    fWizard.setContainer(getContainer());
                    fWizard.addPages();
                    IWizardPage[] pages = fWizard.getPages();
                    for (int i = 0; i < pages.length; i++)
                        addPage(pages[i]);
                }

                public boolean performFinish() {
                    if (fWizard != null) {
                        if (!fWizard.performFinish()) {
                            return false;
                        }
                        File[] dirs = fWizard.getLocations();
                        for (int i = 0; i < dirs.length; i++) {
                            if (dirs[i] == null || !dirs[i].isDirectory()) {
                                ErrorDialog.openError(getShell(), Messages.AddBundleContainerSelectionPage_0,
                                        Messages.AddBundleContainerSelectionPage_5, new Status(IStatus.ERROR,
                                                MDEPlugin.getPluginId(), Messages.AddDirectoryContainerPage_6));
                                return false;
                            }
                            try {
                                // First try the specified dir, then try the plugins dir
                                IBundleContainer container = getTargetPlatformService()
                                        .newDirectoryContainer(dirs[i].getPath());
                                IBundleContainer[] oldContainers = fTarget.getBundleContainers();
                                if (oldContainers == null) {
                                    fTarget.setBundleContainers(new IBundleContainer[] { container });
                                } else {
                                    IBundleContainer[] newContainers = new IBundleContainer[oldContainers.length
                                            + 1];
                                    System.arraycopy(oldContainers, 0, newContainers, 0, oldContainers.length);
                                    newContainers[oldContainers.length] = container;
                                    fTarget.setBundleContainers(newContainers);
                                }
                            } catch (CoreException ex) {
                                ErrorDialog.openError(getShell(), Messages.AddBundleContainerSelectionPage_0,
                                        Messages.AddBundleContainerSelectionPage_5, ex.getStatus());
                                return false;
                            }
                        }
                    }
                    return true;
                }
            };
            wizard.setContainer(getContainer());
            wizard.setWindowTitle(Messages.AddBundleContainerSelectionPage_1);
            return wizard;
        }
    };
}

From source file:eu.celar.ui.UIAuthTokenProvider.java

License:Open Source License

/**
 * Show the new token wizard. If the specified description is not null the wizard will
 * be started with the wizard page belonging to the specified description. Otherwise it
 * will be started with the token type page as starting page where the user can choose
 * the type of the he wants to create./*from  w w  w.  jav a2  s.c o m*/
 * 
 * @param tokenWizardId The ID of the token type that should be created or null.
 * @param forceWizardId 
 * @param description Token description passed to the token specific wizard pages in
 * order to allow initialisation for a predefined token type.
 * @return True if the token dialog was closed with status {@link Window#OK}.
 */
public boolean showNewTokenWizard(final String tokenWizardId, final boolean forceWizardId,
        final IAuthenticationTokenDescription description) {
    URL imgUrl = Activator.getDefault().getBundle().getEntry("icons/wizban/newtoken_wiz.gif"); //$NON-NLS-1$

    Wizard wizard = new Wizard() {
        @Override
        public boolean performFinish() {
            return false;
        }

        @Override
        public void addPages() {
            List<String> filterList = null;
            if (tokenWizardId != null) {
                filterList = new LinkedList<String>();
                filterList.add(tokenWizardId);
            }
            ExtPointWizardSelectionListPage page = new ExtPointWizardSelectionListPage(WIZARD_PAGE_NAME,
                    Extensions.AUTH_TOKEN_UI_POINT, filterList, forceWizardId,
                    Messages.getString("UIAuthTokenProvider.wizard_first_page_title"), //$NON-NLS-1$
                    Messages.getString("UIAuthTokenProvider.wizard_first_page_description"), //$NON-NLS-1$
                    Messages.getString("UIAuthTokenProvider.noTokenCreator")); //$NON-NLS-1$
            //        page.setPreselectedId( tokenWizardId, true );
            page.setInitData(description);
            page.setCheatSheetManager(cheatSheetManager);
            addPage(page);
        }
    };

    wizard.setNeedsProgressMonitor(true);
    wizard.setForcePreviousAndNextButtons(true);
    wizard.setWindowTitle(Messages.getString("UIAuthTokenProvider.wizard_title")); //$NON-NLS-1$
    wizard.setDefaultPageImageDescriptor(ImageDescriptor.createFromURL(imgUrl));
    WizardDialog dialog = new WizardDialog(this.shell, wizard);
    return dialog.open() == Window.OK;
}

From source file:eu.geclipse.gvid.internal.views.NewGVidDropDownAction.java

License:Open Source License

@Override
public void run() {
    URL imgUrl = Activator.getDefault().getBundle().getEntry("icons/wizban/newconn_wiz.gif"); //$NON-NLS-1$

    Wizard wizard = new Wizard() {
        @Override//  w  w  w  . ja  v a  2  s .c  om
        public boolean performFinish() {
            return false;
        }

        @Override
        public void addPages() {
            ExtPointWizardSelectionListPage page = new ExtPointWizardSelectionListPage(
                    Messages.getString("NewGVidDropDownAction.selectConnectionType"), //$NON-NLS-1$
                    EXT_ID_NEW_GVID_WIZARD, Messages.getString("NewGVidDropDownAction.title"), //$NON-NLS-1$
                    Messages.getString("NewGVidDropDownAction.description"), //$NON-NLS-1$
                    Messages.getString("NewGVidDropDownAction.noConnectionTypes")); //$NON-NLS-1$
            page.setInitData(NewGVidDropDownAction.this.gvidView);
            addPage(page);
        }
    };
    wizard.setForcePreviousAndNextButtons(true);
    wizard.setDefaultPageImageDescriptor(ImageDescriptor.createFromURL(imgUrl));
    wizard.setWindowTitle(Messages.getString("NewGVidDropDownAction.newGVidSession")); //$NON-NLS-1$
    WizardDialog wizardDialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
    wizardDialog.open();
}

From source file:eu.geclipse.terminal.internal.NewTerminalDropDownAction.java

License:Open Source License

@Override
public void run() {
    URL imgUrl = Activator.getDefault().getBundle().getEntry("icons/wizban/newconn_wiz.gif"); //$NON-NLS-1$

    Wizard wizard = new Wizard() {
        @Override/* w  ww  .  j a v  a2s  .c  om*/
        public boolean performFinish() {
            return false;
        }

        @Override
        public void addPages() {
            ExtPointWizardSelectionListPage page = new ExtPointWizardSelectionListPage(
                    Messages.getString("NewTerminalDropDownAction.selectConnectionType"), //$NON-NLS-1$
                    EXT_ID_NEW_TERMINAL_WIZARD, Messages.getString("NewTerminalDropDownAction.title"), //$NON-NLS-1$
                    Messages.getString("NewTerminalDropDownAction.description"), //$NON-NLS-1$
                    Messages.getString("NewTerminalDropDownAction.noConnectionTypes")); //$NON-NLS-1$
            page.setInitData(NewTerminalDropDownAction.this.terminalView);
            addPage(page);
        }
    };
    wizard.setForcePreviousAndNextButtons(true);
    wizard.setDefaultPageImageDescriptor(ImageDescriptor.createFromURL(imgUrl));
    wizard.setWindowTitle(Messages.getString("NewTerminalDropDownAction.newTerminalSession")); //$NON-NLS-1$
    WizardDialog wizardDialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
    wizardDialog.open();
}