1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-08 08:45:44 +02:00

Fix for bug 73920: Stopping CDT debug at a break point and using a non-text editor throws an error.

This commit is contained in:
Mikhail Khodjaiants 2004-09-20 21:05:48 +00:00
parent c9db949d2b
commit f172ffa642
4 changed files with 18 additions and 10 deletions

View file

@ -1,3 +1,9 @@
2004-09-20 Mikhail Khodjaiants
Fix for bug 73920: Stopping CDT debug at a break point and using a non-text editor throws an error.
* ResumeAtLineActionDelegate.java
* RunToLineAdapter.java
* ToggleBreakpointAdapter.java
2004-09-20 Mikhail Khodjaiants 2004-09-20 Mikhail Khodjaiants
Evaluate expressions on stack frame instead of target to provide evaluation context. Evaluate expressions on stack frame instead of target to provide evaluation context.
Evaluate the hovering expression for the selected context only. Evaluate the hovering expression for the selected context only.

View file

@ -222,6 +222,9 @@ public class ResumeAtLineActionDelegate implements IWorkbenchWindowActionDelegat
if ( input == null ) { if ( input == null ) {
return false; return false;
} }
if ( !(editorPart instanceof ITextEditor) ) {
return false;
}
ITextEditor textEditor = (ITextEditor)editorPart; ITextEditor textEditor = (ITextEditor)editorPart;
IDocument document = textEditor.getDocumentProvider().getDocument( input ); IDocument document = textEditor.getDocumentProvider().getDocument( input );
if ( document == null ) { if ( document == null ) {

View file

@ -31,7 +31,6 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IStorageEditorInput; import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPart;
@ -50,14 +49,13 @@ public class RunToLineAdapter implements IRunToLineTarget {
*/ */
public void runToLine( IWorkbenchPart part, ISelection selection, ISuspendResume target ) throws CoreException { public void runToLine( IWorkbenchPart part, ISelection selection, ISuspendResume target ) throws CoreException {
String errorMessage = null; String errorMessage = null;
if ( part instanceof IEditorPart ) { if ( part instanceof ITextEditor ) {
IEditorPart editorPart = (IEditorPart)part; ITextEditor textEditor = (ITextEditor)part;
IEditorInput input = editorPart.getEditorInput(); IEditorInput input = textEditor.getEditorInput();
if ( input == null ) { if ( input == null ) {
errorMessage = ActionMessages.getString( "RunToLineAdapter.Empty_editor_1" ); //$NON-NLS-1$ errorMessage = ActionMessages.getString( "RunToLineAdapter.Empty_editor_1" ); //$NON-NLS-1$
} }
else { else {
ITextEditor textEditor = (ITextEditor)editorPart;
IDocument document = textEditor.getDocumentProvider().getDocument( input ); IDocument document = textEditor.getDocumentProvider().getDocument( input );
if ( document == null ) { if ( document == null ) {
errorMessage = ActionMessages.getString( "RunToLineAdapter.Missing_document_1" ); //$NON-NLS-1$ errorMessage = ActionMessages.getString( "RunToLineAdapter.Missing_document_1" ); //$NON-NLS-1$
@ -107,7 +105,9 @@ public class RunToLineAdapter implements IRunToLineTarget {
* org.eclipse.debug.core.model.ISuspendResume) * org.eclipse.debug.core.model.ISuspendResume)
*/ */
public boolean canRunToLine( IWorkbenchPart part, ISelection selection, ISuspendResume target ) { public boolean canRunToLine( IWorkbenchPart part, ISelection selection, ISuspendResume target ) {
return target instanceof IDebugElement && ((IDebugElement)target).getModelIdentifier().equals( CDIDebugModel.getPluginIdentifier() ); if ( part instanceof DisassemblyView || part instanceof ITextEditor )
return target instanceof IDebugElement && ((IDebugElement)target).getModelIdentifier().equals( CDIDebugModel.getPluginIdentifier() );
return false;
} }
private String getFileName( IEditorInput input ) throws CoreException { private String getFileName( IEditorInput input ) throws CoreException {

View file

@ -55,14 +55,13 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
*/ */
public void toggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException { public void toggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
String errorMessage = null; String errorMessage = null;
if ( part instanceof IEditorPart ) { if ( part instanceof ITextEditor ) {
IEditorPart editorPart = (IEditorPart)part; ITextEditor textEditor = (ITextEditor)part;
IEditorInput input = editorPart.getEditorInput(); IEditorInput input = textEditor.getEditorInput();
if ( input == null ) { if ( input == null ) {
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Empty_editor_1" ); //$NON-NLS-1$ errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Empty_editor_1" ); //$NON-NLS-1$
} }
else { else {
ITextEditor textEditor = (ITextEditor)editorPart;
IDocument document = textEditor.getDocumentProvider().getDocument( input ); IDocument document = textEditor.getDocumentProvider().getDocument( input );
if ( document == null ) { if ( document == null ) {
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Missing_document_1" ); //$NON-NLS-1$ errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Missing_document_1" ); //$NON-NLS-1$