use of org.eclipse.wst.server.ui.wizard.WizardFragment in project liferay-ide by liferay.
the class CleanAppServerAction method showWizard.
protected int showWizard(IRuntimeWorkingCopy runtimeWorkingCopy) {
String title = Msgs.wizEditRuntimeWizardTitle;
WizardFragment fragment2 = ServerUIPlugin.getWizardFragment(runtimeWorkingCopy.getRuntimeType().getId());
if (fragment2 == null) {
return Window.CANCEL;
}
TaskModel taskModel = new TaskModel();
taskModel.putObject(TaskModel.TASK_RUNTIME, runtimeWorkingCopy);
WizardFragment fragment = new WizardFragment() {
protected void createChildFragments(List<WizardFragment> list) {
list.add((WizardFragment) fragment2.getChildFragments().get(0));
list.add(WizardTaskUtil.SaveRuntimeFragment);
}
};
TaskWizard wizard = new TaskWizard(title, fragment, taskModel);
wizard.setForcePreviousAndNextButtons(true);
WizardDialog dialog = new WizardDialog(getDisplay().getActiveShell(), wizard);
return dialog.open();
}
use of org.eclipse.wst.server.ui.wizard.WizardFragment in project webtools.servertools by eclipse.
the class TomcatRuntimeComposite method createControl.
/**
* Provide a wizard page to change the Tomcat installation directory.
*/
protected void createControl() {
GridLayout layout = new GridLayout();
layout.numColumns = 2;
setLayout(layout);
setLayoutData(new GridData(GridData.FILL_BOTH));
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ContextIds.RUNTIME_COMPOSITE);
Label label = new Label(this, SWT.NONE);
label.setText(Messages.runtimeName);
GridData data = new GridData();
data.horizontalSpan = 2;
label.setLayoutData(data);
name = new Text(this, SWT.BORDER);
data = new GridData(GridData.FILL_HORIZONTAL);
name.setLayoutData(data);
name.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
runtimeWC.setName(name.getText());
validate();
}
});
label = new Label(this, SWT.NONE);
label.setText(Messages.installDir);
data = new GridData();
data.horizontalSpan = 2;
label.setLayoutData(data);
installDir = new Text(this, SWT.BORDER);
data = new GridData(GridData.FILL_HORIZONTAL);
installDir.setLayoutData(data);
installDir.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
runtimeWC.setLocation(new Path(installDir.getText()));
validate();
}
});
Button browse = SWTUtil.createButton(this, Messages.browse);
browse.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent se) {
DirectoryDialog dialog = new DirectoryDialog(TomcatRuntimeComposite.this.getShell());
dialog.setMessage(Messages.selectInstallDir);
dialog.setFilterPath(installDir.getText());
String selectedDirectory = dialog.open();
if (selectedDirectory != null)
installDir.setText(selectedDirectory);
}
});
installLabel = new Label(this, SWT.RIGHT);
data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalIndent = 10;
installLabel.setLayoutData(data);
install = SWTUtil.createButton(this, Messages.install);
install.setEnabled(false);
install.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent se) {
String license = null;
try {
license = ir.getLicense(new NullProgressMonitor());
} catch (CoreException e) {
Trace.trace(Trace.SEVERE, "Error getting license", e);
}
TaskModel taskModel = new TaskModel();
taskModel.putObject(LicenseWizardFragment.LICENSE, license);
TaskWizard wizard2 = new TaskWizard(Messages.installDialogTitle, new WizardFragment() {
protected void createChildFragments(List list) {
list.add(new LicenseWizardFragment());
}
}, taskModel);
WizardDialog dialog2 = new WizardDialog(getShell(), wizard2);
if (dialog2.open() == Window.CANCEL)
return;
DirectoryDialog dialog = new DirectoryDialog(TomcatRuntimeComposite.this.getShell());
dialog.setMessage(Messages.selectInstallDir);
dialog.setFilterPath(installDir.getText());
String selectedDirectory = dialog.open();
if (selectedDirectory != null) {
// ir.install(new Path(selectedDirectory));
final IPath installPath = new Path(selectedDirectory);
installRuntimeJob = new Job("Installing server runtime environment") {
public boolean belongsTo(Object family) {
return ServerPlugin.PLUGIN_ID.equals(family);
}
protected IStatus run(IProgressMonitor monitor) {
try {
ir.install(installPath, monitor);
} catch (CoreException ce) {
return ce.getStatus();
}
return Status.OK_STATUS;
}
};
installDir.setText(selectedDirectory);
jobListener = new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
installRuntimeJob.removeJobChangeListener(this);
installRuntimeJob = null;
Display.getDefault().asyncExec(new Runnable() {
public void run() {
if (!isDisposed()) {
validate();
}
}
});
}
};
installRuntimeJob.addJobChangeListener(jobListener);
installRuntimeJob.schedule();
}
}
});
updateJREs();
// JDK location
label = new Label(this, SWT.NONE);
label.setText(Messages.installedJRE);
data = new GridData();
data.horizontalSpan = 2;
label.setLayoutData(data);
combo = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);
combo.setItems(jreNames);
data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
combo.setLayoutData(data);
combo.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
int sel = combo.getSelectionIndex();
IVMInstall vmInstall = null;
if (sel > 0)
vmInstall = (IVMInstall) installedJREs.get(sel - 1);
runtime.setVMInstall(vmInstall);
validate();
}
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
Button button = SWTUtil.createButton(this, Messages.installedJREs);
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
String currentVM = combo.getText();
if (showPreferencePage()) {
updateJREs();
combo.setItems(jreNames);
combo.setText(currentVM);
if (combo.getSelectionIndex() == -1)
combo.select(0);
validate();
}
}
});
init();
validate();
Dialog.applyDialogFont(this);
name.forceFocus();
}
use of org.eclipse.wst.server.ui.wizard.WizardFragment in project webtools.servertools by eclipse.
the class ServerUIPlugin method showNewServerWizard.
/**
* Open the new server wizard.
*
* @param shell a shell
* @param typeId a module type id, or null for any module type
* @param versionId a module version, or null for any version
* @param serverTypeId a server runtime type, or null for any type
* @return <code>true</code> if a server was created, or
* <code>false</code> otherwise
*/
public static boolean showNewServerWizard(Shell shell, final String typeId, final String versionId, final String serverTypeId) {
WizardFragment fragment = new WizardFragment() {
protected void createChildFragments(List<WizardFragment> list) {
list.add(new NewServerWizardFragment(new ModuleType(typeId, versionId), serverTypeId));
list.add(WizardTaskUtil.TempSaveRuntimeFragment);
list.add(WizardTaskUtil.TempSaveServerFragment);
list.add(new ModifyModulesWizardFragment());
list.add(new TasksWizardFragment());
list.add(WizardTaskUtil.SaveRuntimeFragment);
list.add(WizardTaskUtil.SaveServerFragment);
list.add(WizardTaskUtil.SaveHostnameFragment);
}
};
TaskWizard wizard = new TaskWizard(Messages.wizNewServerWizardTitle, fragment);
wizard.setForcePreviousAndNextButtons(true);
WizardDialog dialog = new WizardDialog(shell, wizard);
return (dialog.open() == IDialogConstants.OK_ID);
}
use of org.eclipse.wst.server.ui.wizard.WizardFragment in project webtools.servertools by eclipse.
the class RuntimePreferencePage method showWizard.
protected int showWizard(final IRuntimeWorkingCopy runtimeWorkingCopy) {
String title = null;
WizardFragment fragment = null;
TaskModel taskModel = new TaskModel();
if (runtimeWorkingCopy == null) {
title = Messages.wizNewRuntimeWizardTitle;
fragment = new WizardFragment() {
protected void createChildFragments(List<WizardFragment> list) {
list.add(new NewRuntimeWizardFragment());
list.add(WizardTaskUtil.SaveRuntimeFragment);
}
};
} else {
title = Messages.wizEditRuntimeWizardTitle;
final WizardFragment fragment2 = ServerUIPlugin.getWizardFragment(runtimeWorkingCopy.getRuntimeType().getId());
if (fragment2 == null) {
edit.setEnabled(false);
return Window.CANCEL;
}
taskModel.putObject(TaskModel.TASK_RUNTIME, runtimeWorkingCopy);
fragment = new WizardFragment() {
protected void createChildFragments(List<WizardFragment> list) {
list.add(fragment2);
list.add(WizardTaskUtil.SaveRuntimeFragment);
}
};
}
TaskWizard wizard = new TaskWizard(title, fragment, taskModel);
wizard.setForcePreviousAndNextButtons(true);
WizardDialog dialog = new WizardDialog(getShell(), wizard);
return dialog.open();
}
use of org.eclipse.wst.server.ui.wizard.WizardFragment in project webtools.servertools by eclipse.
the class ServerUIPlugin method showNewRuntimeWizard.
/**
* Open the new runtime wizard.
*
* @param shell a shell
* @param type a module type id
* @param version a module version id
* @param runtimeTypeId a runtime type id
* @return true if a new runtime was created
*/
public static boolean showNewRuntimeWizard(Shell shell, final String type, final String version, final String runtimeTypeId) {
WizardFragment fragment = new WizardFragment() {
protected void createChildFragments(List<WizardFragment> list) {
list.add(new NewRuntimeWizardFragment(type, version, runtimeTypeId));
list.add(WizardTaskUtil.SaveRuntimeFragment);
}
};
TaskWizard wizard = new TaskWizard(Messages.wizNewRuntimeWizardTitle, fragment);
wizard.setForcePreviousAndNextButtons(true);
WizardDialog dialog = new WizardDialog(shell, wizard);
return (dialog.open() == IDialogConstants.OK_ID);
}
Aggregations