Search in sources :

Example 1 with LiferayTomcatRuntime

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();
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IStatus(org.eclipse.core.runtime.IStatus) IPath(org.eclipse.core.runtime.IPath) IVMInstall(org.eclipse.jdt.launching.IVMInstall) LiferayTomcatRuntime(com.liferay.ide.server.tomcat.core.LiferayTomcatRuntime)

Example 2 with LiferayTomcatRuntime

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();
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy) LiferayTomcatRuntime(com.liferay.ide.server.tomcat.core.LiferayTomcatRuntime) IRuntime(org.eclipse.wst.server.core.IRuntime)

Aggregations

LiferayTomcatRuntime (com.liferay.ide.server.tomcat.core.LiferayTomcatRuntime)2 IPath (org.eclipse.core.runtime.IPath)1 IStatus (org.eclipse.core.runtime.IStatus)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 Path (org.eclipse.core.runtime.Path)1 IVMInstall (org.eclipse.jdt.launching.IVMInstall)1 IRuntime (org.eclipse.wst.server.core.IRuntime)1 IRuntimeWorkingCopy (org.eclipse.wst.server.core.IRuntimeWorkingCopy)1