Search in sources :

Example 1 with CopyTableWizardPage1

use of org.pentaho.di.ui.spoon.wizards.CopyTableWizardPage1 in project pentaho-kettle by pentaho.

the class Spoon method copyTableWizard.

/**
 * Create a transformation that extracts tables & data from a database.
 * <p>
 * <p>
 *
 * 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>
 */
public void copyTableWizard() {
    List<DatabaseMeta> databases = getActiveDatabases();
    if (databases.size() == 0) {
        // Nothing to do here
        return;
    }
    final CopyTableWizardPage1 page1 = new CopyTableWizardPage1("1", databases);
    final CopyTableWizardPage2 page2 = new CopyTableWizardPage2("2");
    Wizard wizard = new Wizard() {

        @Override
        public boolean performFinish() {
            return delegates.db.copyTable(page1.getSourceDatabase(), page1.getTargetDatabase(), page2.getSelection());
        }

        /**
         * @see org.eclipse.jface.wizard.Wizard#canFinish()
         */
        @Override
        public boolean canFinish() {
            return page2.canFinish();
        }
    };
    wizard.addPage(page1);
    wizard.addPage(page2);
    WizardDialog wd = new WizardDialog(shell, wizard);
    WizardDialog.setDefaultImage(GUIResource.getInstance().getImageWizard());
    wd.setMinimumPageSize(700, 400);
    wd.updateSize();
    wd.open();
}
Also used : CopyTableWizardPage2(org.pentaho.di.ui.spoon.wizards.CopyTableWizardPage2) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) CopyTableWizardPage1(org.pentaho.di.ui.spoon.wizards.CopyTableWizardPage1) CreateDatabaseWizard(org.pentaho.di.ui.core.database.wizard.CreateDatabaseWizard) Wizard(org.eclipse.jface.wizard.Wizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

Wizard (org.eclipse.jface.wizard.Wizard)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)1 CreateDatabaseWizard (org.pentaho.di.ui.core.database.wizard.CreateDatabaseWizard)1 CopyTableWizardPage1 (org.pentaho.di.ui.spoon.wizards.CopyTableWizardPage1)1 CopyTableWizardPage2 (org.pentaho.di.ui.spoon.wizards.CopyTableWizardPage2)1