mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fixes for 'Run to line' actions.
This commit is contained in:
parent
063ca7472b
commit
2ef1e13e0b
3 changed files with 37 additions and 38 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2002-11-28 Mikhail Khodjaiants
|
||||||
|
Fixes for 'Run to line' actions.
|
||||||
|
* RunToLineActionDelegate.java
|
||||||
|
* RunToLineRulerAction.java
|
||||||
|
|
||||||
2002-11-28 Mikhail Khodjaiants
|
2002-11-28 Mikhail Khodjaiants
|
||||||
Live editing of the memory view.
|
Live editing of the memory view.
|
||||||
* SaveMemoryChangesAction.java - removed
|
* SaveMemoryChangesAction.java - removed
|
||||||
|
|
|
@ -104,18 +104,22 @@ public class RunToLineActionDelegate extends AbstractEditorActionDelegate
|
||||||
|
|
||||||
protected void runToLine( IResource resource, int lineNumber )
|
protected void runToLine( IResource resource, int lineNumber )
|
||||||
{
|
{
|
||||||
if ( !((IRunToLine)getDebugTarget()).canRunToLine( resource, lineNumber ) )
|
IRunToLine target = (IRunToLine)getDebugTarget().getAdapter( IRunToLine.class );
|
||||||
|
if ( target != null )
|
||||||
{
|
{
|
||||||
getTargetPart().getSite().getShell().getDisplay().beep();
|
if ( !target.canRunToLine( resource, lineNumber ) )
|
||||||
return;
|
{
|
||||||
}
|
getTargetPart().getSite().getShell().getDisplay().beep();
|
||||||
try
|
return;
|
||||||
{
|
}
|
||||||
((IRunToLine)getDebugTarget()).runToLine( resource, lineNumber );
|
try
|
||||||
}
|
{
|
||||||
catch( DebugException e )
|
target.runToLine( resource, lineNumber );
|
||||||
{
|
}
|
||||||
CDebugUIPlugin.errorDialog( e.getMessage(), e );
|
catch( DebugException e )
|
||||||
|
{
|
||||||
|
CDebugUIPlugin.errorDialog( e.getMessage(), e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,6 @@ import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.model.IDebugElement;
|
|
||||||
import org.eclipse.debug.core.model.IDebugTarget;
|
|
||||||
import org.eclipse.debug.ui.DebugUITools;
|
import org.eclipse.debug.ui.DebugUITools;
|
||||||
import org.eclipse.debug.ui.IDebugUIConstants;
|
import org.eclipse.debug.ui.IDebugUIConstants;
|
||||||
import org.eclipse.jface.action.Action;
|
import org.eclipse.jface.action.Action;
|
||||||
|
@ -41,7 +39,7 @@ public class RunToLineRulerAction extends Action
|
||||||
{
|
{
|
||||||
private IVerticalRulerInfo fInfo;
|
private IVerticalRulerInfo fInfo;
|
||||||
private ITextEditor fTextEditor;
|
private ITextEditor fTextEditor;
|
||||||
private IDebugTarget fDebugTarget = null;
|
private IRunToLine fTarget = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for RunToLineRulerAction.
|
* Constructor for RunToLineRulerAction.
|
||||||
|
@ -51,7 +49,7 @@ public class RunToLineRulerAction extends Action
|
||||||
setInfo( info );
|
setInfo( info );
|
||||||
setTextEditor( editor );
|
setTextEditor( editor );
|
||||||
setText( "Run To Line" );
|
setText( "Run To Line" );
|
||||||
initializeDebugTarget();
|
initializeTarget();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +65,7 @@ public class RunToLineRulerAction extends Action
|
||||||
IDocument doc = provider.getDocument( getTextEditor().getEditorInput() );
|
IDocument doc = provider.getDocument( getTextEditor().getEditorInput() );
|
||||||
if ( resource != null && lineNumber <= doc.getNumberOfLines() && lineNumber > 0 )
|
if ( resource != null && lineNumber <= doc.getNumberOfLines() && lineNumber > 0 )
|
||||||
{
|
{
|
||||||
enabled = ( getDebugTarget() != null && ((IRunToLine)getDebugTarget()).canRunToLine( resource, lineNumber ) );
|
enabled = ( getTarget() != null && ((IRunToLine)getTarget()).canRunToLine( resource, lineNumber ) );
|
||||||
}
|
}
|
||||||
setEnabled( enabled );
|
setEnabled( enabled );
|
||||||
}
|
}
|
||||||
|
@ -85,48 +83,40 @@ public class RunToLineRulerAction extends Action
|
||||||
*/
|
*/
|
||||||
public void selectionChanged( IWorkbenchPart part, ISelection selection )
|
public void selectionChanged( IWorkbenchPart part, ISelection selection )
|
||||||
{
|
{
|
||||||
IDebugTarget target = null;
|
IRunToLine target = null;
|
||||||
if ( part.getSite().getId().equals( IDebugUIConstants.ID_DEBUG_VIEW ) )
|
if ( part.getSite().getId().equals( IDebugUIConstants.ID_DEBUG_VIEW ) )
|
||||||
{
|
{
|
||||||
if ( selection != null && selection instanceof IStructuredSelection )
|
if ( selection != null && selection instanceof IStructuredSelection )
|
||||||
{
|
{
|
||||||
Object element = ((IStructuredSelection)selection).getFirstElement();
|
Object element = ((IStructuredSelection)selection).getFirstElement();
|
||||||
if ( element != null && element instanceof IDebugElement )
|
if ( element != null && element instanceof IRunToLine )
|
||||||
{
|
{
|
||||||
IDebugTarget target1 = ((IDebugElement)element).getDebugTarget();
|
target = (IRunToLine)element;
|
||||||
if ( target1 != null && target1 instanceof IRunToLine )
|
|
||||||
{
|
|
||||||
target = target1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setDebugTarget( target );
|
setTarget( target );
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initializeDebugTarget()
|
protected void initializeTarget()
|
||||||
{
|
{
|
||||||
setDebugTarget( null );
|
setTarget( null );
|
||||||
IAdaptable context = DebugUITools.getDebugContext();
|
IAdaptable context = DebugUITools.getDebugContext();
|
||||||
if ( context != null && context instanceof IDebugElement )
|
if ( context != null && context instanceof IRunToLine )
|
||||||
{
|
{
|
||||||
IDebugTarget target = ((IDebugElement)context).getDebugTarget();
|
setTarget( (IRunToLine)context );
|
||||||
if ( target != null && target instanceof IRunToLine )
|
|
||||||
{
|
|
||||||
setDebugTarget( target );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setDebugTarget( IDebugTarget target )
|
protected void setTarget( IRunToLine target )
|
||||||
{
|
{
|
||||||
fDebugTarget = target;
|
fTarget = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IDebugTarget getDebugTarget()
|
protected IRunToLine getTarget()
|
||||||
{
|
{
|
||||||
return fDebugTarget;
|
return fTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IVerticalRulerInfo getInfo()
|
protected IVerticalRulerInfo getInfo()
|
||||||
|
@ -166,14 +156,14 @@ public class RunToLineRulerAction extends Action
|
||||||
|
|
||||||
protected void runToLine( IResource resource, int lineNumber )
|
protected void runToLine( IResource resource, int lineNumber )
|
||||||
{
|
{
|
||||||
if ( !((IRunToLine)getDebugTarget()).canRunToLine( resource, lineNumber ) )
|
if ( !((IRunToLine)getTarget()).canRunToLine( resource, lineNumber ) )
|
||||||
{
|
{
|
||||||
getTextEditor().getSite().getShell().getDisplay().beep();
|
getTextEditor().getSite().getShell().getDisplay().beep();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
((IRunToLine)getDebugTarget()).runToLine( resource, lineNumber );
|
((IRunToLine)getTarget()).runToLine( resource, lineNumber );
|
||||||
}
|
}
|
||||||
catch( DebugException e )
|
catch( DebugException e )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue