mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 09:25:31 +02:00
Implementation of 'Run To Line' action.
This commit is contained in:
parent
4b389fbd48
commit
5c2a979441
2 changed files with 30 additions and 7 deletions
|
@ -136,12 +136,7 @@ public abstract class AbstractEditorActionDelegate implements IWorkbenchWindowAc
|
|||
{
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.ISelectionListener#selectionChanged(IWorkbenchPart, ISelection)
|
||||
*/
|
||||
public void selectionChanged( IWorkbenchPart part, ISelection selection )
|
||||
{
|
||||
}
|
||||
public abstract void selectionChanged( IWorkbenchPart part, ISelection selection );
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IActionDelegate#run(IAction)
|
||||
|
|
|
@ -14,11 +14,14 @@ 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.IDebugUIConstants;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.ui.IEditorInput;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IFileEditorInput;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.texteditor.ITextEditor;
|
||||
|
||||
/**
|
||||
|
@ -74,6 +77,31 @@ public class RunToLineActionDelegate extends AbstractEditorActionDelegate
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.ISelectionListener#selectionChanged(IWorkbenchPart, ISelection)
|
||||
*/
|
||||
public void selectionChanged( IWorkbenchPart part, ISelection selection )
|
||||
{
|
||||
IDebugTarget target = null;
|
||||
if ( part.getSite().getId().equals( IDebugUIConstants.ID_DEBUG_VIEW ) )
|
||||
{
|
||||
if ( selection != null && selection instanceof IStructuredSelection )
|
||||
{
|
||||
Object element = ((IStructuredSelection)selection).getFirstElement();
|
||||
if ( element != null && element instanceof IDebugElement )
|
||||
{
|
||||
IDebugTarget target1 = ((IDebugElement)element).getDebugTarget();
|
||||
if ( target1 != null && target1 instanceof IRunToLine )
|
||||
{
|
||||
target = target1;
|
||||
}
|
||||
}
|
||||
}
|
||||
setDebugTarget( target );
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
protected void runToLine( IResource resource, int lineNumber )
|
||||
{
|
||||
if ( !((IRunToLine)getDebugTarget()).canRunToLine( resource, lineNumber ) )
|
||||
|
|
Loading…
Add table
Reference in a new issue