Search in sources :

Example 1 with NodeDebugTerminateListener

use of org.jboss.tools.openshift.internal.js.listeners.NodeDebugTerminateListener in project jbosstools-openshift by jbosstools.

the class NodeDebugLauncher method launch.

public static void launch(IServer server, int port) throws CoreException {
    ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
    ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(NodeDebuggerUtil.CHROMIUM_LAUNCH_CONFIGURATION_TYPE_ID);
    IProject project = OpenShiftServerUtils.getDeployProject(server);
    String projectName = project.getName();
    final ILaunchConfigurationWorkingCopy v8debugLaunch = type.newInstance(project, projectName);
    v8debugLaunch.setAttribute(LaunchParams.CHROMIUM_DEBUG_HOST, NodeDebuggerUtil.LOCALHOST);
    v8debugLaunch.setAttribute(LaunchParams.CHROMIUM_DEBUG_PORT, port);
    v8debugLaunch.setAttribute(LaunchParams.ADD_NETWORK_CONSOLE, true);
    v8debugLaunch.setAttribute(LaunchParams.BREAKPOINT_SYNC_DIRECTION, BreakpointSynchronizer.Direction.MERGE.name());
    v8debugLaunch.setAttribute(LaunchParams.SOURCE_LOOKUP_MODE, LaunchParams.LookupMode.EXACT_MATCH.name());
    v8debugLaunch.setAttribute(LaunchParams.ATTR_APP_PROJECT, OpenShiftServerUtils.getDeployProject(server).getName());
    v8debugLaunch.setAttribute(LaunchParams.ATTR_APP_PROJECT_RELATIVE_PATH, project.getFile(NodeDebuggerUtil.PACKAGE_JSON).getProjectRelativePath().toOSString());
    v8debugLaunch.setAttribute(LaunchParams.ATTR_REMOTE_HOME_DIR, getPodPath(server, new NullProgressMonitor()));
    v8debugLaunch.setAttribute(LaunchParams.PredefinedSourceWrapperIds.CONFIG_PROPERTY, NodeDebuggerUtil.encode(NodeDebuggerUtil.PREDEFIENED_WRAPPERS));
    DebugPlugin.getDefault().addDebugEventListener(new NodeDebugTerminateListener(v8debugLaunch, server));
    Display.getDefault().asyncExec(new Runnable() {

        @Override
        public void run() {
            DebugUITools.launch(v8debugLaunch, ILaunchManager.DEBUG_MODE);
            // Debug session has just started - adding server to tracker
            SessionStorage.get().put(server, v8debugLaunch);
        }
    });
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) ILaunchManager(org.eclipse.debug.core.ILaunchManager) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) NodeDebugTerminateListener(org.jboss.tools.openshift.internal.js.listeners.NodeDebugTerminateListener) IProject(org.eclipse.core.resources.IProject)

Aggregations

IProject (org.eclipse.core.resources.IProject)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 ILaunchConfigurationType (org.eclipse.debug.core.ILaunchConfigurationType)1 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)1 ILaunchManager (org.eclipse.debug.core.ILaunchManager)1 NodeDebugTerminateListener (org.jboss.tools.openshift.internal.js.listeners.NodeDebugTerminateListener)1