Search in sources :

Example 6 with IProcess

use of org.eclipse.debug.core.model.IProcess in project ow by vtst.

the class EasyJavaProgramLaunchConfigurationDelegate method launch.

public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
    Fixture fixture = getFixture(config);
    if (monitor == null)
        monitor = new NullProgressMonitor();
    monitor.beginTask(config.getName() + "...", 3);
    if (monitor.isCanceled())
        return;
    try {
        monitor.subTask(messages.getString("verifying_launch_attributes"));
        String mainTypeName = verifyMainTypeName(config);
        IVMRunner runner = getVMRunner(config, mode);
        File workingDir = verifyWorkingDirectory(config);
        String workingDirName = null;
        if (workingDir != null) {
            workingDirName = workingDir.getAbsolutePath();
        }
        // Environment variables
        String[] envp = getEnvironment(config);
        // VM-specific attributes
        @SuppressWarnings("unchecked") Map<String, Object> vmAttributesMap = getVMSpecificAttributesMap(config);
        // Classpath
        String[] classpath = getClasspath(config);
        // Create VM config
        VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, classpath);
        runConfig.setProgramArguments(getProgramArgumentsArray(config, fixture));
        runConfig.setEnvironment(envp);
        runConfig.setVMArguments(getVMArgumentsArray(config, fixture));
        runConfig.setWorkingDirectory(workingDirName);
        runConfig.setVMSpecificAttributesMap(vmAttributesMap);
        // Bootpath
        runConfig.setBootClassPath(getBootpath(config));
        // check for cancellation
        if (monitor.isCanceled()) {
            return;
        }
        // stop in main
        prepareStopInMain(config);
        // done the verification phase
        monitor.worked(1);
        monitor.subTask(messages.getString("creating_source_locator"));
        // set the source locator if required
        setDefaultSourceLocator(launch, config);
        monitor.worked(1);
        // Launch the configuration - 1 unit of work
        monitor.subTask(messages.getString("run_external_program"));
        runner.run(runConfig, launch, monitor);
        for (IProcess process : launch.getProcesses()) {
            addProcessListeners(config, fixture, new EasyLaunchConfigurationDelegateUtils.ProcessListernerAcceptorImpl(process));
        }
        // check for cancellation
        if (monitor.isCanceled())
            return;
    } finally {
        monitor.done();
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IVMRunner(org.eclipse.jdt.launching.IVMRunner) VMRunnerConfiguration(org.eclipse.jdt.launching.VMRunnerConfiguration) File(java.io.File) IProcess(org.eclipse.debug.core.model.IProcess)

Example 7 with IProcess

use of org.eclipse.debug.core.model.IProcess in project ow by vtst.

the class EasyJavaProgramLaunchConfigurationDelegate method launch.

public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
    Fixture fixture = getFixture(config);
    if (monitor == null)
        monitor = new NullProgressMonitor();
    monitor.beginTask(config.getName() + "...", 3);
    if (monitor.isCanceled())
        return;
    try {
        monitor.subTask(messages.getString("verifying_launch_attributes"));
        String mainTypeName = verifyMainTypeName(config);
        IVMRunner runner = getVMRunner(config, mode);
        File workingDir = verifyWorkingDirectory(config);
        String workingDirName = null;
        if (workingDir != null) {
            workingDirName = workingDir.getAbsolutePath();
        }
        // Environment variables
        String[] envp = getEnvironment(config);
        // VM-specific attributes
        @SuppressWarnings("unchecked") Map<String, Object> vmAttributesMap = getVMSpecificAttributesMap(config);
        // Classpath
        String[] classpath = getClasspath(config);
        // Create VM config
        VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, classpath);
        runConfig.setProgramArguments(getProgramArgumentsArray(config, fixture));
        runConfig.setEnvironment(envp);
        runConfig.setVMArguments(getVMArgumentsArray(config, fixture));
        runConfig.setWorkingDirectory(workingDirName);
        runConfig.setVMSpecificAttributesMap(vmAttributesMap);
        // Bootpath
        runConfig.setBootClassPath(getBootpath(config));
        // check for cancellation
        if (monitor.isCanceled()) {
            return;
        }
        // stop in main
        prepareStopInMain(config);
        // done the verification phase
        monitor.worked(1);
        monitor.subTask(messages.getString("creating_source_locator"));
        // set the source locator if required
        setDefaultSourceLocator(launch, config);
        monitor.worked(1);
        // Launch the configuration - 1 unit of work
        monitor.subTask(messages.getString("run_external_program"));
        runner.run(runConfig, launch, monitor);
        for (IProcess process : launch.getProcesses()) {
            addProcessListeners(config, fixture, new EasyLaunchConfigurationDelegateUtils.ProcessListernerAcceptorImpl(process));
        }
        // check for cancellation
        if (monitor.isCanceled())
            return;
    } finally {
        monitor.done();
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IVMRunner(org.eclipse.jdt.launching.IVMRunner) VMRunnerConfiguration(org.eclipse.jdt.launching.VMRunnerConfiguration) File(java.io.File) IProcess(org.eclipse.debug.core.model.IProcess)

Example 8 with IProcess

use of org.eclipse.debug.core.model.IProcess in project tdi-studio-se by Talend.

the class DebugProcessTosComposite method debug.

@Override
public void debug() {
    if (manager.getClearBeforeExec()) {
        processContext.clearMessages();
    }
    setHideconsoleLine(false);
    if ((processContext.getProcess()) instanceof org.talend.designer.core.ui.editor.process.Process) {
        ((org.talend.designer.core.ui.editor.process.Process) processContext.getProcess()).checkDifferenceWithRepository();
    }
    // final IPreferenceStore preferenceStore = DebugUIPlugin.getDefault().getPreferenceStore();
    final IPreferenceStore preferenceStore = DebugUITools.getPreferenceStore();
    final boolean oldValueConsoleOnOut = preferenceStore.getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT);
    final boolean oldValueConsoleOnErr = preferenceStore.getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR);
    preferenceStore.setValue(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT, false);
    preferenceStore.setValue(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR, false);
    // java debug to collect when tos
    int num = RunProcessPlugin.getDefault().getPreferenceStore().getInt(RunProcessTokenCollector.TOS_COUNT_DEBUG_RUNS.getPrefKey());
    RunProcessPlugin.getDefault().getPreferenceStore().setValue(RunProcessTokenCollector.TOS_COUNT_DEBUG_RUNS.getPrefKey(), num + 1);
    checkSaveBeforeRunSelection();
    if (contextComposite.promptConfirmLauch()) {
        setRunnable(false);
        final IContext context = contextComposite.getSelectedContext();
        IRunnableWithProgress worker = new IRunnableWithProgress() {

            @Override
            public void run(IProgressMonitor monitor) {
                IProcessor processor = ProcessorUtilities.getProcessor(processContext.getProcess(), processContext.getProcess().getProperty(), context);
                //$NON-NLS-1$
                monitor.beginTask("Launching debugger", IProgressMonitor.UNKNOWN);
                try {
                    // use this function to generate childrens also.
                    ProcessorUtilities.generateCode(processContext.getProcess(), context, false, false, true, monitor);
                    ILaunchConfiguration config = ((Processor) processor).getDebugConfiguration(processContext.getStatisticsPort(), processContext.getTracesPort(), null);
                    // code is correct before launching
                    if (!JobErrorsChecker.hasErrors(DebugProcessTosComposite.this.getShell())) {
                        if (config != null) {
                            // PlatformUI.getWorkbench().
                            // getActiveWorkbenchWindow
                            // ().addPerspectiveListener(new
                            // DebugInNewWindowListener());
                            DebugUITools.launch(config, ILaunchManager.DEBUG_MODE);
                        } else {
                            //$NON-NLS-1$
                            MessageDialog.openInformation(//$NON-NLS-1$
                            getShell(), //$NON-NLS-1$
                            Messages.getString("ProcessDebugDialog.debugBtn"), //$NON-NLS-1$ 
                            Messages.getString("ProcessDebugDialog.errortext"));
                        }
                    }
                } catch (ProcessorException e) {
                    IStatus status = new Status(IStatus.ERROR, RunProcessPlugin.PLUGIN_ID, IStatus.OK, "Debug launch failed.", //$NON-NLS-1$
                    e);
                    RunProcessPlugin.getDefault().getLog().log(status);
                    //$NON-NLS-1$ //$NON-NLS-2$
                    MessageDialog.openError(getShell(), Messages.getString("ProcessDebugDialog.debugBtn"), "");
                } finally {
                    monitor.done();
                }
            }
        };
        IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
        try {
            progressService.runInUI(PlatformUI.getWorkbench().getProgressService(), worker, ResourcesPlugin.getWorkspace().getRoot());
        } catch (InvocationTargetException e) {
            // e.printStackTrace();
            ExceptionHandler.process(e);
        } catch (InterruptedException e) {
            // e.printStackTrace();
            ExceptionHandler.process(e);
        }
    }
    debugMode = true;
    try {
        Thread thread = new Thread() {

            @Override
            public void run() {
                while (debugMode) {
                    final IProcess process = DebugUITools.getCurrentProcess();
                    if (process != null && process.isTerminated()) {
                        Display dis = Display.getCurrent();
                        if (dis == null) {
                            dis = Display.getDefault();
                        }
                        dis.asyncExec(new Runnable() {

                            @Override
                            public void run() {
                                setRunnable(true);
                                if (!killBtn.isDisposed() && killBtn != null) {
                                    killBtn.setEnabled(false);
                                }
                                preferenceStore.setValue(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT, oldValueConsoleOnOut);
                                preferenceStore.setValue(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR, oldValueConsoleOnErr);
                                if (isAddedStreamListener) {
                                    process.getStreamsProxy().getOutputStreamMonitor().removeListener(streamListener);
                                    isAddedStreamListener = false;
                                    if (processContext.isRunning()) {
                                        //$NON-NLS-1$
                                        final String endingPattern = Messages.getString("ProcessComposite.endPattern");
                                        MessageFormat mf = new MessageFormat(endingPattern);
                                        String byeMsg;
                                        try {
                                            byeMsg = //$NON-NLS-1$
                                            "\n" + mf.format(new Object[] { processContext.getProcess().getName(), new Date(), new Integer(process.getExitValue()) });
                                            processContext.addDebugResultToConsole(new ProcessMessage(MsgType.CORE_OUT, byeMsg));
                                        } catch (DebugException e) {
                                            // e.printStackTrace();
                                            ExceptionHandler.process(e);
                                        }
                                        processContext.setRunning(false);
                                    }
                                }
                                debugMode = false;
                            }
                        });
                    } else {
                        if (process != null) {
                            // (one at leat) process
                            // still running
                            Display dis = Display.getCurrent();
                            if (dis == null) {
                                dis = Display.getDefault();
                            }
                            dis.asyncExec(new Runnable() {

                                @Override
                                public void run() {
                                    setRunnable(false);
                                    if (!killBtn.isDisposed() && killBtn != null) {
                                        killBtn.setEnabled(true);
                                    }
                                    processContext.setRunning(true);
                                    processContext.setDebugProcess(process);
                                    if (!isAddedStreamListener) {
                                        process.getStreamsProxy().getOutputStreamMonitor().addListener(streamListener);
                                        // if (clearBeforeExec.getSelection()) {
                                        // processContext.clearMessages();
                                        // }
                                        // if (watchBtn.getSelection()) {
                                        // processContext.switchTime();
                                        // }
                                        ClearPerformanceAction clearPerfAction = new ClearPerformanceAction();
                                        clearPerfAction.setProcess(processContext.getProcess());
                                        clearPerfAction.run();
                                        ClearTraceAction clearTraceAction = new ClearTraceAction();
                                        clearTraceAction.setProcess(processContext.getProcess());
                                        clearTraceAction.run();
                                        isAddedStreamListener = true;
                                        //$NON-NLS-1$
                                        final String startingPattern = Messages.getString("ProcessComposite.startPattern");
                                        MessageFormat mf = new MessageFormat(startingPattern);
                                        String welcomeMsg = mf.format(new Object[] { processContext.getProcess().getName(), new Date() });
                                        processContext.addDebugResultToConsole(new ProcessMessage(MsgType.CORE_OUT, //$NON-NLS-1$
                                        welcomeMsg + "\r\n"));
                                    }
                                }
                            });
                        } else {
                            // no process running
                            Display dis = Display.getCurrent();
                            if (dis == null) {
                                dis = Display.getDefault();
                            }
                            dis.asyncExec(new Runnable() {

                                @Override
                                public void run() {
                                    setRunnable(true);
                                    if (!killBtn.isDisposed() && killBtn != null) {
                                        killBtn.setEnabled(false);
                                    }
                                }
                            });
                        }
                    }
                    try {
                        Thread.sleep(2000);
                    } catch (InterruptedException e) {
                        // e.printStackTrace();
                        ExceptionHandler.process(e);
                    }
                }
            }
        };
        thread.start();
    } catch (Exception e) {
        ExceptionHandler.process(e);
        processContext.addErrorMessage(e);
        kill();
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) IContext(org.talend.core.model.process.IContext) IProcessor(org.talend.designer.runprocess.IProcessor) Processor(org.talend.designer.core.runprocess.Processor) ClearTraceAction(org.talend.designer.runprocess.ui.actions.ClearTraceAction) IProcess(org.eclipse.debug.core.model.IProcess) Process(org.talend.designer.core.ui.editor.process.Process) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) IProgressService(org.eclipse.ui.progress.IProgressService) IProcessMessage(org.talend.designer.runprocess.IProcessMessage) ProcessMessage(org.talend.designer.runprocess.ProcessMessage) IProcess(org.eclipse.debug.core.model.IProcess) Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ProcessorException(org.talend.designer.runprocess.ProcessorException) MessageFormat(java.text.MessageFormat) IProcessor(org.talend.designer.runprocess.IProcessor) DebugException(org.eclipse.debug.core.DebugException) Point(org.eclipse.swt.graphics.Point) InvocationTargetException(java.lang.reflect.InvocationTargetException) Date(java.util.Date) DebugException(org.eclipse.debug.core.DebugException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ProcessorException(org.talend.designer.runprocess.ProcessorException) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ClearPerformanceAction(org.talend.designer.runprocess.ui.actions.ClearPerformanceAction) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) Display(org.eclipse.swt.widgets.Display)

Example 9 with IProcess

use of org.eclipse.debug.core.model.IProcess in project tdi-studio-se by Talend.

the class ProcessComposite method debug.

public void debug() {
    setHideconsoleLine(false);
    if ((processContext.getProcess()) instanceof org.talend.designer.core.ui.editor.process.Process) {
        ((org.talend.designer.core.ui.editor.process.Process) processContext.getProcess()).checkDifferenceWithRepository();
    }
    // final IPreferenceStore preferenceStore = DebugUIPlugin.getDefault().getPreferenceStore();
    final IPreferenceStore preferenceStore = DebugUITools.getPreferenceStore();
    final boolean oldValueConsoleOnOut = preferenceStore.getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT);
    final boolean oldValueConsoleOnErr = preferenceStore.getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR);
    preferenceStore.setValue(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT, false);
    preferenceStore.setValue(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR, false);
    checkSaveBeforeRunSelection();
    if (contextComposite.promptConfirmLauch()) {
        setRunnable(false);
        final IContext context = contextComposite.getSelectedContext();
        IRunnableWithProgress worker = new IRunnableWithProgress() {

            @Override
            public void run(IProgressMonitor monitor) {
                IProcessor processor = ProcessorUtilities.getProcessor(processContext.getProcess(), processContext.getProcess().getProperty(), context);
                //$NON-NLS-1$
                monitor.beginTask("Launching debugger", IProgressMonitor.UNKNOWN);
                try {
                    // use this function to generate childrens also.
                    ProcessorUtilities.generateCode(processContext.getProcess(), context, false, false, true, monitor);
                    ILaunchConfiguration config = ((Processor) processor).getDebugConfiguration(processContext.getStatisticsPort(), processContext.getTracesPort(), null);
                    // code is correct before launching
                    if (!JobErrorsChecker.hasErrors(ProcessComposite.this.getShell())) {
                        if (config != null) {
                            // PlatformUI.getWorkbench().
                            // getActiveWorkbenchWindow
                            // ().addPerspectiveListener(new
                            // DebugInNewWindowListener());
                            DebugUITools.launch(config, ILaunchManager.DEBUG_MODE);
                        } else {
                            //$NON-NLS-1$
                            MessageDialog.openInformation(//$NON-NLS-1$
                            getShell(), //$NON-NLS-1$
                            Messages.getString("ProcessDebugDialog.debugBtn"), //$NON-NLS-1$ 
                            Messages.getString("ProcessDebugDialog.errortext"));
                        }
                    }
                } catch (ProcessorException e) {
                    IStatus status = new Status(IStatus.ERROR, RunProcessPlugin.PLUGIN_ID, IStatus.OK, "Debug launch failed.", //$NON-NLS-1$
                    e);
                    RunProcessPlugin.getDefault().getLog().log(status);
                    //$NON-NLS-1$ //$NON-NLS-2$
                    MessageDialog.openError(getShell(), Messages.getString("ProcessDebugDialog.debugBtn"), "");
                } finally {
                    monitor.done();
                }
            }
        };
        IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
        try {
            progressService.runInUI(PlatformUI.getWorkbench().getProgressService(), worker, ResourcesPlugin.getWorkspace().getRoot());
        } catch (InvocationTargetException e) {
            // e.printStackTrace();
            ExceptionHandler.process(e);
        } catch (InterruptedException e) {
            // e.printStackTrace();
            ExceptionHandler.process(e);
        }
    }
    debugMode = true;
    try {
        Thread thread = new Thread() {

            @Override
            public void run() {
                while (debugMode) {
                    final IProcess process = DebugUITools.getCurrentProcess();
                    if (process != null && process.isTerminated()) {
                        getDisplay().asyncExec(new Runnable() {

                            @Override
                            public void run() {
                                setRunnable(true);
                                killBtn.setEnabled(false);
                                preferenceStore.setValue(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT, oldValueConsoleOnOut);
                                preferenceStore.setValue(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR, oldValueConsoleOnErr);
                                if (isAddedStreamListener) {
                                    process.getStreamsProxy().getOutputStreamMonitor().removeListener(streamListener);
                                    isAddedStreamListener = false;
                                    if (processContext.isRunning()) {
                                        //$NON-NLS-1$
                                        final String endingPattern = Messages.getString("ProcessComposite.endPattern");
                                        MessageFormat mf = new MessageFormat(endingPattern);
                                        String byeMsg;
                                        try {
                                            byeMsg = //$NON-NLS-1$
                                            "\n" + mf.format(new Object[] { processContext.getProcess().getName(), new Date(), new Integer(process.getExitValue()) });
                                            processContext.addDebugResultToConsole(new ProcessMessage(MsgType.CORE_OUT, byeMsg));
                                        } catch (DebugException e) {
                                            // e.printStackTrace();
                                            ExceptionHandler.process(e);
                                        }
                                        processContext.setRunning(false);
                                    }
                                }
                                debugMode = false;
                            }
                        });
                    } else {
                        if (process != null) {
                            // (one at leat) process
                            // still running
                            getDisplay().asyncExec(new Runnable() {

                                @Override
                                public void run() {
                                    setRunnable(false);
                                    killBtn.setEnabled(true);
                                    processContext.setRunning(true);
                                    processContext.setDebugProcess(process);
                                    if (!isAddedStreamListener) {
                                        process.getStreamsProxy().getOutputStreamMonitor().addListener(streamListener);
                                        // if (clearBeforeExec.getSelection()) {
                                        // processContext.clearMessages();
                                        // }
                                        // if (watchBtn.getSelection()) {
                                        // processContext.switchTime();
                                        // }
                                        ClearPerformanceAction clearPerfAction = new ClearPerformanceAction();
                                        clearPerfAction.setProcess(processContext.getProcess());
                                        clearPerfAction.run();
                                        ClearTraceAction clearTraceAction = new ClearTraceAction();
                                        clearTraceAction.setProcess(processContext.getProcess());
                                        clearTraceAction.run();
                                        isAddedStreamListener = true;
                                        //$NON-NLS-1$
                                        final String startingPattern = Messages.getString("ProcessComposite.startPattern");
                                        MessageFormat mf = new MessageFormat(startingPattern);
                                        String welcomeMsg = mf.format(new Object[] { processContext.getProcess().getName(), new Date() });
                                        processContext.addDebugResultToConsole(new ProcessMessage(MsgType.CORE_OUT, //$NON-NLS-1$
                                        welcomeMsg + "\r\n"));
                                    }
                                }
                            });
                        } else {
                            // no process running
                            getDisplay().asyncExec(new Runnable() {

                                @Override
                                public void run() {
                                    setRunnable(true);
                                    killBtn.setEnabled(false);
                                }
                            });
                        }
                    }
                    try {
                        Thread.sleep(2000);
                    } catch (InterruptedException e) {
                        // e.printStackTrace();
                        ExceptionHandler.process(e);
                    }
                }
            }
        };
        thread.start();
    } catch (Exception e) {
        ExceptionHandler.process(e);
        processContext.addErrorMessage(e);
        kill();
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) IContext(org.talend.core.model.process.IContext) IProcessor(org.talend.designer.runprocess.IProcessor) Processor(org.talend.designer.core.runprocess.Processor) ClearTraceAction(org.talend.designer.runprocess.ui.actions.ClearTraceAction) IProcess(org.eclipse.debug.core.model.IProcess) Process(org.talend.designer.core.ui.editor.process.Process) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) IProgressService(org.eclipse.ui.progress.IProgressService) IProcessMessage(org.talend.designer.runprocess.IProcessMessage) ProcessMessage(org.talend.designer.runprocess.ProcessMessage) IProcess(org.eclipse.debug.core.model.IProcess) Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ProcessorException(org.talend.designer.runprocess.ProcessorException) MessageFormat(java.text.MessageFormat) IProcessor(org.talend.designer.runprocess.IProcessor) DebugException(org.eclipse.debug.core.DebugException) InvocationTargetException(java.lang.reflect.InvocationTargetException) Date(java.util.Date) DebugException(org.eclipse.debug.core.DebugException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ProcessorException(org.talend.designer.runprocess.ProcessorException) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ClearPerformanceAction(org.talend.designer.runprocess.ui.actions.ClearPerformanceAction) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 10 with IProcess

use of org.eclipse.debug.core.model.IProcess in project sling by apache.

the class JVMDebuggerConnection method stop.

public void stop(boolean force) {
    IProcess[] processes = launch.getProcesses();
    if (processes != null) {
        for (int i = 0; i < processes.length; i++) {
            IProcess iProcess = processes[i];
            try {
                iProcess.terminate();
            } catch (DebugException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }
    IDebugTarget[] debugTargets = launch.getDebugTargets();
    if (debugTargets != null) {
        for (int i = 0; i < debugTargets.length; i++) {
            IDebugTarget iDebugTarget = debugTargets[i];
            try {
                iDebugTarget.disconnect();
            } catch (DebugException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }
    IDebugTarget dt = launch.getDebugTarget();
    if (dt != null) {
        try {
            dt.disconnect();
        } catch (DebugException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
Also used : IDebugTarget(org.eclipse.debug.core.model.IDebugTarget) DebugException(org.eclipse.debug.core.DebugException) IProcess(org.eclipse.debug.core.model.IProcess)

Aggregations

IProcess (org.eclipse.debug.core.model.IProcess)12 IStatus (org.eclipse.core.runtime.IStatus)4 Status (org.eclipse.core.runtime.Status)4 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)4 CoreException (org.eclipse.core.runtime.CoreException)3 DebugException (org.eclipse.debug.core.DebugException)3 ILaunch (org.eclipse.debug.core.ILaunch)3 BndPreferences (bndtools.preferences.BndPreferences)2 File (java.io.File)2 IOException (java.io.IOException)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 MessageFormat (java.text.MessageFormat)2 Date (java.util.Date)2 Matcher (java.util.regex.Matcher)2 Pattern (java.util.regex.Pattern)2 IProcessTerminationListener (net.vtst.eclipse.easyxtext.ui.launching.EasyLaunchConfigurationDelegateUtils.IProcessTerminationListener)2 EasyPatternMatchListener (net.vtst.eclipse.easyxtext.ui.launching.EasyPatternMatchListener)2 IMarker (org.eclipse.core.resources.IMarker)2 IResource (org.eclipse.core.resources.IResource)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2