Example usage for org.eclipse.jface.wizard WizardDialog setMinimumPageSize

List of usage examples for org.eclipse.jface.wizard WizardDialog setMinimumPageSize

Introduction

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

Prototype

public void setMinimumPageSize(int minWidth, int minHeight) 

Source Link

Document

Sets the minimum page size used for the pages.

Usage

From source file:ar.com.tadp.xml.rinzo.jdt.actions.CreateClassAction.java

License:Open Source License

public void run(IAction action) {
    if (!Utils.isEmpty(this.getSelection())) {
        IWorkbench workbench = RinzoJDTPlugin.getDefault().getWorkbench();
        Shell shell = workbench.getActiveWorkbenchWindow().getShell();
        NewClassCreationWizard wizard = new NewClassCreationWizard();
        String className = this.getSelection().substring(this.getSelection().lastIndexOf(".") + 1);
        String packageName = this.getSelection().substring(0, this.getSelection().lastIndexOf("."));
        wizard.init(workbench, new StructuredSelection(className));
        WizardDialog dialog = new WizardDialog(shell, wizard);
        PixelConverter converter = new PixelConverter(shell);
        dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70),
                converter.convertHeightInCharsToPixels(20));
        dialog.create();/*from  www .  jav  a2s .com*/
        NewClassWizardPage page = (NewClassWizardPage) wizard.getPage("NewClassWizardPage");
        page.setTypeName(className, true);
        page.setAddComments(true, true);
        IPackageFragmentRoot sourceFolder = this.getSourceFolder();
        page.setPackageFragmentRoot(sourceFolder, true);
        page.setPackageFragment(sourceFolder.getPackageFragment(packageName), true);
        dialog.open();
    }
}

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

License:LGPL

/**
 * Create a job that extracts tables & data from a database.<p><p>
 * //from  www. j  a  v  a  2s.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 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//w  w  w  . jav a 2s  .  co  m
 * @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  w  w.ja v a2  s.c  o  m*/
 * 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  .  ja va2  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.amazonaws.eclipse.opsworks.deploy.handler.DeployProjectToOpsworksHandler.java

License:Open Source License

public Object execute(ExecutionEvent event) throws ExecutionException {

    ISelection selection = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();

    if (selection instanceof IStructuredSelection) {
        IStructuredSelection structurredSelection = (IStructuredSelection) selection;

        Object firstSeleciton = structurredSelection.getFirstElement();
        if (firstSeleciton instanceof IProject) {
            IProject selectedProject = (IProject) firstSeleciton;

            try {
                WizardDialog wizardDialog = new WizardDialog(Display.getCurrent().getActiveShell(),
                        new DeployProjectToOpsworksWizard(selectedProject));
                wizardDialog.setMinimumPageSize(0, 600);

                wizardDialog.open();// www.  j a  v  a 2 s  . c  o  m

            } catch (Exception e) {
                OpsWorksPlugin.getDefault().reportException("Failed to launch deployment wizard.", e);
            }

        } else {
            OpsWorksPlugin.getDefault().logInfo("Invalid selection: " + firstSeleciton + " is not a project.");
        }
    }

    return null;
}

From source file:com.google.dart.tools.ui.actions.AbstractOpenWizardAction.java

License:Open Source License

@Override
public void run() {
    EmitInstrumentationCommand();//  ww w.  ja v  a 2s. c o m
    Shell shell = getShell();
    try {
        INewWizard wizard = createWizard();
        wizard.init(PlatformUI.getWorkbench(), getSelection());

        WizardDialog dialog = new WizardDialog(shell, wizard);
        PixelConverter converter = new PixelConverter(JFaceResources.getDialogFont());
        dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70),
                converter.convertHeightInCharsToPixels(20));
        dialog.create();
        int res = dialog.open();
        notifyResult(res == Window.OK);
    } catch (CoreException e) {
        String title = ActionMessages.AbstractOpenWizardAction_createerror_title;
        String message = ActionMessages.AbstractOpenWizardAction_createerror_message;
        ExceptionHandler.handle(e, shell, title, message);
    }
}

From source file:com.google.gdt.eclipse.core.actions.AbstractOpenWizardAction.java

License:Open Source License

@Override
public void run() {
    Shell localShell = getShell();/*w  w  w  .j  a  va2s.  c  o m*/
    if (!doCreateProjectFirstOnEmptyWorkspace(localShell)) {
        return;
    }

    try {
        INewWizard wizard = createWizard();
        wizard.init(PlatformUI.getWorkbench(), getSelection());

        WizardDialog dialog = new WizardDialog(localShell, wizard);
        IPixelConverter converter = PixelConverterFactory.createPixelConverter(JFaceResources.getDialogFont());
        dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70),
                converter.convertHeightInCharsToPixels(20));
        dialog.create();
        int res = dialog.open();
        if (res == Window.OK && wizard instanceof NewElementWizard) {
            createdElement = ((NewElementWizard) wizard).getCreatedElement();
        }

        notifyResult(res == Window.OK);
    } catch (CoreException e) {
        String title = NewWizardMessages.AbstractOpenWizardAction_createerror_title;
        String message = NewWizardMessages.AbstractOpenWizardAction_createerror_message;
        ExceptionHandler.handle(e, localShell, title, message);
    }
}

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

License:Open Source License

@Override
public void setVisible(boolean visible) {
    if (visible && getWizard().getContainer() instanceof WizardDialog) {
        WizardDialog dialog = (WizardDialog) getWizard().getContainer();

        dialog.setMinimumPageSize(700, 300);
    }//from   ww  w .  j av  a 2s. c  o m

    super.setVisible(visible);

    if (visible && projectViewer.getInput() == null) {
        Display.getDefault().asyncExec(new Runnable() {
            public void run() {
                populateProjectViewer();
            }
        });
    }
}

From source file:com.google.gwt.eclipse.core.markers.quickfixes.CreateAsyncInterfaceProposal.java

License:Open Source License

@Override
public void apply(IDocument document) {
    StructuredSelection selection = new StructuredSelection(compilationUnit);
    NewElementWizard wizard = createWizard(selection);
    wizard.init(JavaPlugin.getDefault().getWorkbench(), selection);

    IType localCreatedType = null;//from  w  w w.jav  a 2s  . c o  m

    if (isShowDialog()) {
        Shell shell = JavaPlugin.getActiveWorkbenchShell();
        WizardDialog dialog = new WizardDialog(shell, wizard);

        IPixelConverter converter = PixelConverterFactory.createPixelConverter(JFaceResources.getDialogFont());
        dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70),
                converter.convertHeightInCharsToPixels(20));
        dialog.create();
        dialog.getShell().setText(NewAsyncRemoteServiceInterfaceCreationWizard.DEFAULT_WINDOW_TITLE);

        if (dialog.open() == Window.OK) {
            localCreatedType = (IType) wizard.getCreatedElement();
        }
    } else {
        wizard.addPages();
        try {
            NewTypeWizardPage page = getPage(wizard);
            page.createType(null);
            localCreatedType = page.getCreatedType();
        } catch (CoreException e) {
            JavaPlugin.log(e);
        } catch (InterruptedException e) {
        }
    }

    if (localCreatedType != null) {
        IJavaElement container = localCreatedType.getParent();
        if (container instanceof ICompilationUnit) {
            container = container.getParent();
        }

        if (!container.equals(typeContainer)) {
            // add import
            try {
                ImportRewrite rewrite = StubUtility.createImportRewrite(compilationUnit, true);
                rewrite.addImport(localCreatedType.getFullyQualifiedName('.'));
                JavaModelUtil.applyEdit(compilationUnit, rewrite.rewriteImports(null), false, null);
            } catch (CoreException e) {
            }
        }
        this.createdType = localCreatedType;
    }
}