1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-19 23:15:24 +02:00

Bug 195984.

This commit is contained in:
Ken Ryall 2007-08-03 04:10:17 +00:00
parent 1561bd668d
commit 27bfb855d6
5 changed files with 43 additions and 38 deletions

View file

@ -35,6 +35,7 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
org.eclipse.cdt.core;bundle-version="[4.0.0,5.0.0)",
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui.console;bundle-version="[3.1.100,4.0.0)",
org.eclipse.ui.views;bundle-version="[3.2.0,4.0.0)"
org.eclipse.ui.views;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.filesystem
Eclipse-LazyStart: true
Bundle-RequiredExecutionEnvironment: J2SE-1.4

View file

@ -19,7 +19,11 @@ import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.model.ICType;
import org.eclipse.cdt.debug.core.model.ICValue;
import org.eclipse.cdt.debug.core.model.IEnableDisableTarget;
import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyEditorInput;
import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.core.model.IVariable;
@ -28,6 +32,11 @@ import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IPathEditorInput;
import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.IURIEditorInput;
/**
* Utility methods for C/C++ Debug UI.
@ -164,6 +173,32 @@ public class CDebugUIUtils {
return decorateText( variable, variable.getName() );
}
public static String getEditorFilePath( IEditorInput input ) throws CoreException {
if ( input instanceof IFileEditorInput ) {
return ((IFileEditorInput)input).getFile().getLocation().toOSString();
}
if ( input instanceof IStorageEditorInput ) {
return ((IStorageEditorInput)input).getStorage().getFullPath().toOSString();
}
if ( input instanceof IPathEditorInput ) {
return ((IPathEditorInput)input).getPath().toOSString();
}
if ( input instanceof DisassemblyEditorInput ) {
String sourceFile = ((DisassemblyEditorInput)input).getSourceFile();
if ( sourceFile != null ) {
return sourceFile;
}
return ((DisassemblyEditorInput)input).getModuleFile();
}
if ( input instanceof IURIEditorInput)
{
IPath uriPath = URIUtil.toPath(((IURIEditorInput)input).getURI());
if (uriPath != null)
return uriPath.toOSString();
}
return ""; //$NON-NLS-1$
}
public static String decorateText( Object element, String text ) {
if ( text == null )
return null;

View file

@ -19,6 +19,7 @@ import org.eclipse.cdt.debug.core.model.IJumpToLine;
import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants;
import org.eclipse.cdt.debug.internal.core.model.CDebugElement;
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector;
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyEditorInput;
import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView;
@ -40,8 +41,6 @@ import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.texteditor.ITextEditor;
@ -187,13 +186,7 @@ public class ResumeAtLineAdapter implements IResumeAtLineTarget {
}
private String getFileName( IEditorInput input ) throws CoreException {
if ( input instanceof IFileEditorInput ) {
return ((IFileEditorInput)input).getFile().getLocation().toOSString();
}
if ( input instanceof IStorageEditorInput ) {
return ((IStorageEditorInput)input).getStorage().getFullPath().toOSString();
}
return null;
return CDebugUIUtils.getEditorFilePath(input);
}
private void runInBackground( Runnable r ) {

View file

@ -19,6 +19,7 @@ import org.eclipse.cdt.debug.core.model.IRunToLine;
import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants;
import org.eclipse.cdt.debug.internal.core.model.CDebugElement;
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector;
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyEditorInput;
import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView;
@ -43,8 +44,6 @@ import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.texteditor.ITextEditor;
@ -191,13 +190,7 @@ public class RunToLineAdapter implements IRunToLineTarget {
}
private String getFileName( IEditorInput input ) throws CoreException {
if ( input instanceof IFileEditorInput ) {
return ((IFileEditorInput)input).getFile().getLocation().toOSString();
}
if ( input instanceof IStorageEditorInput ) {
return ((IStorageEditorInput)input).getStorage().getFullPath().toOSString();
}
return null;
return CDebugUIUtils.getEditorFilePath(input);
}
private void runInBackground( Runnable r ) {

View file

@ -25,6 +25,7 @@ import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyEditorInput;
import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView;
@ -48,8 +49,6 @@ import org.eclipse.jface.window.Window;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IPathEditorInput;
import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.editors.text.ILocationProvider;
import org.eclipse.ui.texteditor.IEditorStatusLine;
@ -325,23 +324,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
}
private String getSourceHandle( IEditorInput input ) throws CoreException {
if ( input instanceof IFileEditorInput ) {
return ((IFileEditorInput)input).getFile().getLocation().toOSString();
}
if ( input instanceof IStorageEditorInput ) {
return ((IStorageEditorInput)input).getStorage().getFullPath().toOSString();
}
if ( input instanceof IPathEditorInput ) {
return ((IPathEditorInput)input).getPath().toOSString();
}
if ( input instanceof DisassemblyEditorInput ) {
String sourceFile = ((DisassemblyEditorInput)input).getSourceFile();
if ( sourceFile != null ) {
return sourceFile;
}
return ((DisassemblyEditorInput)input).getModuleFile();
}
return ""; //$NON-NLS-1$
return CDebugUIUtils.getEditorFilePath(input);
}
private void toggleVariableWatchpoint( IWorkbenchPart part, IVariable variable ) throws CoreException {