Search in sources :

Example 1 with FMDebugTarget

use of com.liferay.ide.portal.core.debug.fm.FMDebugTarget in project liferay-ide by liferay.

the class DebugPortalLaunchParticipant method portalPostLaunch.

public void portalPostLaunch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
    final IServer server = org.eclipse.wst.server.core.ServerUtil.getServer(configuration);
    final IServerManagerConnection connection = ServerUtil.getServerManagerConnection(server, monitor);
    if (connection != null) {
        try {
            final String fmDebugPassword = connection.getFMDebugPassword();
            final int fmDebugPort = connection.getFMDebugPort();
            if (fmDebugPassword != null && fmDebugPort != -1) {
                launch.setAttribute(PortalCore.PREF_FM_DEBUG_PASSWORD, fmDebugPassword);
                launch.setAttribute(PortalCore.PREF_FM_DEBUG_PORT, Integer.toString(fmDebugPort));
                final IDebugTarget target = new FMDebugTarget(server.getHost(), launch, launch.getProcesses()[0]);
                launch.addDebugTarget(target);
            }
        } catch (APIException e) {
            LiferayServerCore.logError("Unable to determine remote freemarker debugger connection info.", e);
        }
    }
    this.saveLaunchMode = null;
    final String stopServer = configuration.getAttribute(STOP_SERVER, "false");
    if (ILaunchManager.DEBUG_MODE.equals(mode) && "false".equals(stopServer)) {
        if (this.fmDebugPort != null) {
            launch.setAttribute(PortalCore.PREF_FM_DEBUG_PORT, this.fmDebugPort);
            this.fmDebugPort = null;
            final IDebugTarget target = new FMDebugTarget(server.getHost(), launch, launch.getProcesses()[0]);
            launch.addDebugTarget(target);
        } else {
            // $NON-NLS-1$
            PortalCore.logError("Launch freemarker port is invalid.");
        }
    }
}
Also used : FMDebugTarget(com.liferay.ide.portal.core.debug.fm.FMDebugTarget) IServer(org.eclipse.wst.server.core.IServer) APIException(com.liferay.ide.core.remote.APIException) IServerManagerConnection(com.liferay.ide.server.remote.IServerManagerConnection) IDebugTarget(org.eclipse.debug.core.model.IDebugTarget)

Aggregations

APIException (com.liferay.ide.core.remote.APIException)1 FMDebugTarget (com.liferay.ide.portal.core.debug.fm.FMDebugTarget)1 IServerManagerConnection (com.liferay.ide.server.remote.IServerManagerConnection)1 IDebugTarget (org.eclipse.debug.core.model.IDebugTarget)1 IServer (org.eclipse.wst.server.core.IServer)1