Example usage for org.eclipse.jface.wizard WizardPage getShell

List of usage examples for org.eclipse.jface.wizard WizardPage getShell

Introduction

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

Prototype

@Override
public Shell getShell() 

Source Link

Document

The WizardPage implementation of this method declared on DialogPage returns the shell of the container.

Usage

From source file:com.android.ide.eclipse.adt.internal.wizards.exportgradle.GradleExportWizard.java

License:Open Source License

/**
 * Converts Eclipse Java projects to Gradle build files. Displays error dialogs.
 *///from   w w w.j a  v a2s .c  o m
public boolean generateBuildfiles(final WizardPage page) {
    IRunnableWithProgress runnable = new IRunnableWithProgress() {
        @Override
        public void run(IProgressMonitor pm) throws InterruptedException {
            Collection<GradleModule> modules = mBuilder.getModules();
            final int count = modules.size();

            SubMonitor localmonitor = SubMonitor.convert(pm, ExportMessages.StatusMessage, count);
            BuildFileCreator.createBuildFiles(mBuilder, page.getShell(), localmonitor.newChild(count));
        }
    };

    try {
        getContainer().run(false, false, runnable);
    } catch (InvocationTargetException e) {
        AdtPlugin.log(e, null);
        return false;
    } catch (InterruptedException e) {
        AdtPlugin.log(e, null);
        return false;
    }
    if (page.getErrorMessage() != null) {
        return false;
    }
    return true;
}

From source file:nz.co.senanque.madura.wizards.RuleNewWizardPage.java

License:Open Source License

/**
 * @see IDialogPage#createControl(Composite)
 *//* www  . j a v a 2s . c o  m*/
public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    container.setLayout(layout);
    layout.numColumns = 3;
    layout.verticalSpacing = 9;
    Label label = new Label(container, SWT.NULL);
    label.setText("&Container:");

    containerText = new Text(container, SWT.BORDER | SWT.SINGLE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    containerText.setLayoutData(gd);
    containerText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });

    Button button = new Button(container, SWT.PUSH);
    button.setText("Browse...");
    WizardPage me = this;
    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            handleBrowse();
        }
    });
    label = new Label(container, SWT.NULL);
    label.setText("&File name:");

    fileText = new Text(container, SWT.BORDER | SWT.SINGLE);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    fileText.setLayoutData(gd);
    fileText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });

    label = new Label(container, SWT.NULL);
    label.setText("");//dummy label to hack layout
    label = new Label(container, SWT.NULL);
    label.setText("&XSD File name:");

    xsdFileText = new Text(container, SWT.BORDER | SWT.SINGLE);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    xsdFileText.setLayoutData(gd);
    xsdFileText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });
    Button xsdbutton = new Button(container, SWT.PUSH);
    xsdbutton.setText("Browse...");
    xsdbutton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            Utils.handleBrowse(xsdFileText, resource, me.getShell());
        }
    });
    initialize();
    dialogChanged();
    setControl(container);
}

From source file:nz.co.senanque.madura.wizards.WorkflowNewWizardPage.java

License:Open Source License

/**
 * @see IDialogPage#createControl(Composite)
 *///from w w w. j  a v  a  2s  . co  m
public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    container.setLayout(layout);
    layout.numColumns = 3;
    layout.verticalSpacing = 9;
    Label label = new Label(container, SWT.NULL);
    label.setText("&Container:");

    containerText = new Text(container, SWT.BORDER | SWT.SINGLE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    containerText.setLayoutData(gd);
    containerText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });

    Button button = new Button(container, SWT.PUSH);
    button.setText("Browse...");
    WizardPage me = this;
    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            handleBrowse();
        }
    });
    label = new Label(container, SWT.NULL);
    label.setText("&File name:");

    fileText = new Text(container, SWT.BORDER | SWT.SINGLE);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    fileText.setLayoutData(gd);
    fileText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });
    label = new Label(container, SWT.NULL);
    label.setText("");//dummy label to hack layout
    label = new Label(container, SWT.NULL);
    label.setText("&XSD File name:");

    xsdFileText = new Text(container, SWT.BORDER | SWT.SINGLE);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    xsdFileText.setLayoutData(gd);
    xsdFileText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });
    Button xsdbutton = new Button(container, SWT.PUSH);
    xsdbutton.setText("Browse...");
    xsdbutton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            Utils.handleBrowse(xsdFileText, resource, me.getShell());
        }
    });
    initialize();
    dialogChanged();
    setControl(container);
}

From source file:org.eclipse.andmore.internal.wizards.exportgradle.GradleExportWizard.java

License:Open Source License

/**
 * Converts Eclipse Java projects to Gradle build files. Displays error dialogs.
 *///from   ww  w.  j  a v a 2s  .  co  m
public boolean generateBuildfiles(final WizardPage page) {
    IRunnableWithProgress runnable = new IRunnableWithProgress() {
        @Override
        public void run(IProgressMonitor pm) throws InterruptedException {
            Collection<GradleModule> modules = mBuilder.getModules();
            final int count = modules.size();

            SubMonitor localmonitor = SubMonitor.convert(pm, ExportMessages.StatusMessage, count);
            BuildFileCreator.createBuildFiles(mBuilder, page.getShell(), localmonitor.newChild(count));
        }
    };

    try {
        getContainer().run(false, false, runnable);
    } catch (InvocationTargetException e) {
        AndmoreAndroidPlugin.log(e, null);
        return false;
    } catch (InterruptedException e) {
        AndmoreAndroidPlugin.log(e, null);
        return false;
    }
    if (page.getErrorMessage() != null) {
        return false;
    }
    return true;
}

From source file:org.jboss.tools.openshift.internal.ui.server.WizardHandleAwareFragment.java

License:Open Source License

/**
 * Helper method to extract wizard container from the handle.
 * May return null, if composite is not yet created or if wizard is disposed.
 *
 * @return/*ww w  . j  a v a 2 s.c  om*/
 */
protected IWizardContainer getWizardContainer() {
    if (!(handle instanceof WizardPage)) {
        return null;
    }
    WizardPage page = (WizardPage) handle;
    if (page.getShell() == null || page.getShell().isDisposed()) {
        return null;
    }
    IWizard wizard = page.getWizard();
    return (wizard == null) ? null : wizard.getContainer();
}