Search in sources :

Example 6 with IDebugTarget

use of org.eclipse.debug.core.model.IDebugTarget in project liferay-ide by liferay.

the class RemoteLaunchConfigDelegate method debugLaunch.

@SuppressWarnings({ "rawtypes", "unchecked", "deprecation" })
protected void debugLaunch(IServer server, ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException {
    if (monitor == null) {
        monitor = new NullProgressMonitor();
    }
    // setup the run launch so we get console monitor
    runLaunch(server, configuration, launch, monitor);
    String connectorId = getVMConnectorId(configuration);
    IVMConnector connector = null;
    if (connectorId == null) {
        connector = JavaRuntime.getDefaultVMConnector();
    } else {
        connector = JavaRuntime.getVMConnector(connectorId);
    }
    if (connector == null) {
        abort(// $NON-NLS-1$
        "Debugging connector not specified.", // $NON-NLS-1$
        null, IJavaLaunchConfigurationConstants.ERR_CONNECTOR_NOT_AVAILABLE);
    }
    Map connectMap = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, (Map) null);
    int connectTimeout = JavaRuntime.getPreferences().getInt(JavaRuntime.PREF_CONNECT_TIMEOUT);
    // $NON-NLS-1$
    connectMap.put("timeout", StringPool.EMPTY + connectTimeout);
    // check for cancellation
    if (monitor.isCanceled()) {
        return;
    }
    if (!launch.isTerminated()) {
        // connect to remote VM
        connector.connect(connectMap, monitor, launch);
    }
    // check for cancellation
    if (monitor.isCanceled() || launch.isTerminated()) {
        IDebugTarget[] debugTargets = launch.getDebugTargets();
        for (int i = 0; i < debugTargets.length; i++) {
            IDebugTarget target = debugTargets[i];
            if (target.canDisconnect()) {
                target.disconnect();
            }
        }
        return;
    }
    monitor.done();
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IVMConnector(org.eclipse.jdt.launching.IVMConnector) IDebugTarget(org.eclipse.debug.core.model.IDebugTarget) Map(java.util.Map)

Example 7 with IDebugTarget

use of org.eclipse.debug.core.model.IDebugTarget in project statecharts by Yakindu.

the class AbstractDebugTargetView method setActiveSession.

protected void setActiveSession() {
    // if a simulation session is running, we should initialize with its
    // content
    IAdaptable debugContext = DebugUITools.getDebugContext();
    if (debugContext != null) {
        IDebugTarget debugTarget = (IDebugTarget) debugContext.getAdapter(IDebugTarget.class);
        if (debugTarget != null) {
            if (!debugTarget.isTerminated()) {
                this.debugTarget = (IDebugTarget) debugTarget;
                activeTargetChanged(this.debugTarget);
            }
        }
    }
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) IDebugTarget(org.eclipse.debug.core.model.IDebugTarget)

Example 8 with IDebugTarget

use of org.eclipse.debug.core.model.IDebugTarget in project statecharts by Yakindu.

the class AbstractDebugTargetView method debugContextChanged.

public void debugContextChanged(DebugContextEvent event) {
    if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
        PlatformObject object = (PlatformObject) ((IStructuredSelection) event.getContext()).getFirstElement();
        if (object == null)
            return;
        IDebugTarget newTarget = null;
        if (object instanceof Launch) {
            newTarget = ((Launch) object).getDebugTarget();
        } else {
            newTarget = (IDebugTarget) object.getAdapter(IDebugTarget.class);
        }
        changeTarget(newTarget);
    }
}
Also used : IDebugTarget(org.eclipse.debug.core.model.IDebugTarget) PlatformObject(org.eclipse.core.runtime.PlatformObject) Launch(org.eclipse.debug.core.Launch) ILaunch(org.eclipse.debug.core.ILaunch)

Example 9 with IDebugTarget

use of org.eclipse.debug.core.model.IDebugTarget in project statecharts by Yakindu.

the class SimulationView method createSessionSelectorComponent.

protected ComboViewer createSessionSelectorComponent(Composite top) {
    Combo combo = new Combo(top, SWT.DROP_DOWN | SWT.READ_ONLY);
    combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    this.sessionDropdown = new ComboViewer(combo);
    this.sessionDropdown.setContentProvider(new ArrayContentProvider());
    this.sessionDropdown.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            IDebugTarget target = ((IDebugTarget) element);
            boolean isTerminated = target.isTerminated();
            boolean isSuspended = target.isSuspended();
            if (target.getLaunch().getDebugTarget() != null)
                try {
                    return target.getLaunch().getDebugTarget().getName() + " [" + (isTerminated ? "terminated" : isSuspended ? "suspended" : "active") + "]";
                } catch (DebugException e) {
                    return "unkown state";
                }
            else
                return "No simulation running";
        }
    });
    this.sessionDropdown.addPostSelectionChangedListener(new SessionSelectionChangedListener());
    targets.clear();
    for (ILaunch iLaunch : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
        for (IDebugTarget iDebugTarget : iLaunch.getDebugTargets()) {
            if (!iDebugTarget.isTerminated())
                targets.add(iDebugTarget);
        }
    }
    sessionDropdown.setInput(targets);
    if (!targets.isEmpty()) {
        IDebugTarget dt = targets.iterator().next();
        sessionDropdown.setSelection(new StructuredSelection(dt), true);
        activeTargetChanged(dt);
    }
    return this.sessionDropdown;
}
Also used : IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) Combo(org.eclipse.swt.widgets.Combo) DebugException(org.eclipse.debug.core.DebugException) ComboViewer(org.eclipse.jface.viewers.ComboViewer) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) ILaunch(org.eclipse.debug.core.ILaunch) IDebugTarget(org.eclipse.debug.core.model.IDebugTarget) EObject(org.eclipse.emf.ecore.EObject) LabelProvider(org.eclipse.jface.viewers.LabelProvider)

Example 10 with IDebugTarget

use of org.eclipse.debug.core.model.IDebugTarget in project statecharts by Yakindu.

the class SCTHotModelReplacementManager method handleHotModelReplacement.

private void handleHotModelReplacement() {
    // first implementation: If the underlying model does not change
    // semantically, no notification is required...
    List<IDebugTarget> targets = getAffectedTargets();
    List<IDebugTarget> modelReplacementFailedTargets = new ArrayList<IDebugTarget>();
    for (IDebugTarget sctDebugTarget : targets) {
        // Reload the Statechart form the changes resource
        Statechart newStatechart = ResourceUtil.loadStatechart(((SCTDebugElement) sctDebugTarget).getResourceString());
        if (!EcoreUtil.equals(newStatechart, (EObject) sctDebugTarget.getAdapter(EObject.class))) {
            // The model semantically changed, we have to create a
            // notificiation for that....
            modelReplacementFailedTargets.add(sctDebugTarget);
        }
    }
    if (modelReplacementFailedTargets.size() > 0) {
        notifyHotModelReplacementFailed(targets);
    }
}
Also used : EObject(org.eclipse.emf.ecore.EObject) ArrayList(java.util.ArrayList) IDebugTarget(org.eclipse.debug.core.model.IDebugTarget) Statechart(org.yakindu.sct.model.sgraph.Statechart)

Aggregations

IDebugTarget (org.eclipse.debug.core.model.IDebugTarget)23 DebugException (org.eclipse.debug.core.DebugException)4 ILaunch (org.eclipse.debug.core.ILaunch)4 EObject (org.eclipse.emf.ecore.EObject)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 IErlangDebugNode (org.erlide.backend.debug.IErlangDebugNode)3 OtpErlangAtom (com.ericsson.otp.erlang.OtpErlangAtom)2 OtpErlangList (com.ericsson.otp.erlang.OtpErlangList)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 PlatformObject (org.eclipse.core.runtime.PlatformObject)2 IBreakpoint (org.eclipse.debug.core.model.IBreakpoint)2 IProcess (org.eclipse.debug.core.model.IProcess)2 IJavaDebugTarget (org.eclipse.jdt.debug.core.IJavaDebugTarget)2 IVMConnector (org.eclipse.jdt.launching.IVMConnector)2 JAXPDebugTarget (org.eclipse.wst.xsl.jaxp.launching.model.JAXPDebugTarget)2 ErlangLineBreakpoint (org.erlide.backend.debug.ErlangLineBreakpoint)2 OtpErlangLong (com.ericsson.otp.erlang.OtpErlangLong)1 OtpErlangObject (com.ericsson.otp.erlang.OtpErlangObject)1