use of org.eclipse.wst.server.core.internal.RuntimeWorkingCopy in project webtools.servertools by eclipse.
the class NewRuntimeWizardFragment method createChildFragments.
protected void createChildFragments(List<WizardFragment> list) {
if (getTaskModel() == null)
return;
Object runtime = getTaskModel().getObject(TaskModel.TASK_RUNTIME);
if (runtime == null)
return;
WizardFragment sub = null;
if (runtime instanceof IRuntimeWorkingCopy)
sub = getWizardFragment(((RuntimeWorkingCopy) runtime).getRuntimeType().getId());
else if (runtime instanceof RuntimeTypeWithServerProxy)
sub = getWizardFragment(((RuntimeTypeWithServerProxy) runtime).getId());
if (sub != null)
list.add(sub);
Object serverObj = getTaskModel().getObject(TaskModel.TASK_SERVER);
if (serverObj != null && serverObj instanceof IServerWorkingCopy) {
IServerWorkingCopy server = (IServerWorkingCopy) serverObj;
if (server.getServerType().hasServerConfiguration() && server instanceof ServerWorkingCopy) {
ServerWorkingCopy swc = (ServerWorkingCopy) server;
try {
if (runtime instanceof IRuntimeWorkingCopy) {
RuntimeWorkingCopy runtimeWorkingCopy = (RuntimeWorkingCopy) runtime;
if (runtimeWorkingCopy.getLocation() != null && !runtimeWorkingCopy.getLocation().isEmpty())
swc.importRuntimeConfiguration(runtimeWorkingCopy, null);
}
} catch (CoreException ce) {
// ignore
}
}
list.add(new WizardFragment() {
public void enter() {
IRuntimeWorkingCopy runtime2 = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
IServerWorkingCopy server2 = (IServerWorkingCopy) getTaskModel().getObject(TaskModel.TASK_SERVER);
server2.setRuntime(runtime2);
}
});
sub = getWizardFragment(server.getServerType().getId());
if (sub != null)
list.add(sub);
list.add(WizardTaskUtil.SaveServerFragment);
}
}
Aggregations