Search in sources :

Example 86 with ILaunchConfigurationType

use of org.eclipse.debug.core.ILaunchConfigurationType in project arduino-eclipse-plugin by Sloeber.

the class LaunchShortcut method createNewConfiguration.

/**
 * Creates and initializes a new launch config for the project.
 *
 * @return the new launch configuration
 */
private ILaunchConfiguration createNewConfiguration() {
    try {
        ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
        ILaunchConfigurationType type = lm.getLaunchConfigurationType(LaunchConfiguration.LAUNCH_CONFIGURATION_TYPE_ID);
        // Infere name of launch config from project name
        String name = myProject.getName();
        // Create launch config
        ILaunchConfigurationWorkingCopy wc = type.newInstance(null, name);
        initializeConfiguration(wc);
        return wc.doSave();
    } catch (CoreException ce) {
    // Stupid Exception
    }
    return null;
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) ILaunchManager(org.eclipse.debug.core.ILaunchManager) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)

Example 87 with ILaunchConfigurationType

use of org.eclipse.debug.core.ILaunchConfigurationType 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)

Example 88 with ILaunchConfigurationType

use of org.eclipse.debug.core.ILaunchConfigurationType in project jbosstools-openshift by jbosstools.

the class JavaRemoteStackDebugger method startRemoteDebugger.

@Override
public void startRemoteDebugger(IProject project, String stackType, String stackVersion, int port, Map<String, String> env, IProgressMonitor monitor) throws CoreException {
    String name = "OpenShift remote (Java) " + project.getName();
    ILaunchConfigurationType launchConfigurationType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(ID_REMOTE_JAVA_APPLICATION);
    ILaunchConfigurationWorkingCopy launchConfiguration = launchConfigurationType.newInstance(null, name);
    launchConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_ALLOW_TERMINATE, false);
    launchConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR, IJavaLaunchConfigurationConstants.ID_SOCKET_ATTACH_VM_CONNECTOR);
    Map<String, String> connectMap = new HashMap<>(2);
    // $NON-NLS-1$
    connectMap.put("port", String.valueOf(port));
    // $NON-NLS-1$ //$NON-NLS-2$
    connectMap.put("hostname", "localhost");
    launchConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, connectMap);
    launchConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName());
    launchConfiguration.launch("debug", monitor);
}
Also used : ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) HashMap(java.util.HashMap) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)

Example 89 with ILaunchConfigurationType

use of org.eclipse.debug.core.ILaunchConfigurationType in project jbosstools-openshift by jbosstools.

the class NodeRemoteStackDebugger method startRemoteDebugger.

@Override
public void startRemoteDebugger(IProject project, String stackType, String stackVersion, int port, Map<String, String> env, IProgressMonitor monitor) throws CoreException {
    try {
        String name = "OpenShift remote (Node) " + project.getName();
        ILaunchConfigurationType launchConfigurationType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(ID_REMOTE_NODE_APPLICATION);
        ILaunchConfigurationWorkingCopy launchConfiguration = launchConfigurationType.newInstance(null, name);
        // $NON-NLS-1$
        launchConfiguration.setAttribute("port", port);
        // $NON-NLS-1$ //$NON-NLS-2$
        launchConfiguration.setAttribute("address", "localhost");
        launchConfiguration.setAttribute(DSPPlugin.ATTR_CUSTOM_LAUNCH_PARAMS, true);
        launchConfiguration.setAttribute(DSPPlugin.ATTR_DSP_PARAM, getAdditionJSONSettings(project, env));
        launchConfiguration.launch("debug", monitor);
    } catch (IOException e) {
        throw new CoreException(OpenShiftCoreActivator.statusFactory().errorStatus(e));
    }
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) IOException(java.io.IOException)

Example 90 with ILaunchConfigurationType

use of org.eclipse.debug.core.ILaunchConfigurationType in project jbosstools-openshift by jbosstools.

the class DebugLaunchConfigs method createRemoteDebuggerLaunchConfiguration.

public ILaunchConfigurationWorkingCopy createRemoteDebuggerLaunchConfiguration(IServer server) throws CoreException {
    String name = getRemoteDebuggerLaunchConfigurationName(server);
    ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(ID_REMOTE_JAVA_APPLICATION);
    return launchConfigurationType.newInstance(null, name);
}
Also used : ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType)

Aggregations

ILaunchConfigurationType (org.eclipse.debug.core.ILaunchConfigurationType)91 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)62 ILaunchManager (org.eclipse.debug.core.ILaunchManager)54 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)50 CoreException (org.eclipse.core.runtime.CoreException)43 ArrayList (java.util.ArrayList)19 HashMap (java.util.HashMap)8 IPath (org.eclipse.core.runtime.IPath)8 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)6 Path (org.eclipse.core.runtime.Path)6 ILaunch (org.eclipse.debug.core.ILaunch)6 File (java.io.File)5 IOException (java.io.IOException)5 Map (java.util.Map)5 IProject (org.eclipse.core.resources.IProject)5 IResource (org.eclipse.core.resources.IResource)4 IStatus (org.eclipse.core.runtime.IStatus)4 List (java.util.List)3 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)3 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)2