Search in sources :

Example 1 with DebugLaunchConfigs

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

the class OpenShiftShutdownController method stop.

@Override
public void stop(boolean force) {
    OpenShiftServerBehaviour behavior = getBehavior();
    behavior.setServerStopping();
    try {
        DebugLaunchConfigs configs = DebugLaunchConfigs.get();
        if (configs != null) {
            configs.terminateRemoteDebugger(behavior.getServer());
        }
        // configs should only be null if workspace is shutting down, so set server to stopped anyway
        behavior.setServerStopped();
    } catch (CoreException ce) {
        log(IStatus.ERROR, "Error shutting down server", ce);
        getBehavior().setServerStarted();
    }
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) DebugLaunchConfigs(org.jboss.tools.openshift.internal.core.server.debug.DebugLaunchConfigs) OpenShiftServerBehaviour(org.jboss.tools.openshift.core.server.OpenShiftServerBehaviour)

Example 2 with DebugLaunchConfigs

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

the class OpenShiftLaunchController method attachRemoteDebugger.

private ILaunch attachRemoteDebugger(IServer server, int localDebugPort, IProgressMonitor monitor) throws CoreException {
    monitor.subTask("Attaching remote debugger...");
    ILaunch ret = null;
    DebugLaunchConfigs launchConfigs = DebugLaunchConfigs.get();
    if (launchConfigs == null) {
        throw toCoreException(NLS.bind("Could not get launch config for server {0} to attach remote debugger", server.getName()));
    }
    ILaunchConfiguration debuggerLaunchConfig = launchConfigs.getRemoteDebuggerLaunchConfiguration(server);
    ILaunchConfigurationWorkingCopy workingCopy = getLaunchConfigWorkingCopy(server, launchConfigs, debuggerLaunchConfig);
    if (workingCopy == null) {
        throw toCoreException(NLS.bind("Could not modify launch config for server {0}", server.getName()));
    }
    IProject project = OpenShiftServerUtils.getDeployProject(server);
    launchConfigs.setupRemoteDebuggerLaunchConfiguration(workingCopy, project, localDebugPort);
    debuggerLaunchConfig = workingCopy.doSave();
    ret = lauchDebugger(debuggerLaunchConfig, localDebugPort, monitor);
    if (ret == null) {
        throw toCoreException(NLS.bind("Could not start remote debugger to (forwarded) port {0} on localhost", localDebugPort));
    }
    monitor.worked(10);
    return ret;
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ILaunch(org.eclipse.debug.core.ILaunch) DebugLaunchConfigs(org.jboss.tools.openshift.internal.core.server.debug.DebugLaunchConfigs) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) IProject(org.eclipse.core.resources.IProject)

Example 3 with DebugLaunchConfigs

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

the class OpenShiftLaunchController method stopDebugging.

private void stopDebugging(DebugContext context, IProgressMonitor monitor) {
    IDebugListener listener = new IDebugListener() {

        @Override
        public void onDebugChange(DebugContext context, IProgressMonitor monitor) throws CoreException {
            DebugLaunchConfigs configs = DebugLaunchConfigs.get();
            if (configs != null) {
                configs.terminateRemoteDebugger(getServer());
            }
            unMapPortForwarding(context.getPod());
        }

        @Override
        public void onPodRestart(DebugContext debuggingContext, IProgressMonitor monitor) throws CoreException {
        }
    };
    context.setDebugListener(listener);
    new OpenShiftDebugMode(context).disableDebugging();
}
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) DebugLaunchConfigs(org.jboss.tools.openshift.internal.core.server.debug.DebugLaunchConfigs) DebugContext(org.jboss.tools.openshift.internal.core.server.debug.DebugContext)

Aggregations

DebugLaunchConfigs (org.jboss.tools.openshift.internal.core.server.debug.DebugLaunchConfigs)3 IProject (org.eclipse.core.resources.IProject)1 CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 ILaunch (org.eclipse.debug.core.ILaunch)1 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)1 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)1 OpenShiftServerBehaviour (org.jboss.tools.openshift.core.server.OpenShiftServerBehaviour)1 DebugContext (org.jboss.tools.openshift.internal.core.server.debug.DebugContext)1 IDebugListener (org.jboss.tools.openshift.internal.core.server.debug.IDebugListener)1 OpenShiftDebugMode (org.jboss.tools.openshift.internal.core.server.debug.OpenShiftDebugMode)1