Example usage for org.eclipse.jface.wizard IWizard getContainer

List of usage examples for org.eclipse.jface.wizard IWizard getContainer

Introduction

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

Prototype

IWizardContainer getContainer();

Source Link

Document

Returns the container of this wizard.

Usage

From source file:ch.hsr.ifs.cutelauncher.ui.CuteLibWizardHandler.java

License:Open Source License

public CuteLibWizardHandler(Composite p, IWizard w) {

    super(p, w);/*w  ww.  j a  v a 2  s .  c  o  m*/
    libRefPage = new LibReferencePage(getConfigPage(), getStartingPage(), w.getContainer());
    libRefPage.setPreviousPage(getStartingPage());
    libRefPage.setWizard(getWizard());
    MBSCustomPageManager.init();
    MBSCustomPageManager.addStockPage(libRefPage, libRefPage.getPageID());
}

From source file:cn.dockerfoundry.ide.eclipse.server.ui.internal.CloudUiUtil.java

License:Open Source License

public static IStatus runForked(final ICoreRunnable coreRunner, IWizard wizard) {
    try {/* ww  w.j  a va 2 s. c  om*/
        IRunnableWithProgress runner = new IRunnableWithProgress() {
            public void run(final IProgressMonitor monitor)
                    throws InvocationTargetException, InterruptedException {
                try {
                    coreRunner.run(monitor);
                } catch (Exception e) {
                    throw new InvocationTargetException(e);
                } finally {
                    monitor.done();
                }
            }
        };
        wizard.getContainer().run(true, false, runner);
    } catch (InvocationTargetException e) {
        IStatus status;
        if (e.getCause() instanceof CoreException) {
            status = new Status(IStatus.ERROR, DockerFoundryServerUiPlugin.PLUGIN_ID,
                    NLS.bind(Messages.CloudUiUtil_ERROR_FORK_OP_FAILED, e.getCause().getMessage()), e);
        } else {
            status = new Status(IStatus.ERROR, DockerFoundryServerUiPlugin.PLUGIN_ID,
                    NLS.bind(Messages.CloudUiUtil_ERROR_FORK_UNEXPECTED, e.getMessage()), e);
        }
        DockerFoundryServerUiPlugin.getDefault().getLog().log(status);
        IWizardPage page = wizard.getContainer().getCurrentPage();
        if (page instanceof DialogPage) {
            ((DialogPage) page).setErrorMessage(status.getMessage());
        }
        return status;
    } catch (InterruptedException e) {
        return Status.CANCEL_STATUS;
    }
    return Status.OK_STATUS;
}

From source file:com.android.ide.eclipse.adt.internal.wizards.templates.InstallDependencyPage.java

License:Open Source License

private void showNextPage() {
    validatePage();// w  w  w . j a va2s.  co m
    if (isPageComplete()) {
        // Finish button will be enabled now
        mInstallButton.setEnabled(false);
        mCheckButton.setEnabled(false);

        IWizard wizard = getWizard();
        IWizardPage next = wizard.getNextPage(this);
        if (next != null) {
            wizard.getContainer().showPage(next);
        }
    }
}

From source file:com.aptana.editor.common.internal.scripting.WizardNewFilePage.java

License:Open Source License

protected InputStream getInitialContents() {
    IWizard wizard = getWizard();
    TemplateSelectionPage templateSelectionPage = (TemplateSelectionPage) wizard
            .getPage(NewFileWizard.TEMPLATE_PAGE_NAME);
    if (wizard.getContainer().getCurrentPage() == templateSelectionPage) {
        String templateContent = NewFileWizard.getTemplateContent(templateSelectionPage.getSelectedTemplate(),
                getContainerFullPath().append(getFileName()));
        if (templateContent != null) {
            return new ReaderInputStream(new StringReader(templateContent), IOUtil.UTF_8);
        }/*w  w w . j av a2s. co m*/
    }
    return super.getInitialContents();
}

From source file:com.google.cloud.tools.eclipse.appengine.newproject.maven.MavenAppEngineStandardWizardPageTest.java

License:Apache License

@Before
public void setUp() {
    IWizard wizard = mock(IWizard.class);
    when(wizard.getContainer()).thenReturn(mock(IWizardContainer.class));
    page.setWizard(wizard);/*from  w w w.  j av  a 2s  . com*/
    page.createControl(shellTestResource.getShell());
}

From source file:com.google.dart.tools.ui.internal.refactoring.WizardPageOptionsHelper.java

License:Open Source License

private void runInUI() {
    IWizard wizard = page.getWizard();
    if (wizard != null) {
        IWizardContainer container = wizard.getContainer();
        if (container != null) {
            page.setPageComplete(optionsStatus);
            container.updateButtons();/*ww  w  .  j  a  v  a 2 s.  c  om*/
        }
    }
}

From source file:com.liferay.ide.server.tomcat.ui.wizard.LiferayTomcatRuntimeComposite.java

License:Open Source License

protected void createFields() {
    nameField = createTextField(Msgs.name);
    nameField.addModifyListener(this);

    dirField = createTextField(Msgs.liferayTomcatDirectory);
    dirField.addModifyListener(this);

    SWTUtil.createButton(this, Msgs.browse).addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dd = new DirectoryDialog(LiferayTomcatRuntimeComposite.this.getShell());

            dd.setMessage(Msgs.selectLiferayTomcatDirectory);
            dd.setFilterPath(dirField.getText());

            String selectedDir = dd.open();

            if (selectedDir != null) {
                dirField.setText(selectedDir);
            }/*w w  w . ja  va2 s  .  co m*/
        }
    });

    installLabel = new Label(this, SWT.RIGHT);

    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalIndent = 10;

    installLabel.setLayoutData(data);

    install = SWTUtil.createButton(this, Msgs.install);
    install.setVisible(false);

    jreLabel = createLabel(Msgs.selecteRuntimeJRE);

    jreCombo = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);
    jreCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    jreCombo.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            int sel = jreCombo.getSelectionIndex();

            IVMInstall vmInstall = null;

            if (sel > 0) {
                vmInstall = (IVMInstall) installedJREs.get(sel - 1);
            }

            getTomcatRuntime().setVMInstall(vmInstall);

            validate();
        }
    });

    jreButton = SWTUtil.createButton(this, Msgs.installedJREs);
    jreButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (SWTUtil.showPreferencePage("org.eclipse.jdt.debug.ui.preferences.VMPreferencePage", getShell())) //$NON-NLS-1$
            {
                updateJREs();
                validate();
            }
        }

    });

    Link link = createLink(Msgs.seeAdditionalConfigurationPage);
    link.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (wizard instanceof IWizardPage) {
                IWizard parentWizard = ((IWizardPage) wizard).getWizard();
                parentWizard.getContainer().showPage(((IWizardPage) wizard).getNextPage());
            }
        }

    });
}

From source file:de.bmw.yamaica.common.ui.internal.dialogs.LaunchConfigurationSelectionPage.java

License:Mozilla Public License

@Override
public void createControl(Composite parent) {
    Font font = parent.getFont();

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(1, false));
    setControl(composite);//from   w w w.  j  a v  a2  s  .  co m

    viewerToolBar = new ViewerToolBar(composite, SWT.BORDER, ViewerToolBar.FILTER) {
        @Override
        protected void createToolBarButtons() {
            toolBarManager.add(newAction);
            toolBarManager.add(duplicateAction);
            toolBarManager.add(deleteAction);
            toolBarManager.add(new Separator());
            toolBarManager.add(editAction);

            super.createToolBarButtons();
        }
    };
    viewerToolBar.setLayoutData(new GridData(GridData.FILL_BOTH));
    viewerToolBar.setFilterText(FILTER_LAUNCH_CONFIGURATIONS);

    Table table = new Table(viewerToolBar, SWT.MULTI | SWT.FULL_SELECTION);
    table.setLayoutData(new GridData(GridData.FILL_BOTH));
    table.setFont(font);
    table.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            Table table = (Table) e.widget;
            table.getColumn(0).setWidth(table.getClientArea().width);
        }
    });

    tableViewer = new TableViewer(table);
    tableViewer.setContentProvider(getContentProvider());
    tableViewer.setComparator(new WorkbenchViewerComparator());
    tableViewer.addFilter(viewerFilter);

    TableViewerColumn launchConfigurationTypeViewerColumn = new TableViewerColumn(tableViewer, SWT.LEAD);
    launchConfigurationTypeViewerColumn.setLabelProvider((CellLabelProvider) getLabelProvider());

    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();

            if (!selection.isEmpty()) {
                if (selection.size() == 1) {
                    duplicateAction.setEnabled(true);
                    editAction.setEnabled(true);
                } else {
                    duplicateAction.setEnabled(false);
                    editAction.setEnabled(false);
                }

                deleteAction.setEnabled(true);
            } else {
                duplicateAction.setEnabled(false);
                deleteAction.setEnabled(false);
                editAction.setEnabled(false);
            }

            getContainer().updateButtons();
        }
    });

    tableViewer.addDoubleClickListener(new IDoubleClickListener() {
        @Override
        public void doubleClick(DoubleClickEvent event) {
            IWizard wizard = getWizard();
            IWizardContainer container = wizard.getContainer();

            if (container instanceof WizardDialog) {
                if (wizard.performFinish()) {
                    ((WizardDialog) container).close();
                }
            }
        }
    });

    viewerToolBar.setViewer(tableViewer);

    restoreWidgetValues();

    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
            Activator.PLUGIN_ID + YamaicaUIConstants.YAMAICA_TRANSFORM_TYPE_SELECTION);
}

From source file:org.bonitasoft.studio.swt.rules.RealmWithDisplay.java

License:Open Source License

public IWizard wizardWithContainer() {
    final IWizard wizard = mock(IWizard.class);
    final IWizardContainer wizardContainer = mock(IWizardContainer.class);
    when(wizardContainer.getShell()).thenReturn(getShell());
    when(wizard.getContainer()).thenReturn(wizardContainer);
    return wizard;
}

From source file:org.cloudfoundry.ide.eclipse.internal.server.ui.CloudUiUtil.java

License:Open Source License

public static IStatus runForked(final ICoreRunnable coreRunner, IWizard wizard) {
    try {//from   w w w  .j  a  v  a2 s .  c o m
        IRunnableWithProgress runner = new IRunnableWithProgress() {
            public void run(final IProgressMonitor monitor)
                    throws InvocationTargetException, InterruptedException {
                try {
                    coreRunner.run(monitor);
                } catch (Exception e) {
                    throw new InvocationTargetException(e);
                } finally {
                    monitor.done();
                }
            }
        };
        wizard.getContainer().run(true, false, runner);
    } catch (InvocationTargetException e) {
        IStatus status;
        if (e.getCause() instanceof CoreException) {
            status = new Status(IStatus.ERROR, CloudFoundryServerUiPlugin.PLUGIN_ID,
                    NLS.bind("The operation failed: {0}", e.getCause().getMessage()), e);
        } else {
            status = new Status(IStatus.ERROR, CloudFoundryServerUiPlugin.PLUGIN_ID,
                    NLS.bind("Unexpected error: {0}", e.getMessage()), e);
        }
        CloudFoundryServerUiPlugin.getDefault().getLog().log(status);
        IWizardPage page = wizard.getContainer().getCurrentPage();
        if (page instanceof DialogPage) {
            ((DialogPage) page).setErrorMessage(status.getMessage());
        }
        return status;
    } catch (InterruptedException e) {
        return Status.CANCEL_STATUS;
    }
    return Status.OK_STATUS;
}