Java源码示例:org.eclipse.debug.core.model.ISuspendResume
示例1
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;
}
示例2
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;
}
}
}
}
示例3
@Override
public boolean canRunToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) {
return true;
}
示例4
@Override
public boolean canSetNextToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) {
return true;
}
示例5
/**
*
* @param part
* @param selection
* @param target
* @throws CoreException
*/
public boolean setNextToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException;
示例6
/**
*
* @param part
* @param selection
* @param target
* @return
*/
public boolean canSetNextToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target);