use of org.eclipse.wst.server.ui.wizard.WizardFragment in project webtools.servertools by eclipse.
the class TaskWizard method performCancel.
/**
* Cancel the client selection.
*
* @return boolean
*/
public boolean performCancel() {
final List list = getAllWizardFragments();
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
Iterator iterator = list.iterator();
while (iterator.hasNext()) executeTask((WizardFragment) iterator.next(), CANCEL, monitor);
} catch (CoreException ce) {
throw new InvocationTargetException(ce);
}
}
};
Throwable t = null;
try {
if (getContainer() != null)
getContainer().run(true, true, runnable);
else
runnable.run(new NullProgressMonitor());
return true;
} catch (InvocationTargetException te) {
t = te.getCause();
} catch (Exception e) {
t = e;
}
if (Trace.SEVERE) {
Trace.trace(Trace.STRING_SEVERE, "Error cancelling task wizard", t);
}
if (t instanceof CoreException) {
EclipseUtil.openError(t.getLocalizedMessage(), ((CoreException) t).getStatus());
} else
EclipseUtil.openError(t.getLocalizedMessage());
return false;
}
use of org.eclipse.wst.server.ui.wizard.WizardFragment 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);
}
}
use of org.eclipse.wst.server.ui.wizard.WizardFragment in project webtools.servertools by eclipse.
the class NewManualServerComposite method refreshExtension.
public boolean refreshExtension() {
if (!(oldServerType instanceof ServerTypeProxy))
return true;
final ServerTypeProxy finalServerType = (ServerTypeProxy) oldServerType;
try {
wizard.run(true, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
ErrorMessage errorMsg = Discovery.refreshExtension(finalServerType.getExtension(), finalServerType.getURI(), monitor);
if (errorMsg != null) {
final ErrorMessage errorMsgFinal = errorMsg;
Display.getDefault().asyncExec(new Runnable() {
public void run() {
canProceed = false;
wizard.setMessage(errorMsgFinal.getErrorTitle(), IMessageProvider.ERROR);
WizardFragment fragment2 = ServerUIPlugin.getWizardFragment(finalServerType.getId());
if (fragment2 != null) {
TaskModel taskModel = fragment2.getTaskModel();
taskModel.putObject(LicenseWizardFragment.LICENSE, errorMsgFinal.getErrorDescription());
taskModel.putObject(LicenseWizardFragment.LICENSE_ERROR, new Integer(IMessageProvider.ERROR));
}
wizard.update();
}
});
} else {
WizardFragment fragment2 = ServerUIPlugin.getWizardFragment(finalServerType.getId());
if (fragment2 != null) {
TaskModel taskModel = fragment2.getTaskModel();
taskModel.putObject(LicenseWizardFragment.LICENSE, Discovery.getLicenseText(finalServerType.getExtension()));
taskModel.putObject(LicenseWizardFragment.LICENSE_ERROR, new Integer(IMessageProvider.NONE));
}
}
}
});
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
return true;
}
use of org.eclipse.wst.server.ui.wizard.WizardFragment in project webtools.servertools by eclipse.
the class NewManualServerComposite method showDownloadableServerWizard.
protected boolean showDownloadableServerWizard(ServerTypeProxy serverType, IProgressMonitor monitor) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
wizard.setMessage(Messages.downLoadableAdapterDescription, IMessageProvider.INFORMATION);
}
});
WizardFragment fragment2 = ServerUIPlugin.getWizardFragment(serverType.getId());
if (fragment2 == null)
return false;
TaskModel taskModel = fragment2.getTaskModel();
if (taskModel == null)
taskModel = new TaskModel();
taskModel.putObject(TaskModel.TASK_EXTENSION, serverType.getExtension());
taskModel.putObject(TaskModel.TASK_RUNTIME, serverType.getRuntimeType());
taskModel.putObject(TaskModel.TASK_SERVER, serverType);
fragment2.setTaskModel(taskModel);
return true;
}
use of org.eclipse.wst.server.ui.wizard.WizardFragment in project webtools.servertools by eclipse.
the class NewManualServerComposite method showRuntimeWizard.
protected int showRuntimeWizard(IServerType serverType) {
WizardFragment fragment = null;
TaskModel taskModel = new TaskModel();
IRuntimeType runtimeType = serverType.getRuntimeType();
final WizardFragment fragment2 = ServerUIPlugin.getWizardFragment(runtimeType.getId());
if (fragment2 == null)
return Window.CANCEL;
try {
IRuntimeWorkingCopy runtimeWorkingCopy = runtimeType.createRuntime(null, null);
taskModel.putObject(TaskModel.TASK_RUNTIME, runtimeWorkingCopy);
} catch (CoreException ce) {
if (Trace.SEVERE) {
Trace.trace(Trace.STRING_SEVERE, "Error creating runtime", ce);
}
return Window.CANCEL;
}
fragment = new WizardFragment() {
protected void createChildFragments(List<WizardFragment> list) {
list.add(fragment2);
list.add(WizardTaskUtil.SaveRuntimeFragment);
}
};
TaskWizard wizard2 = new TaskWizard(Messages.wizNewRuntimeWizardTitle, fragment, taskModel);
wizard2.setForcePreviousAndNextButtons(true);
WizardDialog dialog = new WizardDialog(getShell(), wizard2);
int returnValue = dialog.open();
if (returnValue != Window.CANCEL) {
updateRuntimeCombo(serverType);
IRuntime rt = (IRuntime) taskModel.getObject(TaskModel.TASK_RUNTIME);
if (rt != null && rt.getName() != null && runtimeCombo.indexOf(rt.getName()) != -1) {
setRuntime(rt);
runtimeCombo.select(runtimeCombo.indexOf(rt.getName()));
}
}
return returnValue;
}
Aggregations