plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/GeronimoRuntimeWizardFragment.java [164:309]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
					browser.openURL(new URL(url));
				} catch (MalformedURLException e) {
					e.printStackTrace();
				} catch (PartInitException e) {
					e.printStackTrace();
				}
			}
		});
	}

    protected GeronimoRuntimeDelegate getGeronimoRuntime() {
        if (geronimoRuntime == null)
            geronimoRuntime = (GeronimoRuntimeDelegate) getRuntimeDelegate().getRuntime().loadAdapter(
                    GeronimoRuntimeDelegate.class, null);
        return geronimoRuntime;
    }

    protected void addInstallDirSection(Composite composite) {
        Label label = new Label(composite, SWT.NONE);
        label.setText(Messages.installDir);
        GridData data = new GridData();
        data.horizontalSpan = 3;
        label.setLayoutData(data);
        String tooltipLoc = Messages.bind(Messages.tooltipLoc, getRuntimeName());
        label.setToolTipText(tooltipLoc);

        installDir = new Text(composite, SWT.BORDER);

        IPath currentLocation = getRuntimeDelegate().getRuntimeWorkingCopy().getLocation();
        if (currentLocation != null) {
            installDir.setText(currentLocation.toOSString());
        }

        data = new GridData(GridData.FILL_HORIZONTAL);
        data.horizontalSpan = 2;
        installDir.setLayoutData(data);
        installDir.setToolTipText(tooltipLoc);
        installDir.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                getRuntimeDelegate().getRuntimeWorkingCopy().setLocation(new Path(installDir.getText()));
                validate();
            }
        });

        final Composite browseComp = composite;
        Button browse = SWTUtil.createButton(composite, Messages.browse);
        browse.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent se) {
                DirectoryDialog dialog = new DirectoryDialog(browseComp.getShell());
                dialog.setMessage(Messages.installDir);
                dialog.setFilterPath(installDir.getText());
                String selectedDirectory = dialog.open();
                if (selectedDirectory != null)
                    installDir.setText(selectedDirectory);
            }
        });
    }

    protected void addJRESelection(final Composite composite) {
        updateJREs();

        Label label = new Label(composite, SWT.NONE);
        label.setText(Messages.installedJRE);
        label.setLayoutData(new GridData());

        combo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
        combo.setItems(jreNames);
        GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
        combo.setLayoutData(data);

        combo.addSelectionListener(new SelectionListener() {
            public void widgetSelected(SelectionEvent e) {
                // if the first item in the list is selected, then pass null
                // to setVMInstall to use the default JRE.
                // otherwise the array list of JRE's is one off from what is
                // in the combo; subtract 1 from the selection to get the
                // correct JRE.
                int sel = combo.getSelectionIndex();
                IVMInstall vmInstall = null;
                if (sel > 0) {
                    vmInstall = (IVMInstall) installedJREs.get(sel - 1);
                }
                getRuntimeDelegate().setVMInstall(vmInstall);
                validate();
            }

            public void widgetDefaultSelected(SelectionEvent e) {
                widgetSelected(e);
            }
        });

        Button button = SWTUtil.createButton(composite, Messages.installedJREs);
        button.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                String currentVM = combo.getText();
                if (showPreferencePage(composite)) {
                    updateJREs();
                    combo.setItems(jreNames);
                    combo.setText(currentVM);
                    if (combo.getSelectionIndex() == -1)
                        combo.select(0);
                }
            }
        });

        if (getRuntimeDelegate() != null) {
            if (getRuntimeDelegate().isUsingDefaultJRE()) {
                combo.select(0);
            } else {
                combo.setText(getRuntimeDelegate().getVMInstall().getName());
            }
        }
    }

    protected boolean showPreferencePage(Composite composite) {
        PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager();
        IPreferenceNode node = manager.find("org.eclipse.jdt.ui.preferences.JavaBasePreferencePage").findSubNode(
                "org.eclipse.jdt.debug.ui.preferences.VMPreferencePage");
        PreferenceManager manager2 = new PreferenceManager();
        manager2.addToRoot(node);
        final PreferenceDialog dialog = new PreferenceDialog(composite.getShell(), manager2);
        final boolean[] result = new boolean[] { false };
        BusyIndicator.showWhile(composite.getDisplay(), new Runnable() {
            public void run() {
                dialog.create();
                if (dialog.open() == Window.OK)
                    result[0] = true;
            }
        });
        return result[0];
    }

    /*
     * (non-Javadoc)
     * 
     * @see org.eclipse.wst.server.ui.wizard.WizardFragment#isComplete()
     */
    public boolean isComplete() {
        IRuntimeWorkingCopy runtimeWC = getRuntimeDelegate().getRuntimeWorkingCopy();
        IStatus status = runtimeWC.validate(null);
        return status == null || status.getSeverity() != IStatus.ERROR;
    }

    protected void validate() {

        IRuntime runtime = getRuntimeDelegate().getRuntime();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/GeronimoRuntimeWizardFragment.java [163:308]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                    browser.openURL(new URL(url));
                } catch (MalformedURLException e) {
                    e.printStackTrace();
                } catch (PartInitException e) {
                    e.printStackTrace();
                }
            }
        });
    }

    protected GeronimoRuntimeDelegate getGeronimoRuntime() {
        if (geronimoRuntime == null)
            geronimoRuntime = (GeronimoRuntimeDelegate) getRuntimeDelegate().getRuntime().loadAdapter(
                    GeronimoRuntimeDelegate.class, null);
        return geronimoRuntime;
    }

    protected void addInstallDirSection(Composite composite) {
        Label label = new Label(composite, SWT.NONE);
        label.setText(Messages.installDir);
        GridData data = new GridData();
        data.horizontalSpan = 3;
        label.setLayoutData(data);
        String tooltipLoc = Messages.bind(Messages.tooltipLoc, getRuntimeName());
        label.setToolTipText(tooltipLoc);

        installDir = new Text(composite, SWT.BORDER);

        IPath currentLocation = getRuntimeDelegate().getRuntimeWorkingCopy().getLocation();
        if (currentLocation != null) {
            installDir.setText(currentLocation.toOSString());
        }

        data = new GridData(GridData.FILL_HORIZONTAL);
        data.horizontalSpan = 2;
        installDir.setLayoutData(data);
        installDir.setToolTipText(tooltipLoc);
        installDir.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                getRuntimeDelegate().getRuntimeWorkingCopy().setLocation(new Path(installDir.getText()));
                validate();
            }
        });

        final Composite browseComp = composite;
        Button browse = SWTUtil.createButton(composite, Messages.browse);
        browse.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent se) {
                DirectoryDialog dialog = new DirectoryDialog(browseComp.getShell());
                dialog.setMessage(Messages.installDir);
                dialog.setFilterPath(installDir.getText());
                String selectedDirectory = dialog.open();
                if (selectedDirectory != null)
                    installDir.setText(selectedDirectory);
            }
        });
    }

    protected void addJRESelection(final Composite composite) {
        updateJREs();

        Label label = new Label(composite, SWT.NONE);
        label.setText(Messages.installedJRE);
        label.setLayoutData(new GridData());

        combo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
        combo.setItems(jreNames);
        GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
        combo.setLayoutData(data);

        combo.addSelectionListener(new SelectionListener() {
            public void widgetSelected(SelectionEvent e) {
                // if the first item in the list is selected, then pass null
                // to setVMInstall to use the default JRE.
                // otherwise the array list of JRE's is one off from what is
                // in the combo; subtract 1 from the selection to get the
                // correct JRE.
                int sel = combo.getSelectionIndex();
                IVMInstall vmInstall = null;
                if (sel > 0) {
                    vmInstall = (IVMInstall) installedJREs.get(sel - 1);
                }
                getRuntimeDelegate().setVMInstall(vmInstall);
                validate();
            }

            public void widgetDefaultSelected(SelectionEvent e) {
                widgetSelected(e);
            }
        });

        Button button = SWTUtil.createButton(composite, Messages.installedJREs);
        button.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                String currentVM = combo.getText();
                if (showPreferencePage(composite)) {
                    updateJREs();
                    combo.setItems(jreNames);
                    combo.setText(currentVM);
                    if (combo.getSelectionIndex() == -1)
                        combo.select(0);
                }
            }
        });

        if (getRuntimeDelegate() != null) {
            if (getRuntimeDelegate().isUsingDefaultJRE()) {
                combo.select(0);
            } else {
                combo.setText(getRuntimeDelegate().getVMInstall().getName());
            }
        }
    }

    protected boolean showPreferencePage(Composite composite) {
        PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager();
        IPreferenceNode node = manager.find("org.eclipse.jdt.ui.preferences.JavaBasePreferencePage").findSubNode(
                "org.eclipse.jdt.debug.ui.preferences.VMPreferencePage");
        PreferenceManager manager2 = new PreferenceManager();
        manager2.addToRoot(node);
        final PreferenceDialog dialog = new PreferenceDialog(composite.getShell(), manager2);
        final boolean[] result = new boolean[] { false };
        BusyIndicator.showWhile(composite.getDisplay(), new Runnable() {
            public void run() {
                dialog.create();
                if (dialog.open() == Window.OK)
                    result[0] = true;
            }
        });
        return result[0];
    }

    /*
     * (non-Javadoc)
     * 
     * @see org.eclipse.wst.server.ui.wizard.WizardFragment#isComplete()
     */
    public boolean isComplete() {
        IRuntimeWorkingCopy runtimeWC = getRuntimeDelegate().getRuntimeWorkingCopy();
        IStatus status = runtimeWC.validate(null);
        return status == null || status.getSeverity() != IStatus.ERROR;
    }

    protected void validate() {

        IRuntime runtime = getRuntimeDelegate().getRuntime();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



