Search in sources :

Example 1 with IInstallableRuntime

use of org.eclipse.wst.server.core.internal.IInstallableRuntime in project webtools.servertools by eclipse.

the class InstallableRuntimeDecorator method decorate.

public void decorate(final GenericServerComposite composite) {
    final IInstallableRuntime ir = ServerPlugin.findInstallableRuntime(fRuntime.getRuntime().getRuntimeType().getId());
    Button install = SWTUtil.createButton(composite, GenericServerUIMessages.installServerButton);
    install.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent se) {
            DirectoryDialog dialog = new DirectoryDialog(composite.getShell());
            dialog.setMessage(GenericServerUIMessages.installationDirectory);
            final String selectedDirectory = dialog.open();
            if (selectedDirectory != null) {
                IRunnableWithProgress runnable = new IRunnableWithProgress() {

                    public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                        try {
                            ir.install(new Path(selectedDirectory), new NullProgressMonitor());
                        } catch (CoreException e) {
                            Trace.trace(Trace.SEVERE, "Error installing runtime", // $NON-NLS-1$
                            e);
                        }
                    }
                };
                try {
                    fWizard.run(true, false, runnable);
                } catch (Exception e) {
                    Trace.trace(Trace.SEVERE, "Error installing runtime", // $NON-NLS-1$
                    e);
                }
            }
        }
    });
}
Also used : Path(org.eclipse.core.runtime.Path) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) IInstallableRuntime(org.eclipse.wst.server.core.internal.IInstallableRuntime) InvocationTargetException(java.lang.reflect.InvocationTargetException) CoreException(org.eclipse.core.runtime.CoreException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) CoreException(org.eclipse.core.runtime.CoreException) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog)

Example 2 with IInstallableRuntime

use of org.eclipse.wst.server.core.internal.IInstallableRuntime in project webtools.servertools by eclipse.

the class GenericServerRuntimeWizardFragment method createContent.

public void createContent(Composite parent, IWizardHandle handle) {
    Map properties = null;
    ServerRuntime definition = null;
    if (getRuntimeDelegate() != null) {
        properties = getRuntimeDelegate().getServerInstanceProperties();
        definition = getServerTypeDefinition(getServerDefinitionId(), properties);
    }
    IInstallableRuntime ir = ServerPlugin.findInstallableRuntime(getRuntimeDelegate().getRuntime().getRuntimeType().getId());
    if (ir != null) {
        fDecorators = new GenericServerCompositeDecorator[3];
        fDecorators[0] = new JRESelectDecorator(getRuntimeDelegate(), getWizard());
        fDecorators[1] = new ServerTypeDefinitionRuntimeDecorator(definition, properties, getWizard(), getRuntimeDelegate());
        fDecorators[2] = new InstallableRuntimeDecorator(getWizard(), getRuntimeDelegate());
    } else {
        fDecorators = new GenericServerCompositeDecorator[2];
        fDecorators[0] = new JRESelectDecorator(getRuntimeDelegate(), getWizard());
        fDecorators[1] = new ServerTypeDefinitionRuntimeDecorator(definition, properties, getWizard(), getRuntimeDelegate());
    }
    new GenericServerComposite(parent, fDecorators);
}
Also used : ServerRuntime(org.eclipse.jst.server.generic.servertype.definition.ServerRuntime) GenericServerRuntime(org.eclipse.jst.server.generic.core.internal.GenericServerRuntime) IInstallableRuntime(org.eclipse.wst.server.core.internal.IInstallableRuntime) Map(java.util.Map)

Aggregations

IInstallableRuntime (org.eclipse.wst.server.core.internal.IInstallableRuntime)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Map (java.util.Map)1 CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 Path (org.eclipse.core.runtime.Path)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 GenericServerRuntime (org.eclipse.jst.server.generic.core.internal.GenericServerRuntime)1 ServerRuntime (org.eclipse.jst.server.generic.servertype.definition.ServerRuntime)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Button (org.eclipse.swt.widgets.Button)1 DirectoryDialog (org.eclipse.swt.widgets.DirectoryDialog)1