use of com.liferay.ide.server.tomcat.core.LiferayTomcatRuntime in project liferay-ide by liferay.
the class LiferayTomcatRuntimeComposite method modifyText.
public void modifyText(ModifyEvent e) {
if (ignoreModifyEvent) {
ignoreModifyEvent = false;
return;
}
if (e.getSource().equals(dirField)) {
getRuntime().setLocation(new Path(dirField.getText()));
} else if (e.getSource().equals(nameField)) {
getRuntime().setName(nameField.getText());
}
validate();
IStatus status = getRuntime().validate(null);
if (!status.isOK() && e.getSource().equals(dirField)) {
// check to see if we need to modify from a liferay folder down to embedded tomcat
IPath currentLocation = getRuntime().getLocation();
IPath modifiedLocation = LiferayTomcatUtil.modifyLocationForBundle(currentLocation);
if (modifiedLocation != null) {
getRuntime().setLocation(modifiedLocation);
status = getRuntime().validate(null);
if (status.isOK()) {
ignoreModifyEvent = true;
dirField.setText(modifiedLocation.toOSString());
validate();
}
}
}
enableJREControls(true);
if (getTomcatRuntime().getVMInstall() != null) {
// check to see if selected VM is in same path as new server location
IVMInstall vmInstaller = getTomcatRuntime().getVMInstall();
IPath vmLoc = new Path(vmInstaller.getInstallLocation().getPath());
IPath runtimeLoc = getRuntime().getLocation();
if ((runtimeLoc != null) && !runtimeLoc.isPrefixOf(vmLoc)) {
// we have a jre that is outside the runtime location, need to look for new bundled JRE
LiferayTomcatRuntime runtime = (LiferayTomcatRuntime) getTomcatRuntime();
IVMInstall newVM = runtime.findPortalBundledJRE(true);
if (newVM != null) {
runtime.setVMInstall(newVM);
}
}
updateJREs();
}
}
use of com.liferay.ide.server.tomcat.core.LiferayTomcatRuntime in project liferay-ide by liferay.
the class ServerNameChangeTests method setup62Runtime.
private String setup62Runtime(IPath runtimeZipPath, IPath runitmeDirPath, String runtimeName, IPath runtimUnzipDir, String runtimeId) throws Exception {
assertEquals("Expected liferayBundlesPath to exist: " + runtimeZipPath.toOSString(), true, runtimeZipPath.toFile().exists());
extractLiferayRuntime(runtimeZipPath, runtimUnzipDir);
final NullProgressMonitor npm = new NullProgressMonitor();
IRuntime findRuntime = ServerCore.findRuntime(runtimeName);
if (findRuntime == null) {
final IRuntimeWorkingCopy runtimeWC = ServerCore.findRuntimeType(runtimeId).createRuntime(runtimeName, npm);
runtimeWC.setName(runtimeName);
runtimeWC.setLocation(runitmeDirPath);
findRuntime = runtimeWC.save(true, npm);
}
assertNotNull(findRuntime);
final LiferayTomcatRuntime liferayRuntime = (LiferayTomcatRuntime) ServerCore.findRuntime(runtimeName).loadAdapter(LiferayTomcatRuntime.class, npm);
assertNotNull(liferayRuntime);
return findRuntime.getId();
}
Aggregations