public boolean canRunToLine( IWorkbenchPart part, ISelection selection, ISuspendResume target ) { if ( target instanceof ScriptDebugElement ) { IDebugElement element = (IDebugElement) target; ScriptDebugTarget adapter = (ScriptDebugTarget) element.getDebugTarget( ) .getAdapter( IDebugTarget.class ); return adapter != null; } return false; }
ISuspendResume getSuspendResumeAspect() { return suspendResumeAspect; }
@Override ISuspendResume getSuspendResume() { return singleThread.getSuspendResumeAspect(); }
@Override ISuspendResume getSuspendResume() { return STUB_SUSPEND_RESUME; }
public void runToLine( IWorkbenchPart part, ISelection selection, ISuspendResume target ) throws CoreException { ITextEditor textEditor = getTextEditor( part ); if ( textEditor == null ) { return; } else { IEditorInput input = textEditor.getEditorInput( ); if ( input == null || !( input instanceof DebugJsInput ) ) { return; } DebugJsInput scriptInput = (DebugJsInput) input; IResource resource = (IResource) input.getAdapter( IResource.class ); if ( resource == null ) { resource = ScriptDebugUtil.getDefaultResource( ); } final IDocument document = textEditor.getDocumentProvider( ) .getDocument( input ); if ( document == null ) { return; } else { final int[] validLine = new int[1]; // final String[] typeName = new String[1]; final int[] lineNumber = new int[1]; final ITextSelection textSelection = (ITextSelection) selection; Runnable r = new Runnable( ) { public void run( ) { lineNumber[0] = textSelection.getStartLine( ) + 1; } }; BusyIndicator.showWhile( DebugUI.getStandardDisplay( ), r ); // TODO add the validLine to adjust if the line is validLine validLine[0] = lineNumber[0]; if ( validLine[0] == lineNumber[0] ) { ScriptLineBreakpoint point = new RunToLinebreakPoint( resource, scriptInput.getFile( ).getAbsolutePath( ), scriptInput.getId( ), lineNumber[0] ); point.setType( ScriptLineBreakpoint.RUNTOLINE ); if ( target instanceof IAdaptable ) { ScriptDebugTarget debugTarget = (ScriptDebugTarget) ( (IAdaptable) target ).getAdapter( IDebugTarget.class ); if ( debugTarget != null ) { debugTarget.breakpointAdded( point ); debugTarget.resume( ); } } } else { // invalid line return; } } } }
@Override public boolean canRunToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) { return true; }
@Override public boolean canSetNextToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) { return true; }
/** * * @param part * @param selection * @param target * @throws CoreException */ public boolean setNextToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException;
/** * * @param part * @param selection * @param target * @return */ public boolean canSetNextToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target);
abstract ISuspendResume getSuspendResume();