IRuntime runtime = getRuntimeDelegate().getRuntime();
String runtimeName = runtime.getRuntimeType().getName();
IWizardHandle wizard = getWizard();
if (runtime == null) {
wizard.setMessage("", IMessageProvider.ERROR);
return;
}
IRuntimeWorkingCopy runtimeWC = getRuntimeDelegate().getRuntimeWorkingCopy();
getRuntimeDelegate().setInstanceProperty("serverRootDirectory", installDir.getText());
if (installDir.getText() == null || installDir.getText().length() == 0) {
// installDir field has not been entered
wizard.setMessage(Messages.bind(Messages.installDirInfo, runtimeName), IMessageProvider.NONE);
} else {
IStatus status = runtimeWC.validate(null);
if (status == null || status.isOK()) {
// a valid install found
wizard.setMessage(Messages.bind(Messages.serverDetected, runtimeName), IMessageProvider.NONE);
} else if (status.getCode() == GeronimoRuntimeDelegate.INCORRECT_VERSION) {
if (status.getSeverity() == IStatus.ERROR) {
wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
return;
}
wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
} else if (status.getCode() == GeronimoRuntimeDelegate.PARTIAL_IMAGE) {
wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
return;
} else {
File file = new Path(installDir.getText()).toFile();
if (file.isDirectory()) {
String message = file.canWrite() ? Messages.noImageFound : Messages.cannotInstallAtLocation;
message = Messages.bind(message, runtimeName);
wizard.setMessage(message, IMessageProvider.ERROR);
} else {
wizard.setMessage(Messages.noSuchDir, IMessageProvider.ERROR);
}
return;
}
if (!isValidVM()) {
wizard.setMessage(Messages.bind(Messages.jvmWarning, runtimeName), IMessageProvider.WARNING);
}
}
}