Search in sources :

Example 1 with FMThread

use of com.liferay.ide.portal.core.debug.fm.FMThread in project liferay-ide by liferay.

the class PortalSourceLookupParticipant method getTemplateName.

private String getTemplateName(IStackFrame frame) throws DebugException {
    String retval = null;
    IThread thread = frame.getThread();
    IBreakpoint[] bps = thread.getBreakpoints();
    if (bps.length == 1) {
        IBreakpoint bp = thread.getBreakpoints()[0];
        retval = bp.getMarker().getAttribute(ILRDebugConstants.FM_TEMPLATE_NAME, null);
    } else {
        if (thread instanceof FMThread) {
            FMThread fmThread = (FMThread) thread;
            Breakpoint stepBp = fmThread.getStepBreakpoint();
            if (stepBp != null) {
                // $NON-NLS-1$
                retval = stepBp.getTemplateName().replaceAll(FMDebugTarget.FM_TEMPLATE_SERVLET_CONTEXT, "");
            }
        }
    }
    return retval;
}
Also used : Breakpoint(freemarker.debug.Breakpoint) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint) FMThread(com.liferay.ide.portal.core.debug.fm.FMThread) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint) IThread(org.eclipse.debug.core.model.IThread)

Example 2 with FMThread

use of com.liferay.ide.portal.core.debug.fm.FMThread in project liferay-ide by liferay.

the class SuspendFreemarkerThreadHandler method getSelectedFMStackFrame.

private FMStackFrame getSelectedFMStackFrame(Object context) {
    Object selectedElement = getSelectedElement(context);
    FMThread fmThread = null;
    FMStackFrame fmStackFrame = null;
    if (selectedElement instanceof FMThread) {
        fmThread = (FMThread) selectedElement;
        if (fmThread.isSuspended()) {
            try {
                fmStackFrame = (FMStackFrame) fmThread.getTopStackFrame();
            } catch (DebugException e) {
            }
        }
    } else if (selectedElement instanceof FMStackFrame) {
        fmStackFrame = (FMStackFrame) selectedElement;
    }
    return fmStackFrame;
}
Also used : FMThread(com.liferay.ide.portal.core.debug.fm.FMThread) FMStackFrame(com.liferay.ide.portal.core.debug.fm.FMStackFrame) DebugException(org.eclipse.debug.core.DebugException)

Aggregations

FMThread (com.liferay.ide.portal.core.debug.fm.FMThread)2 FMStackFrame (com.liferay.ide.portal.core.debug.fm.FMStackFrame)1 Breakpoint (freemarker.debug.Breakpoint)1 DebugException (org.eclipse.debug.core.DebugException)1 IBreakpoint (org.eclipse.debug.core.model.IBreakpoint)1 IThread (org.eclipse.debug.core.model.IThread)1