Index:
ChangeLog =================================================================== RCS
file: /home/tools/org.eclipse.cdt.debug.ui/ChangeLog,v retrieving revision
1.107 diff -u -r1.107 ChangeLog --- ChangeLog 28 Feb 2003 21:38:48
-0000 1.107 +++ ChangeLog 6 Mar 2003 00:12:06 -0000 @@ -1,3
+1,16 @@ +2003-03-05 Mikhail Khodjaiants + The extension of CEditor
that displays the 'Source Not Found' form. + *
plugin.properties + * plugin.xml + *
CDTDebugModelPresentation.java + * AttachSourceEditor.java:
removed + * AttachSourceEditorInput.java: removed + *
FileNotFoundElement.java: new + * CDebugDocumentProvider.java:
new + * CDebugEditor.java: new + * EditorInputDelegate.java:
new + *
ManageBreakpointRulerActionDelegate.java + 2003-02-28 Mikhail
Khodjaiants Check if part is not null when set the
selection. * AddExpressionActionDelegate.java Index:
plugin.properties =================================================================== RCS
file: /home/tools/org.eclipse.cdt.debug.ui/plugin.properties,v retrieving
revision 1.36 diff -u -r1.36 plugin.properties ---
plugin.properties 21 Feb 2003 23:42:58 -0000 1.36 +++
plugin.properties 6 Mar 2003 00:12:06 -0000 @@ -56,6 +56,7
@@ DisassemblyEditor.name=Disassembly
Editor AttachSourceEditor.name= Attach Source
Editor +CDebugEditor.name= C/C++ Debug
Editor LoadSymbolsAction.label=Load
Symbols SignalAction.label=Resume With Signal Index:
plugin.xml =================================================================== RCS
file: /home/tools/org.eclipse.cdt.debug.ui/plugin.xml,v retrieving revision
1.55 diff -u -r1.55 plugin.xml --- plugin.xml 21 Feb 2003 23:42:58
-0000 1.55 +++ plugin.xml 6 Mar 2003 00:12:08 -0000 @@ -965,6
+965,22 @@
</action>
</editorContribution>
<editorContribution +
targetID="org.eclipse.cdt.debug.ui.editor.CDebugEditor" +
id="org.eclipse.cdt.debug.ui.CEditor.BreakpointRulerActions"> +
<action +
label="%Dummy.label" +
class="org.eclipse.cdt.debug.internal.ui.actions.ManageBreakpointRulerActionDelegate" +
actionID="RulerDoubleClick" +
id="org.eclipse.cdt.debug.ui.CEditor.ManageBreakpointRulerAction"> +
<enablement> +
<pluginState +
value="activated" +
id="org.eclipse.cdt.debug.ui"> +
</pluginState> +
</enablement> +
</action> +
</editorContribution> +
<editorContribution
targetID="org.eclipse.cdt.ui.editor.asm.AsmEditor"
id="org.eclipse.cdt.ui.editor.asm.AsmEditor.BreakpointRulerActions">
<action @@ -1091,10 +1107,10
@@
id="org.eclipse.cdt.debug.ui.DisassemblyEditor">
</editor>
<editor -
name="%AttachSourceEditor.name" +
name="%CDebugEditor.name"
icon="icons/full/obj16/filenotfound_obj.gif" -
class="org.eclipse.cdt.debug.internal.ui.editors.AttachSourceEditor" -
id="org.eclipse.cdt.debug.ui.editor.AttachSourceEditor"> +
class="org.eclipse.cdt.debug.internal.ui.editors.CDebugEditor" +
id="org.eclipse.cdt.debug.ui.editor.CDebugEditor">
</editor> </extension> Index:
src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java =================================================================== RCS
file:
/home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java,v retrieving
revision 1.42 diff -u -r1.42 CDTDebugModelPresentation.java ---
src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java 21 Feb
2003 23:42:58 -0000 1.42 +++
src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java 6 Mar
2003 00:12:09 -0000 @@ -34,9 +34,9 @@ import
org.eclipse.cdt.debug.core.sourcelookup.IDisassemblyStorage; import
org.eclipse.cdt.debug.internal.core.CDebugUtils; import
org.eclipse.cdt.debug.internal.core.sourcelookup.DisassemblyManager; -import
org.eclipse.cdt.debug.internal.ui.editors.AttachSourceEditor; -import
org.eclipse.cdt.debug.internal.ui.editors.AttachSourceEditorInput; +import
org.eclipse.cdt.debug.internal.ui.editors.CDebugEditor; import
org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditorInput; +import
org.eclipse.cdt.debug.internal.ui.editors.EditorInputDelegate; import
org.eclipse.cdt.debug.internal.ui.editors.FileNotFoundElement; import
org.eclipse.cdt.debug.ui.CDebugUIPlugin; import
org.eclipse.cdt.internal.ui.util.ExternalEditorInput; @@ -164,7 +164,7
@@ } if ( element instanceof
FileNotFoundElement ) { - return new
AttachSourceEditorInput( (FileNotFoundElement)element
); + return new EditorInputDelegate(
(FileNotFoundElement)element
); } return
null; } @@ -174,17 +174,24 @@
*/ public String getEditorId( IEditorInput input, Object element
) { + if ( input instanceof EditorInputDelegate
) + { + if (
((EditorInputDelegate)input).getDelegate() == null
) + return
CDebugEditor.EDITOR_ID; + else + return
getEditorId( ((EditorInputDelegate)input).getDelegate(), element
); + } + + String id =
null; if ( input != null
) { - if ( input instanceof
AttachSourceEditorInput
) - { - return
AttachSourceEditor.EDITOR_ID; - } IEditorRegistry
registry =
PlatformUI.getWorkbench().getEditorRegistry(); IEditorDescriptor
descriptor = registry.getDefaultEditor( input.getName()
); - if ( descriptor != null
) - return
descriptor.getId(); - return
CUIPlugin.EDITOR_ID; + id = ( descriptor != null ) ?
descriptor.getId() : CUIPlugin.EDITOR_ID; + } + if (
CUIPlugin.EDITOR_ID.equals( id )
) + { + return
CDebugEditor.EDITOR_ID; } return
null; } Index:
src/org/eclipse/cdt/debug/internal/ui/actions/ManageBreakpointRulerActionDelegate.java =================================================================== RCS
file:
/home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ManageBreakpointRulerActionDelegate.java,v retrieving
revision 1.5 diff -u -r1.5 ManageBreakpointRulerActionDelegate.java ---
src/org/eclipse/cdt/debug/internal/ui/actions/ManageBreakpointRulerActionDelegate.java 10
Jan 2003 19:36:39 -0000 1.5 +++
src/org/eclipse/cdt/debug/internal/ui/actions/ManageBreakpointRulerActionDelegate.java 6
Mar 2003 00:12:11 -0000 @@ -6,6 +6,9 @@ package
org.eclipse.cdt.debug.internal.ui.actions; +import
org.eclipse.cdt.debug.internal.ui.editors.CDebugEditor; +import
org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditor; +import
org.eclipse.cdt.ui.CUIPlugin; import
org.eclipse.jface.action.IAction; import
org.eclipse.jface.text.source.IVerticalRulerInfo; import
org.eclipse.ui.IEditorPart; @@ -20,9 +23,7 @@ */ public
class ManageBreakpointRulerActionDelegate extends
AbstractRulerActionDelegate { - static final private String
C_EDITOR_ID = "org.eclipse.cdt.ui.editor.CEditor";
//$NON-NLS-1$ static final private String ASM_EDITOR_ID =
"org.eclipse.cdt.ui.editor.asm.AsmEditor"; //$NON-NLS-1$ - static final
private String DISASSEMBLY_EDITOR_ID =
"org.eclipse.cdt.debug.ui.DisassemblyEditor";
//$NON-NLS-1$ /** * @see
IEditorActionDelegate#setActiveEditor(IAction, IEditorPart) @@ -32,7 +33,10
@@ if ( targetEditor != null
) { String id =
targetEditor.getSite().getId(); - if ( !id.equals(
C_EDITOR_ID ) && !id.equals( ASM_EDITOR_ID ) && !id.equals(
DISASSEMBLY_EDITOR_ID ) ) + if ( !id.equals(
CDebugEditor.EDITOR_ID ) && + !id.equals(
CUIPlugin.EDITOR_ID ) && + !id.equals(
ASM_EDITOR_ID ) && + !id.equals(
DisassemblyEditor.DISASSEMBLY_EDITOR_ID )
) targetEditor =
null; } super.setActiveEditor(
callerAction, targetEditor ); Index:
src/org/eclipse/cdt/debug/internal/ui/editors/AttachSourceEditor.java =================================================================== RCS
file:
src/org/eclipse/cdt/debug/internal/ui/editors/AttachSourceEditor.java diff -N
src/org/eclipse/cdt/debug/internal/ui/editors/AttachSourceEditor.java ---
src/org/eclipse/cdt/debug/internal/ui/editors/AttachSourceEditor.java 21
Feb 2003 23:42:58 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00
-0000 @@ -1,382 +0,0 @@ -/* - *(c) Copyright QNX Software Systems Ltd.
2002. - * All Rights Reserved. - * - */ -package
org.eclipse.cdt.debug.internal.ui.editors; - -import
java.text.MessageFormat; -import java.util.ArrayList; -import
java.util.Arrays; -import java.util.List; - -import
org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation; -import
org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator; -import
org.eclipse.cdt.debug.internal.ui.wizards.AddDirectorySourceLocationWizard; -import
org.eclipse.cdt.debug.internal.ui.wizards.AddSourceLocationWizard; -import
org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import
org.eclipse.cdt.debug.ui.sourcelookup.INewSourceLocationWizard; -import
org.eclipse.core.resources.IMarker; -import
org.eclipse.core.runtime.CoreException; -import
org.eclipse.core.runtime.IAdaptable; -import
org.eclipse.core.runtime.IPath; -import
org.eclipse.core.runtime.IProgressMonitor; -import
org.eclipse.core.runtime.IStatus; -import
org.eclipse.core.runtime.Path; -import
org.eclipse.debug.core.ILaunch; -import
org.eclipse.debug.core.ILaunchConfiguration; -import
org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import
org.eclipse.debug.core.model.IPersistableSourceLocator; -import
org.eclipse.jface.resource.JFaceResources; -import
org.eclipse.jface.util.IPropertyChangeListener; -import
org.eclipse.jface.util.PropertyChangeEvent; -import
org.eclipse.jface.window.Window; -import
org.eclipse.jface.wizard.WizardDialog; -import
org.eclipse.swt.SWT; -import
org.eclipse.swt.custom.ScrolledComposite; -import
org.eclipse.swt.events.ControlEvent; -import
org.eclipse.swt.events.ControlListener; -import
org.eclipse.swt.events.DisposeEvent; -import
org.eclipse.swt.events.DisposeListener; -import
org.eclipse.swt.events.SelectionEvent; -import
org.eclipse.swt.events.SelectionListener; -import
org.eclipse.swt.graphics.Color; -import
org.eclipse.swt.graphics.Font; -import
org.eclipse.swt.graphics.Rectangle; -import
org.eclipse.swt.layout.GridData; -import
org.eclipse.swt.layout.GridLayout; -import
org.eclipse.swt.widgets.Button; -import
org.eclipse.swt.widgets.Composite; -import
org.eclipse.swt.widgets.Display; -import
org.eclipse.swt.widgets.Label; -import
org.eclipse.swt.widgets.ScrollBar; -import
org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorSite; -import
org.eclipse.ui.PartInitException; -import
org.eclipse.ui.part.EditorPart; - -/** - * Enter type comment. - *
- * @since: Feb 21, 2003 - */ -public class AttachSourceEditor extends
EditorPart - implements
IPropertyChangeListener -{ - public static final String EDITOR_ID =
CDebugUIPlugin.getUniqueIdentifier() +
".editor.AttachSourceEditor"; - - /** The horizontal scroll
increment. */ - private static final int HORIZONTAL_SCROLL_INCREMENT =
10; - /** The vertical scroll increment. */ - private static
final int VERTICAL_SCROLL_INCREMENT = 10; - - private
ScrolledComposite fScrolledComposite; - private Color
fBackgroundColor; - private Color fForegroundColor; - private
Color fSeparatorColor; - private List fBannerLabels= new
ArrayList(); - private List fHeaderLabels= new
ArrayList(); - private Font fFont; - private Button
fAttachButton; - private Label
fInputLabel; - - /** - * Constructor for
AttachSourceEditor. - */ - public
AttachSourceEditor() - { - super(); - } - - /*
(non-Javadoc) - * @see
org.eclipse.ui.IEditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor) -
*/ - public void doSave( IProgressMonitor monitor
) - { - } - - /* (non-Javadoc) - * @see
org.eclipse.ui.IEditorPart#doSaveAs() - */ - public void
doSaveAs() - { - } - - /* (non-Javadoc) - *
@see
org.eclipse.ui.IEditorPart#gotoMarker(org.eclipse.core.resources.IMarker) -
*/ - public void gotoMarker( IMarker marker
) - { - } - - /* (non-Javadoc) - * @see
org.eclipse.ui.IEditorPart#init(org.eclipse.ui.IEditorSite,
org.eclipse.ui.IEditorInput) - */ - public void init(
IEditorSite site, IEditorInput input ) throws
PartInitException - { - setInput( input
); - setSite( site ); - } - - /*
(non-Javadoc) - * @see org.eclipse.ui.IEditorPart#isDirty() -
*/ - public boolean isDirty() - { - return
false; - } - - /* (non-Javadoc) - * @see
org.eclipse.ui.IEditorPart#isSaveAsAllowed() - */ - public
boolean isSaveAsAllowed() - { - return
false; - } - - /* (non-Javadoc) - * @see
org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) -
*/ - public void createPartControl( Composite parent
) - { - Display display =
parent.getDisplay(); - fBackgroundColor = display.getSystemColor(
SWT.COLOR_LIST_BACKGROUND ); - fForegroundColor =
display.getSystemColor( SWT.COLOR_LIST_FOREGROUND
); - fSeparatorColor = new Color( display, 152, 170, 203
); - - JFaceResources.getFontRegistry().addListener( this
); - - fScrolledComposite = new ScrolledComposite( parent,
SWT.H_SCROLL | SWT.V_SCROLL
); - fScrolledComposite.setAlwaysShowScrollBars( false
); - fScrolledComposite.setExpandHorizontal( true
); - fScrolledComposite.setExpandVertical( true
); - fScrolledComposite.addDisposeListener(
- new
DisposeListener() - { - public
void widgetDisposed( DisposeEvent e
) - { - JFaceResources.getFontRegistry().removeListener(
AttachSourceEditor.this
); - fScrolledComposite
=
null; - fSeparatorColor.dispose(); - fSeparatorColor
=
null; - fBannerLabels.clear(); - fHeaderLabels.clear(); - if
( fFont != null
) - { - fFont.dispose(); - fFont
=
null; - } - } - }
); - - fScrolledComposite.addControlListener(
- new
ControlListener() - { - public
void controlMoved( ControlEvent e
) - { - } - - public
void controlResized( ControlEvent e
) - { - Rectangle
clientArea =
fScrolledComposite.getClientArea(); - - ScrollBar
verticalBar =
fScrolledComposite.getVerticalBar(); - verticalBar.setIncrement(
VERTICAL_SCROLL_INCREMENT
); - verticalBar.setPageIncrement(
clientArea.height - verticalBar.getIncrement()
); - - ScrollBar
horizontalBar =
fScrolledComposite.getHorizontalBar(); - horizontalBar.setIncrement(
HORIZONTAL_SCROLL_INCREMENT
); - horizontalBar.setPageIncrement(
clientArea.width - horizontalBar.getIncrement()
); - } - }); - - Composite
composite = createComposite( fScrolledComposite
); - composite.setLayout( new GridLayout()
); - - createTitleLabel( composite, "C/C++ File Editor"
); - createLabel( composite, null ); - createLabel(
composite, null ); - - createHeadingLabel( composite, "Source
not found" ); - - Composite separator =
createCompositeSeparator( composite ); - GridData data = ""
GridData( GridData.FILL_HORIZONTAL ); - data.heightHint =
2; - separator.setLayoutData( data
); - - fInputLabel = createLabel( composite, ""
); - createLabel( composite, "You can attach the source location
by pressing the button below:" ); - createLabel( composite, null
); - - fAttachButton = createButton( composite, "&Attach
Source..." ); - fAttachButton.addSelectionListener(
- new
SelectionListener() - { - public
void widgetSelected( SelectionEvent event
) - { - AttachSourceEditor.this.attachSourceLocation(); - } - - public
void widgetDefaultSelected( SelectionEvent e
) - { - } - }
); - - separator = createCompositeSeparator( composite
); - data = "" GridData( GridData.FILL_HORIZONTAL
); - data.heightHint = 2; - separator.setLayoutData(
data ); - - fScrolledComposite.setContent( composite
); - fScrolledComposite.setMinSize( composite.computeSize(
SWT.DEFAULT, SWT.DEFAULT ) ); - - if ( getEditorInput() != null
) - { - setInputLabelText(
getEditorInput().getName()
); - } - } - - private Composite
createComposite( Composite parent ) - { - Composite
composite = new Composite( parent, SWT.NONE
); - composite.setBackground( fBackgroundColor
); - return composite; - } - - private Label
createLabel( Composite parent, String text ) - { - Label
label = new Label( parent, SWT.NONE ); - if ( text != null
) - label.setText( text
); - label.setBackground( fBackgroundColor
); - label.setForeground( fForegroundColor
); - return label; - } - - private Label
createTitleLabel( Composite parent, String text
) - { - Label label = new Label( parent, SWT.NONE
); - if ( text != null ) - label.setText( text
); - label.setBackground( fBackgroundColor
); - label.setForeground( fForegroundColor
); - label.setFont( JFaceResources.getHeaderFont()
); - fHeaderLabels.add( label ); - return
label; - } - - private Label createHeadingLabel( Composite
parent, String text ) - { - Label label = new Label(
parent, SWT.NONE ); - if ( text != null
) - label.setText( text
); - label.setBackground( fBackgroundColor
); - label.setForeground( fForegroundColor
); - label.setFont( JFaceResources.getBannerFont()
); - fBannerLabels.add( label ); - return
label; - } - - private Composite createCompositeSeparator(
Composite parent ) - { - Composite composite = new
Composite( parent, SWT.NONE ); - composite.setBackground(
fSeparatorColor ); - return
composite; - } - - private Button createButton( Composite
parent, String text ) - { - Button button = new Button(
parent, SWT.FLAT ); - button.setBackground( fBackgroundColor
); - button.setForeground( fForegroundColor ); - if
( text != null ) - button.setText( text
); - return button; - } - - /*
(non-Javadoc) - * @see
org.eclipse.ui.IWorkbenchPart#setFocus() - */ - public void
setFocus() - { - if ( fAttachButton != null
) - fAttachButton.setFocus(); - } - - /*
(non-Javadoc) - * @see
org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -
*/ - public void propertyChange( PropertyChangeEvent event
) - { - } - - /* (non-Javadoc) - * @see
org.eclipse.ui.part.EditorPart#setInput(org.eclipse.ui.IEditorInput) -
*/ - protected void setInput( IEditorInput input
) - { - super.setInput( input ); - if (
input != null && fInputLabel != null
) - setInputLabelText( getEditorInput().getName()
); - } - - private void setInputLabelText( String
inputName ) - { - fInputLabel.setText(
MessageFormat.format( "There is no source for the file {0}", new String[] {
inputName } ) ); - } - - protected void
attachSourceLocation() - { - if ( getEditorInput() != null
&& getEditorInput().getAdapter( FileNotFoundElement.class ) != null
) - { - FileNotFoundElement element =
(FileNotFoundElement)getEditorInput().getAdapter( FileNotFoundElement.class
); - if ( element.getLaunch() != null &&
element.getLaunch().getSourceLocator() instanceof IAdaptable
) - { - ILaunch launch =
element.getLaunch(); - ICSourceLocator locator =
(ICSourceLocator)((IAdaptable)element.getLaunch().getSourceLocator()).getAdapter(
ICSourceLocator.class ); - if ( locator != null
) - { - IPath path =
new Path( element.getName()
); - INewSourceLocationWizard wizard =
null; - if ( path.isAbsolute()
) - { - path
= path.removeLastSegments( 1 ); - wizard =
new AddDirectorySourceLocationWizard( path
); - } - else - { - wizard
= new AddSourceLocationWizard( locator.getSourceLocations()
); - } - WizardDialog
dialog = new WizardDialog( CDebugUIPlugin.getActiveWorkbenchShell(), wizard
); - if ( dialog.open() == Window.OK
) - { - ICSourceLocation[]
locations =
locator.getSourceLocations(); - ArrayList
list = new ArrayList( Arrays.asList( locations )
); - list.add( wizard.getSourceLocation()
); - locator.setSourceLocations(
(ICSourceLocation[])list.toArray( new ICSourceLocation[list.size()] )
); - - if ( locator instanceof
IPersistableSourceLocator
) - { - ILaunchConfiguration
configuration =
launch.getLaunchConfiguration(); - saveChanges(
configuration, (IPersistableSourceLocator)launch.getSourceLocator()
); - } - } - } - } - } - } - - protected
void saveChanges( ILaunchConfiguration configuration, IPersistableSourceLocator
locator
) - { - try - { - ILaunchConfigurationWorkingCopy
copy = configuration.copy( configuration.getName()
); - copy.setAttribute(
ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, locator.getMemento()
); - copy.doSave(); - } - catch(
CoreException e
) - { - CDebugUIPlugin.errorDialog(
e.getMessage(), (IStatus)null ); - } - } -} Index:
src/org/eclipse/cdt/debug/internal/ui/editors/AttachSourceEditorInput.java =================================================================== RCS
file:
src/org/eclipse/cdt/debug/internal/ui/editors/AttachSourceEditorInput.java diff
-N
src/org/eclipse/cdt/debug/internal/ui/editors/AttachSourceEditorInput.java ---
src/org/eclipse/cdt/debug/internal/ui/editors/AttachSourceEditorInput.java 21
Feb 2003 23:42:58 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00
-0000 @@ -1,78 +0,0 @@ -/* - *(c) Copyright QNX Software Systems Ltd.
2002. - * All Rights Reserved. - * - */ -package
org.eclipse.cdt.debug.internal.ui.editors; - -import
org.eclipse.jface.resource.ImageDescriptor; -import
org.eclipse.ui.IEditorInput; -import
org.eclipse.ui.IPersistableElement; - -/** - * Enter type comment. -
* - * @since: Feb 21, 2003 - */ -public class AttachSourceEditorInput
implements IEditorInput -{ - private FileNotFoundElement fElement =
null; - - /** - * Constructor for
AttachSourceEditorInput. - */ - public AttachSourceEditorInput(
FileNotFoundElement element ) - { - fElement =
element; - } - - /* (non-Javadoc) - * @see
org.eclipse.ui.IEditorInput#exists() - */ - public boolean
exists() - { - return true; - } - - /*
(non-Javadoc) - * @see
org.eclipse.ui.IEditorInput#getImageDescriptor() - */ - public
ImageDescriptor getImageDescriptor() - { - return
null; - } - - /* (non-Javadoc) - * @see
org.eclipse.ui.IEditorInput#getName() - */ - public String
getName() - { - return ( fElement != null ) ?
fElement.getName() : ""; - } - - /* (non-Javadoc) -
* @see org.eclipse.ui.IEditorInput#getPersistable() -
*/ - public IPersistableElement
getPersistable() - { - return
null; - } - - /* (non-Javadoc) - * @see
org.eclipse.ui.IEditorInput#getToolTipText() - */ - public
String getToolTipText() - { - return
null; - } - - /* (non-Javadoc) - * @see
org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) -
*/ - public Object getAdapter( Class adapter
) - { - if ( adapter.equals( FileNotFoundElement.class )
) - return fElement; - return
null; - } -} Index:
src/org/eclipse/cdt/debug/internal/ui/editors/CDebugDocumentProvider.java =================================================================== RCS
file:
src/org/eclipse/cdt/debug/internal/ui/editors/CDebugDocumentProvider.java diff
-N
src/org/eclipse/cdt/debug/internal/ui/editors/CDebugDocumentProvider.java ---
/dev/null 1 Jan 1970 00:00:00 -0000 +++
src/org/eclipse/cdt/debug/internal/ui/editors/CDebugDocumentProvider.java 6
Mar 2003 00:12:10 -0000 @@ -0,0 +1,93 @@ +/* + *(c) Copyright QNX
Software Systems Ltd. 2002. + * All Rights Reserved. + * +
*/ +package org.eclipse.cdt.debug.internal.ui.editors; + +import
org.eclipse.cdt.debug.ui.CDebugUIPlugin; +import
org.eclipse.cdt.internal.ui.editor.CDocumentProvider; +import
org.eclipse.cdt.ui.CUIPlugin; +import
org.eclipse.core.resources.IStorage; +import
org.eclipse.core.runtime.CoreException; +import
org.eclipse.core.runtime.IStatus; +import
org.eclipse.core.runtime.Status; +import
org.eclipse.jface.text.IDocument; +import
org.eclipse.jface.text.IDocumentPartitioner; +import
org.eclipse.jface.text.source.IAnnotationModel; + +/** + * + *
Enter type comment. + * + * @since Mar 4, 2003 + */ +public class
CDebugDocumentProvider extends CDocumentProvider +{ + /** +
* @see
org.eclipse.ui.texteditor.AbstractDocumentProvider#createDocument(Object) +
*/ + protected IDocument createDocument( Object element ) throws
CoreException + { + if ( element instanceof
EditorInputDelegate ) + { + if (
((EditorInputDelegate)element).getDelegate() != null
) + { + return
super.createDocument( ((EditorInputDelegate)element).getDelegate()
); + } + else + { + IDocument
document = null; + IStorage storage =
((EditorInputDelegate)element).getStorage(); + if
( storage != null
) + { + document = new
CDocument(); + setDocumentContent( document,
storage.getContents(), getDefaultEncoding()
); + } + else
+ { + return
null; + } + if ( document !=
null)
+ { + IDocumentPartitioner
partitioner=
CUIPlugin.getDefault().getTextTools().createDocumentPartitioner(); + partitioner.connect(
document ); + document.setDocumentPartitioner(
partitioner ); + } + return
document; + } + } + return
super.createDocument( element ); + } + + /** + *
@see
org.eclipse.ui.texteditor.IDocumentProviderExtension#getStatus(Object) +
*/ + public IStatus getStatus( Object element
) + { + if ( element instanceof EditorInputDelegate
) + { + if (
((EditorInputDelegate)element).getDelegate() != null
) + { + return super.getStatus(
((EditorInputDelegate)element).getDelegate()
); + } + else + { + return
createFileNotFoundStatus( ((EditorInputDelegate)element).getElement()
); + } + } + return
super.getStatus( element ); + } + + private IStatus
createFileNotFoundStatus( FileNotFoundElement element
) + { + return new Status( IStatus.INFO,
CDebugUIPlugin.getUniqueIdentifier(), 0, "", null
); + } + + protected IAnnotationModel createAnnotationModel(
Object element ) throws CoreException + { + if ( element
instanceof EditorInputDelegate &&
((EditorInputDelegate)element).getDelegate() != null
) + return super.createAnnotationModel(
((EditorInputDelegate)element).getDelegate() ); + return
super.createAnnotationModel( element ); + } +} Index:
src/org/eclipse/cdt/debug/internal/ui/editors/CDebugEditor.java =================================================================== RCS
file: src/org/eclipse/cdt/debug/internal/ui/editors/CDebugEditor.java diff -N
src/org/eclipse/cdt/debug/internal/ui/editors/CDebugEditor.java ---
/dev/null 1 Jan 1970 00:00:00 -0000 +++
src/org/eclipse/cdt/debug/internal/ui/editors/CDebugEditor.java 6 Mar 2003
00:12:11 -0000 @@ -0,0 +1,495 @@ +/* + *(c) Copyright QNX Software
Systems Ltd. 2002. + * All Rights Reserved. + * + */ +package
org.eclipse.cdt.debug.internal.ui.editors; + +import
java.text.MessageFormat; +import java.util.ArrayList; +import
java.util.Arrays; +import java.util.Iterator; +import
java.util.List; + +import
org.eclipse.cdt.core.resources.FileStorage; +import
org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation; +import
org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator; +import
org.eclipse.cdt.debug.internal.ui.wizards.AddDirectorySourceLocationWizard; +import
org.eclipse.cdt.debug.internal.ui.wizards.AddSourceLocationWizard; +import
org.eclipse.cdt.debug.ui.CDebugUIPlugin; +import
org.eclipse.cdt.debug.ui.sourcelookup.INewSourceLocationWizard; +import
org.eclipse.cdt.internal.ui.editor.CEditor; +import
org.eclipse.cdt.internal.ui.util.ExternalEditorInput; +import
org.eclipse.core.resources.IFile; +import
org.eclipse.core.resources.IStorage; +import
org.eclipse.core.runtime.CoreException; +import
org.eclipse.core.runtime.IAdaptable; +import
org.eclipse.core.runtime.IPath; +import
org.eclipse.core.runtime.IStatus; +import
org.eclipse.debug.core.ILaunch; +import
org.eclipse.debug.core.ILaunchConfiguration; +import
org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import
org.eclipse.debug.core.model.IPersistableSourceLocator; +import
org.eclipse.debug.core.model.IStackFrame; +import
org.eclipse.debug.ui.IDebugUIConstants; +import
org.eclipse.debug.ui.IDebugView; +import
org.eclipse.jface.resource.JFaceResources; +import
org.eclipse.jface.util.IPropertyChangeListener; +import
org.eclipse.jface.util.PropertyChangeEvent; +import
org.eclipse.jface.viewers.StructuredSelection; +import
org.eclipse.jface.window.Window; +import
org.eclipse.jface.wizard.WizardDialog; +import
org.eclipse.swt.SWT; +import
org.eclipse.swt.custom.ScrolledComposite; +import
org.eclipse.swt.events.ControlEvent; +import
org.eclipse.swt.events.ControlListener; +import
org.eclipse.swt.events.DisposeEvent; +import
org.eclipse.swt.events.DisposeListener; +import
org.eclipse.swt.events.SelectionEvent; +import
org.eclipse.swt.events.SelectionListener; +import
org.eclipse.swt.graphics.Color; +import
org.eclipse.swt.graphics.Font; +import
org.eclipse.swt.graphics.Rectangle; +import
org.eclipse.swt.layout.GridData; +import
org.eclipse.swt.layout.GridLayout; +import
org.eclipse.swt.widgets.Button; +import
org.eclipse.swt.widgets.Composite; +import
org.eclipse.swt.widgets.Control; +import
org.eclipse.swt.widgets.Display; +import
org.eclipse.swt.widgets.Label; +import
org.eclipse.swt.widgets.ScrollBar; +import
org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IViewPart; +import
org.eclipse.ui.part.FileEditorInput; + +/** + * Enter type
comment. + * + * @since: Feb 26, 2003 + */ +public class
CDebugEditor extends CEditor +{ + public class AttachSourceForm
implements IPropertyChangeListener + { + /** The
horizontal scroll increment. */ + private static final int
HORIZONTAL_SCROLL_INCREMENT = 10; + /** The vertical scroll
increment. */ + private static final int VERTICAL_SCROLL_INCREMENT
= 10; + /** The form's root widget */ + private Font
fFont; + /** The form's root widget */ + private
ScrolledComposite fScrolledComposite; + /** The background color
*/ + private Color fBackgroundColor; + /** The
foreground color */ + private Color
fForegroundColor; + /** The separator's color
*/ + private Color fSeparatorColor; + /** The form
headers */ + private List fHeaderLabels = new
ArrayList(); + /** The form banners */ + private
List fBannerLabels = new ArrayList(); + /** The form text
*/ + private Label fInputLabel; + /** The attach
source button */ + private Button fAttachButton =
null; + /** The preference change listener
*/ + private IPropertyChangeListener
fPropertyChangeListener; + + private IEditorInput fInput =
null; + + public AttachSourceForm( Composite parent,
IEditorInput input ) + { + Display display =
parent.getDisplay(); + fBackgroundColor =
display.getSystemColor( SWT.COLOR_LIST_BACKGROUND
); + fForegroundColor = display.getSystemColor(
SWT.COLOR_LIST_FOREGROUND ); + fSeparatorColor = new Color(
display, 152, 170, 203
); + + JFaceResources.getFontRegistry().addListener(
AttachSourceForm.this ); + + fScrolledComposite = new
ScrolledComposite( parent, SWT.H_SCROLL | SWT.V_SCROLL
); + fScrolledComposite.setAlwaysShowScrollBars( false
); + fScrolledComposite.setExpandHorizontal( true
); + fScrolledComposite.setExpandVertical( true
); + fScrolledComposite.addDisposeListener( + new
DisposeListener()
+ { + public
void widgetDisposed( DisposeEvent e
) + { + JFaceResources.getFontRegistry().removeListener(
AttachSourceForm.this
); + setScrolledComposite(
null
); + getSeparatorColor().dispose(); + setSeparatorColor(
null
); + getBannerLabels().clear(); + getHeaderLabels().clear(); + if
( getFont() != null
) + { + getFont().dispose(); + setFont(
null
); + } + } + }
); + + fScrolledComposite.addControlListener( + new
ControlListener()
+ { + public
void controlMoved( ControlEvent e )
+ { + } + + public
void controlResized(ControlEvent
e) + { + Rectangle
clientArea =
getScrolledComposite().getClientArea(); + + ScrollBar
verticalBar =
getScrolledComposite().getVerticalBar(); + verticalBar.setIncrement(
VERTICAL_SCROLL_INCREMENT
); + verticalBar.setPageIncrement(
clientArea.height - verticalBar.getIncrement()
); + + ScrollBar
horizontalBar =
getScrolledComposite().getHorizontalBar(); + horizontalBar.setIncrement(
HORIZONTAL_SCROLL_INCREMENT
); + horizontalBar.setPageIncrement(
clientArea.width - horizontalBar.getIncrement()
); + } + }
); + + Composite composite = createComposite(
fScrolledComposite ); + composite.setLayout( new
GridLayout() ); + + createTitleLabel(
composite, "C/C++ File Editor" ); + createLabel( composite,
null ); + createLabel( composite, null
); + + createHeadingLabel( composite, "Source
not found" ); + + Composite separator =
createCompositeSeparator( composite ); + GridData data = ""
GridData( GridData.FILL_HORIZONTAL ); + data.heightHint =
2; + separator.setLayoutData( data
); + + fInputLabel = createLabel( composite, ""
); + createLabel( composite, "You can attach a new source
location by pressing the button below:" ); + createLabel(
composite, null ); + + fAttachButton = createButton(
composite, "&Attach Source..."
); + fAttachButton.addSelectionListener(
+ new
SelectionListener() + { + public
void widgetSelected( SelectionEvent event
) + { + attachSourceLocation(); + } + + public
void widgetDefaultSelected( SelectionEvent e
) + { + } + }
); + + separator = createCompositeSeparator( composite
); + data = "" GridData( GridData.FILL_HORIZONTAL
); + data.heightHint =
2; + separator.setLayoutData( data
); + + fScrolledComposite.setContent( composite
); + fScrolledComposite.setMinSize( composite.computeSize(
SWT.DEFAULT, SWT.DEFAULT ) ); + + if (
getEditorInput() != null
) + { + setInputLabelText(
getEditorInput()
); + } + + fInput =
input; + } + + private Composite createComposite(
Composite parent ) + { + Composite composite =
new Composite( parent, SWT.NONE
); + composite.setBackground( fBackgroundColor
); + return
composite; + } + + private Label createLabel(
Composite parent, String text ) + { + Label
label = new Label( parent, SWT.NONE ); + if ( text != null
) + label.setText( text
); + label.setBackground( fBackgroundColor
); + label.setForeground( fForegroundColor
); + return
label; + } + + private Label createTitleLabel(
Composite parent, String text ) + { + Label
label = new Label( parent, SWT.NONE ); + if ( text != null
) + label.setText( text
); + label.setBackground( fBackgroundColor
); + label.setForeground( fForegroundColor
); + label.setFont( JFaceResources.getHeaderFont()
); + fHeaderLabels.add( label
); + return
label; + } + + private Label createHeadingLabel(
Composite parent, String text ) + { + Label
label = new Label( parent, SWT.NONE ); + if ( text != null
) + label.setText( text
); + label.setBackground( fBackgroundColor
); + label.setForeground( fForegroundColor
); + label.setFont( JFaceResources.getBannerFont()
); + fBannerLabels.add( label
); + return
label; + } + + private Composite
createCompositeSeparator( Composite parent
) + { + Composite composite = new Composite(
parent, SWT.NONE ); + composite.setBackground(
fSeparatorColor ); + return
composite; + } + + private Button createButton(
Composite parent, String text ) + { + Button
button = new Button( parent, SWT.FLAT
); + button.setBackground( fBackgroundColor
); + button.setForeground( fForegroundColor
); + if ( text != null
) + button.setText( text
); + return
button; + } + + /* (non-Javadoc) +
* @see
org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) +
*/ + public void propertyChange( PropertyChangeEvent event
) + { + for ( Iterator iterator =
fBannerLabels.iterator(); iterator.hasNext();
) + { + Label label =
(Label)iterator.next(); + label.setFont(
JFaceResources.getBannerFont()
); + } + + for ( Iterator iterator =
fHeaderLabels.iterator(); iterator.hasNext();
) + { + Label label =
(Label)iterator.next(); + label.setFont(
JFaceResources.getHeaderFont()
); + } + + Control control =
fScrolledComposite.getContent(); + fScrolledComposite.setMinSize(
control.computeSize( SWT.DEFAULT, SWT.DEFAULT )
); + fScrolledComposite.setContent( control
); + + fScrolledComposite.layout( true
); + fScrolledComposite.redraw(); + } + + private
void setInputLabelText( IEditorInput input
) + { + FileNotFoundElement element =
(FileNotFoundElement)input.getAdapter( FileNotFoundElement.class
); + if ( element != null
) + { + IPath path =
element.getFullPath(); + String message =
""; + if ( path.isAbsolute()
) + message = MessageFormat.format( "The file
''{0}'' does not exist.", new String[] { element.getFullPath().toOSString() }
); + else + message =
MessageFormat.format( "The file ''{0}'' not found.", new String[] {
element.getFullPath().toOSString() }
); + fInputLabel.setText( message
); + } + } + + protected
ScrolledComposite
getScrolledComposite() + { + return
fScrolledComposite; + } + + protected void
setScrolledComposite( ScrolledComposite scrolledComposite
) + { + fScrolledComposite =
scrolledComposite; + } + + protected Color
getSeparatorColor() + { + return
fSeparatorColor; + } + + protected void
setSeparatorColor( Color separatorColor
) + { + fSeparatorColor =
separatorColor; + } + + protected List
getBannerLabels() + { + return
fBannerLabels; + } + + protected void
setBannerLabels( List bannerLabels
) + { + fBannerLabels =
bannerLabels; + } + + protected List
getHeaderLabels() + { + return
fHeaderLabels; + } + + protected void
setHeaderLabels( List headerLabels
) + { + fHeaderLabels =
headerLabels; + } + + protected Font
getFont() + { + return
fFont; + } + + protected void setFont( Font font
) + { + fFont =
font; + } + + public Control getControl()
+ { + return
fScrolledComposite; + } + + public
IEditorInput getInput() + { + return
fInput; + } + } + + public static final String
EDITOR_ID = CDebugUIPlugin.getUniqueIdentifier() +
".editor.CDebugEditor"; + + private AttachSourceForm
fAttachSourceForm = null; + + /** + * Constructor for
CDebugEditor. + */ + public
CDebugEditor() + { + super(); + setDocumentProvider(
CDebugUIPlugin.getDefault().getDocumentProvider()
); + } + + /* (non-Javadoc) + * @see
org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) +
*/ + public void createPartControl( Composite parent
) + { + super.createPartControl( parent
); + } + + /* (non-Javadoc) + * @see
org.eclipse.ui.texteditor.AbstractTextEditor#doSetInput(org.eclipse.ui.IEditorInput) +
*/ + protected void doSetInput( IEditorInput input ) throws
CoreException + { + IEditorInput newInput =
input; + if ( input instanceof EditorInputDelegate &&
((EditorInputDelegate)input).getDelegate() != null
) + newInput =
((EditorInputDelegate)input).getDelegate(); + super.doSetInput(
newInput ); + } + + protected void
attachSourceLocation() + { + if ( getEditorInput() != null
&& getEditorInput().getAdapter( FileNotFoundElement.class ) != null
) + { + FileNotFoundElement element =
(FileNotFoundElement)getEditorInput().getAdapter( FileNotFoundElement.class
); + if ( element.getLaunch() != null &&
element.getLaunch().getSourceLocator() instanceof IAdaptable
) + { + ILaunch launch =
element.getLaunch(); + ICSourceLocator locator =
(ICSourceLocator)((IAdaptable)element.getLaunch().getSourceLocator()).getAdapter(
ICSourceLocator.class ); + if ( locator != null
) + { + IPath path =
element.getFullPath(); + INewSourceLocationWizard
wizard = null; + if ( path.isAbsolute()
) + { + path
= path.removeLastSegments( 1 ); + wizard =
new AddDirectorySourceLocationWizard( path
); + } + else + { + wizard
= new AddSourceLocationWizard( locator.getSourceLocations()
); + } + WizardDialog
dialog = new WizardDialog( CDebugUIPlugin.getActiveWorkbenchShell(), wizard
); + if ( dialog.open() == Window.OK
) + { + ICSourceLocation[]
locations =
locator.getSourceLocations(); + ArrayList
list = new ArrayList( Arrays.asList( locations )
); + list.add( wizard.getSourceLocation()
); + locator.setSourceLocations(
(ICSourceLocation[])list.toArray( new ICSourceLocation[list.size()] )
); + + if ( locator instanceof
IPersistableSourceLocator
) + { + ILaunchConfiguration
configuration =
launch.getLaunchConfiguration(); + saveChanges(
configuration, (IPersistableSourceLocator)launch.getSourceLocator()
); + } + Object
newElement = locator.getSourceElement( element.getStackFrame()
); + IEditorInput newInput =
null; + if ( newElement instanceof IFile
) + { + newInput
= new FileEditorInput( (IFile)newElement
); + } + else
if ( newElement instanceof FileStorage
) + { + newInput
= new ExternalEditorInput( (IStorage)newElement
); + } + ((EditorInputDelegate)getEditorInput()).setDelegate(
newInput ); + resetInput(
element.getStackFrame()
); + } + } + } + } + } + + private
void resetInput( IStackFrame frame ) + { + setInput(
getEditorInput() ); + IViewPart view =
CDebugUIPlugin.getActivePage().findView( IDebugUIConstants.ID_DEBUG_VIEW
); + if ( view instanceof IDebugView
) + { + ((IDebugView)view).getViewer().setSelection(
new StructuredSelection( frame )
); + } + } + + protected void
saveChanges( ILaunchConfiguration configuration, IPersistableSourceLocator
locator
) + { + try + { + ILaunchConfigurationWorkingCopy
copy = configuration.copy( configuration.getName()
); + copy.setAttribute(
ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, locator.getMemento()
); + copy.doSave(); + } + catch(
CoreException e
) + { + CDebugUIPlugin.errorDialog(
e.getMessage(), (IStatus)null
); + } + } + + /** + * @see
org.eclipse.ui.texteditor.StatusTextEditor#createStatusControl(Composite,
IStatus) + */ + protected Control createStatusControl(
Composite parent, IStatus status ) + { + fAttachSourceForm
= new AttachSourceForm( parent, getEditorInput() ); + return
fAttachSourceForm.getControl(); + } + + /** + * @see
org.eclipse.ui.texteditor.StatusTextEditor#updatePartControl(IEditorInput) +
*/ + public void updatePartControl( IEditorInput input
) + { + if ( fAttachSourceForm != null
) + { + if ( fAttachSourceForm.getInput() !=
null && !fAttachSourceForm.getInput().equals( input )
) + { + fAttachSourceForm =
null; + super.updatePartControl( input
); + } + } + else + super.updatePartControl(
input ); + } +} Index:
src/org/eclipse/cdt/debug/internal/ui/editors/EditorInputDelegate.java =================================================================== RCS
file:
src/org/eclipse/cdt/debug/internal/ui/editors/EditorInputDelegate.java diff
-N src/org/eclipse/cdt/debug/internal/ui/editors/EditorInputDelegate.java ---
/dev/null 1 Jan 1970 00:00:00 -0000 +++
src/org/eclipse/cdt/debug/internal/ui/editors/EditorInputDelegate.java 6
Mar 2003 00:12:10 -0000 @@ -0,0 +1,173 @@ +/* + *(c) Copyright QNX
Software Systems Ltd. 2002. + * All Rights Reserved. + * +
*/ +package org.eclipse.cdt.debug.internal.ui.editors; + +import
java.io.ByteArrayInputStream; +import java.io.InputStream; + +import
org.eclipse.core.resources.IStorage; +import
org.eclipse.core.runtime.CoreException; +import
org.eclipse.core.runtime.IPath; +import
org.eclipse.jface.resource.ImageDescriptor; +import
org.eclipse.ui.IEditorInput; +import
org.eclipse.ui.IPersistableElement; +import
org.eclipse.ui.IStorageEditorInput; + +/** + * + * Enter type
comment. + * + * @since Mar 4, 2003 + */ +public class
EditorInputDelegate implements IEditorInput +{ + public static final
int TYPE_ATTACH_SOURCE = 0; + public static final int
TYPE_WORKSPACE_FILE = 1; + public static final int TYPE_EXTERNAL_FILE =
2; + + private int fType = TYPE_ATTACH_SOURCE; + private
IEditorInput fDelegate = null; + private FileNotFoundElement fElement =
null; + + /** + * Constructor for
EditorInputDelegate. + */ + public EditorInputDelegate(
FileNotFoundElement element ) + { + fElement =
element; + } + + /** + * @see
org.eclipse.ui.IEditorInput#exists() + */ + public boolean
exists() + { + if ( fDelegate != null
) + return fDelegate.exists(); + return
true; + } + + /** + * @see
org.eclipse.ui.IEditorInput#getImageDescriptor() + */ + public
ImageDescriptor getImageDescriptor() + { + if ( fDelegate
!= null ) + return
fDelegate.getImageDescriptor(); + return
null; + } + + /** + * @see
org.eclipse.ui.IEditorInput#getName() + */ + public String
getName() + { + if ( fDelegate != null
) + return fDelegate.getName(); + return (
fElement != null ) ? fElement.getName() :
""; + } + + /** + * @see
org.eclipse.ui.IEditorInput#getPersistable() + */ + public
IPersistableElement getPersistable() + { + if ( fDelegate
!= null ) + return
fDelegate.getPersistable(); + return
null; + } + + /** + * @see
org.eclipse.ui.IEditorInput#getToolTipText() + */ + public
String getToolTipText() + { + if ( fDelegate != null
) + return
fDelegate.getToolTipText(); + return
""; + } + + /** + * @see
org.eclipse.core.runtime.IAdaptable#getAdapter(Class) +
*/ + public Object getAdapter( Class adapter
) + { + if ( adapter.equals( FileNotFoundElement.class )
) + return fElement; + if ( getDelegate() !=
null ) + return getDelegate().getAdapter( adapter
); + return null; + } + + public int
getType() + { + return
fType; + } + + public void setType( int type
) + { + fType = type; + } + + public
IEditorInput getDelegate() + { + return
fDelegate; + } + + public void setDelegate( IEditorInput
input ) + { + fDelegate =
input; + } + + public IStorage getStorage() throws
CoreException + { + if ( getDelegate() instanceof
IStorageEditorInput ) + return
((IStorageEditorInput)getDelegate()).getStorage(); + return
getDummyStorage(); + } + + private IStorage
getDummyStorage() + { + return new
IStorage() + { + public
InputStream getContents() throws
CoreException + { + return
new ByteArrayInputStream( new byte[0]
); + } + + public
IPath
getFullPath() + { + if
( getElement() != null
) + return
getElement().getFullPath(); + return
null; + } + + public
String
getName() + { + if
( getElement() != null
) + return
getElement().getName(); + return
""; + } + + public
boolean
isReadOnly() + { + return
true; + } + + public
Object getAdapter( Class adapter
) + { + if
( adapter.equals( IStorage.class )
) + return
this; + return
null; + } + }; + } + + protected
FileNotFoundElement getElement() + { + return
fElement; + } +} Index:
src/org/eclipse/cdt/debug/internal/ui/editors/FileNotFoundElement.java =================================================================== RCS
file:
/home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/FileNotFoundElement.java,v retrieving
revision 1.1 diff -u -r1.1 FileNotFoundElement.java ---
src/org/eclipse/cdt/debug/internal/ui/editors/FileNotFoundElement.java 21
Feb 2003 23:42:58 -0000 1.1 +++
src/org/eclipse/cdt/debug/internal/ui/editors/FileNotFoundElement.java 6
Mar 2003 00:12:10 -0000 @@ -6,11 +6,13 @@ package
org.eclipse.cdt.debug.internal.ui.editors; import
org.eclipse.cdt.debug.core.model.IStackFrameInfo; +import
org.eclipse.core.runtime.IPath; +import
org.eclipse.core.runtime.Path; import
org.eclipse.debug.core.ILaunch; import
org.eclipse.debug.core.model.IStackFrame; /** - * Enter
type comment. + * The source locator creates an instance of this class if it
cannot find the file specified in stack frame. * * @since:
Feb 21, 2003 */ @@ -26,14 +28,24
@@ fStackFrame =
stackFrame; } - public String
getName() + public IPath
getFullPath() { IStackFrameInfo frameInfo =
(IStackFrameInfo)fStackFrame.getAdapter( IStackFrameInfo.class
); if ( frameInfo != null && frameInfo.getFile() !=
null && frameInfo.getFile().length() > 0
) { - return
frameInfo.getFile(); + Path path = new Path(
frameInfo.getFile() ); + if ( path.isValidPath(
frameInfo.getFile() )
) + { + return
path; + } } - return
""; + return null; + } + + public String
getName() + { + IPath path =
getFullPath(); + return ( path != null ) ? path.lastSegment() :
""; } public IStackFrame
getStackFrame() Index:
src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java =================================================================== RCS
file:
/home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java,v retrieving
revision 1.20 diff -u -r1.20 CDebugUIPlugin.java ---
src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java 13 Feb 2003 16:34:55
-0000 1.20 +++ src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java 6
Mar 2003 00:12:12 -0000 @@ -13,6 +13,7 @@ import
org.eclipse.cdt.debug.internal.ui.CDTDebugModelPresentation; import
org.eclipse.cdt.debug.internal.ui.CDebugImageDescriptorRegistry; import
org.eclipse.cdt.debug.internal.ui.ColorManager; +import
org.eclipse.cdt.debug.internal.ui.editors.CDebugDocumentProvider; import
org.eclipse.cdt.debug.internal.ui.editors.DisassemblyDocumentProvider; import
org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditorInput; import
org.eclipse.cdt.debug.internal.ui.preferences.CDebugPreferencePage; @@ -75,6
+76,9 @@ // Document provider for disassembly
editor private DisassemblyDocumentProvider
fDisassemblyDocumentProvider = null; + // Document provider
for C/C++ debug editor + private CDebugDocumentProvider
fDocumentProvider; + /** * The
constructor. */ @@ -496,5 +500,17
@@ { display.asyncExec( runnable
); } + } + + /** + * Returns
the used document provider + */ + public CDebugDocumentProvider
getDocumentProvider() + { + if (fDocumentProvider ==
null) + { + fDocumentProvider = new
CDebugDocumentProvider(); + } + return
fDocumentProvider; } }
|