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

Bug 159955, enable the source not found editor for DSF.

This commit is contained in:
Ken Ryall 2009-11-10 22:06:46 +00:00
parent f3ca785ec5
commit dcd0c58abf
6 changed files with 35 additions and 51 deletions

View file

@ -20,7 +20,7 @@ Export-Package: org.eclipse.cdt.debug.core,
org.eclipse.cdt.debug.internal.core.breakpoints;x-internal:=true, org.eclipse.cdt.debug.internal.core.breakpoints;x-internal:=true,
org.eclipse.cdt.debug.internal.core.executables;x-internal:=true, org.eclipse.cdt.debug.internal.core.executables;x-internal:=true,
org.eclipse.cdt.debug.internal.core.model;x-internal:=true, org.eclipse.cdt.debug.internal.core.model;x-internal:=true,
org.eclipse.cdt.debug.internal.core.sourcelookup;x-internal:=true org.eclipse.cdt.debug.internal.core.sourcelookup;x-friends:="org.eclipse.cdt.dsf.ui"
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)", Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)", org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)",
org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)", org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)",

View file

@ -94,7 +94,7 @@ public class CSourceLookupParticipant extends AbstractSourceLookupParticipant {
if ( name == null || name.length() == 0 ) if ( name == null || name.length() == 0 )
{ {
if (object instanceof IDebugElement) if (object instanceof IDebugElement)
return new Object[] { new CSourceNotFoundElement( (IDebugElement) object ) }; return new Object[] { new CSourceNotFoundElement((IDebugElement) object, ((IDebugElement) object).getLaunch().getLaunchConfiguration(), name) };
else else
return new Object[] { gfNoSource }; return new Object[] { gfNoSource };
} }
@ -121,7 +121,7 @@ public class CSourceLookupParticipant extends AbstractSourceLookupParticipant {
if (new File(name).exists()) { if (new File(name).exists()) {
foundElements = new AbsolutePathSourceContainer().findSourceElements(name); foundElements = new AbsolutePathSourceContainer().findSourceElements(name);
} else { } else {
foundElements = new Object[] { new CSourceNotFoundElement((IDebugElement) object) }; foundElements = new Object[] { new CSourceNotFoundElement((IDebugElement) object, ((IDebugElement) object).getLaunch().getLaunchConfiguration(), name) };
} }
} }

View file

@ -11,54 +11,37 @@
package org.eclipse.cdt.debug.internal.core.sourcelookup; package org.eclipse.cdt.debug.internal.core.sourcelookup;
import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IDebugTarget;
/** /**
* Wrapper for debug elements that have missing source, for example a stack frame * Wrapper for debug elements that have missing source, for example a stack
* whose source file can not be located. Used to enable the CSourceNotFoundEditor * frame whose source file can not be located. Used to enable the
* that will let you find the missing file. * CSourceNotFoundEditor that will let you find the missing file.
* *
*/ */
public class CSourceNotFoundElement implements IDebugElement{ public class CSourceNotFoundElement {
private IDebugElement element; private IAdaptable element;
private ILaunchConfiguration launch;
private String file;
public IDebugElement getElement() { public IAdaptable getElement() {
return element; return element;
} }
public CSourceNotFoundElement(IDebugElement element) public CSourceNotFoundElement(IAdaptable element, ILaunchConfiguration launch, String file) {
{
this.element = element; this.element = element;
this.launch = launch;
this.file = file;
} }
public IDebugTarget getDebugTarget() { public ILaunchConfiguration getLaunch() {
return element.getDebugTarget(); return launch;
}
public ILaunch getLaunch() {
return element.getLaunch();
}
public String getModelIdentifier() {
return element.getModelIdentifier();
}
public Object getAdapter(Class adapter) {
return element.getAdapter(adapter);
} }
public String getFile() { public String getFile() {
ICStackFrame frame = (ICStackFrame)((IAdaptable)element).getAdapter( ICStackFrame.class ); return file;
if ( frame != null ) {
return frame.getFile().trim();
}
return "";
} }
} }

View file

@ -13,7 +13,7 @@ Export-Package:
org.eclipse.cdt.debug.internal.ui.editors;x-internal:=true, org.eclipse.cdt.debug.internal.ui.editors;x-internal:=true,
org.eclipse.cdt.debug.internal.ui.preferences;x-internal:=true, org.eclipse.cdt.debug.internal.ui.preferences;x-internal:=true,
org.eclipse.cdt.debug.internal.ui.propertypages;x-internal:=true, org.eclipse.cdt.debug.internal.ui.propertypages;x-internal:=true,
org.eclipse.cdt.debug.internal.ui.sourcelookup;x-internal:=true, org.eclipse.cdt.debug.internal.ui.sourcelookup;x-friends:="org.eclipse.cdt.dsf.ui",
org.eclipse.cdt.debug.internal.ui.views;x-internal:=true, org.eclipse.cdt.debug.internal.ui.views;x-internal:=true,
org.eclipse.cdt.debug.internal.ui.views.disassembly;x-internal:=true, org.eclipse.cdt.debug.internal.ui.views.disassembly;x-internal:=true,
org.eclipse.cdt.debug.internal.ui.views.executables;x-internal:=true, org.eclipse.cdt.debug.internal.ui.views.executables;x-internal:=true,

View file

@ -12,7 +12,6 @@
package org.eclipse.cdt.debug.internal.ui.sourcelookup; package org.eclipse.cdt.debug.internal.ui.sourcelookup;
import com.ibm.icu.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
@ -31,14 +30,13 @@ import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.filesystem.URIUtil; import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.ISourceLocator; import org.eclipse.debug.core.model.ISourceLocator;
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector; import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
import org.eclipse.debug.core.sourcelookup.ISourceContainer; import org.eclipse.debug.core.sourcelookup.ISourceContainer;
@ -57,6 +55,8 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException; import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
import com.ibm.icu.text.MessageFormat;
/** /**
* Editor that lets you select a replacement for the missing source file * Editor that lets you select a replacement for the missing source file
* and modifies the source locator accordingly. * and modifies the source locator accordingly.
@ -72,8 +72,8 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
public static final String UID_EDIT_LOOKUP_BUTTON = UID_CLASS_NAME+ "editLookupButton"; //$NON-NLS-1$ public static final String UID_EDIT_LOOKUP_BUTTON = UID_CLASS_NAME+ "editLookupButton"; //$NON-NLS-1$
private String missingFile; private String missingFile;
private ILaunch launch; private ILaunchConfiguration launch;
private IDebugElement context; private IAdaptable context;
private ITranslationUnit tunit; private ITranslationUnit tunit;
private Button disassemblyButton; private Button disassemblyButton;
@ -238,7 +238,7 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
String memento = null; String memento = null;
String type = null; String type = null;
ILaunchConfigurationWorkingCopy configuration = launch.getLaunchConfiguration().getWorkingCopy(); ILaunchConfigurationWorkingCopy configuration = launch.getWorkingCopy();
memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String) null); memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String) null);
type = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, (String) null); type = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, (String) null);
if (type == null) { if (type == null) {

View file

@ -21,6 +21,9 @@ import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceNotFoundElement;
import org.eclipse.cdt.debug.internal.ui.sourcelookup.CSourceNotFoundEditorInput;
import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.DsfExecutor; import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
import org.eclipse.cdt.dsf.concurrent.DsfRunnable; import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
@ -55,9 +58,7 @@ import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant; import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;
import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage; import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;
import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.ISourcePresentation; import org.eclipse.debug.ui.ISourcePresentation;
import org.eclipse.debug.ui.sourcelookup.CommonSourceNotFoundEditorInput;
import org.eclipse.debug.ui.sourcelookup.ISourceDisplay; import org.eclipse.debug.ui.sourcelookup.ISourceDisplay;
import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocument;
@ -183,7 +184,7 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
return Status.OK_STATUS; return Status.OK_STATUS;
} }
private SourceLookupResult performLookup() { private SourceLookupResult performLookup() {
IDMContext dmc = fFrameData.fDmc; IDMContext dmc = fFrameData.fDmc;
SourceLookupResult result = new SourceLookupResult(dmc , null, null, null); SourceLookupResult result = new SourceLookupResult(dmc , null, null, null);
String editorId = null; String editorId = null;
@ -191,8 +192,8 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
Object sourceElement = fSourceLookup.getSourceElement(dmc); Object sourceElement = fSourceLookup.getSourceElement(dmc);
if (sourceElement == null) { if (sourceElement == null) {
editorInput = new CommonSourceNotFoundEditorInput(dmc); editorInput = new CSourceNotFoundEditorInput(new CSourceNotFoundElement(dmc, fSourceLookup.getLaunchConfiguration(), fFrameData.fFile));
editorId = IDebugUIConstants.ID_COMMON_SOURCE_NOT_FOUND_EDITOR; editorId = ICDebugUIConstants.CSOURCENOTFOUND_EDITOR_ID;
} else { } else {
ISourcePresentation presentation= null; ISourcePresentation presentation= null;
if (fSourceLookup instanceof ISourcePresentation) { if (fSourceLookup instanceof ISourcePresentation) {
@ -217,8 +218,8 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
editorInput = new FileStoreEditorInput(fileStore); editorInput = new FileStoreEditorInput(fileStore);
editorId = getEditorIdForFilename(fileStore.getName()); editorId = getEditorIdForFilename(fileStore.getName());
} catch (CoreException e) { } catch (CoreException e) {
editorInput = new CommonSourceNotFoundEditorInput(dmc); editorInput = new CSourceNotFoundEditorInput(new CSourceNotFoundElement(dmc, fSourceLookup.getLaunchConfiguration(), fFrameData.fFile));
editorId = IDebugUIConstants.ID_COMMON_SOURCE_NOT_FOUND_EDITOR; editorId = ICDebugUIConstants.CSOURCENOTFOUND_EDITOR_ID;
} }
} else if (sourceElement instanceof LocalFileStorage) { } else if (sourceElement instanceof LocalFileStorage) {
File file = ((LocalFileStorage)sourceElement).getFile(); File file = ((LocalFileStorage)sourceElement).getFile();