Search in sources :

Example 6 with DebugContext

use of org.jboss.tools.openshift.internal.core.server.debug.DebugContext in project jbosstools-openshift by jbosstools.

the class OpenShiftLaunchController method launch.

@Override
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
    OpenShiftServerBehaviour beh = OpenShiftServerUtils.getOpenShiftServerBehaviour(configuration);
    String currentMode = beh.getServer().getMode();
    beh.setServerStarting();
    launchServerProcess(beh, launch, monitor);
    try {
        if (waitForDeploymentConfigReady(beh.getServer(), monitor)) {
            DebugContext context = createDebugContext(beh, monitor);
            toggleDebugging(mode, beh, context, monitor);
            if (!isDebugMode(mode)) {
                // enable devmode if we're not in debug mode. Debug mode has dev mode enabled
                // anyhow
                enableDevMode(context);
            }
            new OpenShiftDebugMode(context).execute(monitor);
        }
    } catch (Exception e) {
        mode = currentMode;
        throw new CoreException(StatusFactory.errorStatus(OpenShiftCoreActivator.PLUGIN_ID, NLS.bind("Could not launch server {0}", beh.getServer().getName()), e));
    } finally {
        setServerState(beh, mode, monitor);
    }
}
Also used : OpenShiftDebugMode(org.jboss.tools.openshift.internal.core.server.debug.OpenShiftDebugMode) CoreException(org.eclipse.core.runtime.CoreException) OpenShiftServerUtils.toCoreException(org.jboss.tools.openshift.core.server.OpenShiftServerUtils.toCoreException) DebugContext(org.jboss.tools.openshift.internal.core.server.debug.DebugContext) OpenShiftServerBehaviour(org.jboss.tools.openshift.core.server.OpenShiftServerBehaviour) CoreException(org.eclipse.core.runtime.CoreException) DebugException(org.eclipse.debug.core.DebugException) OpenShiftServerUtils.toCoreException(org.jboss.tools.openshift.core.server.OpenShiftServerUtils.toCoreException) IOException(java.io.IOException)

Example 7 with DebugContext

use of org.jboss.tools.openshift.internal.core.server.debug.DebugContext in project jbosstools-openshift by jbosstools.

the class OpenShiftNodejsLaunchController method startDebugging.

@Override
protected void startDebugging(OpenShiftServerBehaviour beh, DebugContext context, IProgressMonitor monitor) {
    IDebugListener listener = new IDebugListener() {

        @Override
        public void onDebugChange(DebugContext debuggingContext, IProgressMonitor monitor) throws CoreException {
            int localPort = mapPortForwarding(debuggingContext, monitor);
            NodeDebugLauncher.launch(beh.getServer(), localPort);
        }

        @Override
        public void onPodRestart(DebugContext debuggingContext, IProgressMonitor monitor) throws CoreException {
            onDebugChange(debuggingContext, monitor);
        }
    };
    context.setDebugListener(listener);
    new OpenShiftDebugMode(context).enableDebugging();
}
Also used : OpenShiftDebugMode(org.jboss.tools.openshift.internal.core.server.debug.OpenShiftDebugMode) IDebugListener(org.jboss.tools.openshift.internal.core.server.debug.IDebugListener) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) DebugContext(org.jboss.tools.openshift.internal.core.server.debug.DebugContext)

Aggregations

DebugContext (org.jboss.tools.openshift.internal.core.server.debug.DebugContext)7 OpenShiftDebugMode (org.jboss.tools.openshift.internal.core.server.debug.OpenShiftDebugMode)5 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 IDebugListener (org.jboss.tools.openshift.internal.core.server.debug.IDebugListener)4 IOException (java.io.IOException)2 CoreException (org.eclipse.core.runtime.CoreException)2 DebugException (org.eclipse.debug.core.DebugException)2 ILaunch (org.eclipse.debug.core.ILaunch)2 IServer (org.eclipse.wst.server.core.IServer)2 DockerImageLabels (org.jboss.tools.openshift.core.server.DockerImageLabels)2 IBinaryCapability (com.openshift.restclient.capability.IBinaryCapability)1 IPortForwardable (com.openshift.restclient.capability.resources.IPortForwardable)1 PortPair (com.openshift.restclient.capability.resources.IPortForwardable.PortPair)1 IPod (com.openshift.restclient.model.IPod)1 IReplicationController (com.openshift.restclient.model.IReplicationController)1 IResource (com.openshift.restclient.model.IResource)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 Set (java.util.Set)1 StringUtils (org.apache.commons.lang.StringUtils)1