mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Implementing the 'Attach Source' editor.
This commit is contained in:
parent
853011dd0a
commit
6f8b4913f4
11 changed files with 543 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
||||||
<classpathentry kind="src" path="/org.eclipse.cdt.debug.core"/>
|
<classpathentry kind="src" path="/org.eclipse.cdt.debug.core"/>
|
||||||
<classpathentry kind="src" path="/org.eclipse.cdt.ui"/>
|
<classpathentry kind="src" path="/org.eclipse.cdt.ui"/>
|
||||||
<classpathentry kind="src" path="/org.eclipse.cdt.core"/>
|
<classpathentry kind="src" path="/org.eclipse.cdt.core"/>
|
||||||
|
<classpathentry exported="true" kind="src" path="/org.eclipse.cdt.core.win32"/>
|
||||||
<classpathentry kind="src" path="/org.eclipse.core.runtime"/>
|
<classpathentry kind="src" path="/org.eclipse.core.runtime"/>
|
||||||
<classpathentry kind="src" path="/org.eclipse.core.boot"/>
|
<classpathentry kind="src" path="/org.eclipse.core.boot"/>
|
||||||
<classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
|
<classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
<projects>
|
<projects>
|
||||||
<project>org.eclipse.cdt.core</project>
|
<project>org.eclipse.cdt.core</project>
|
||||||
|
<project>org.eclipse.cdt.core.win32</project>
|
||||||
<project>org.eclipse.cdt.debug.core</project>
|
<project>org.eclipse.cdt.debug.core</project>
|
||||||
<project>org.eclipse.cdt.ui</project>
|
<project>org.eclipse.cdt.ui</project>
|
||||||
<project>org.eclipse.core.boot</project>
|
<project>org.eclipse.core.boot</project>
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
2003-02-21 Mikhail Khodjaiants
|
||||||
|
Implementing the 'Attach Source' editor.
|
||||||
|
* plugin.properties
|
||||||
|
* plugin.xml
|
||||||
|
* icons/full/obj16/filenotfound_obj.gif: new
|
||||||
|
* CDTDebugModelPresentation.java
|
||||||
|
* AttachSourceEditor.java: new
|
||||||
|
* AttachSourceEditorInput.java: new
|
||||||
|
* FileNotFoundElement.java: new
|
||||||
|
* CUISourceLocator.java
|
||||||
|
|
||||||
2003-02-20 Mikhail Khodjaiants
|
2003-02-20 Mikhail Khodjaiants
|
||||||
Added the 'Association' column and the 'Restore Defaults' button to the SourceLookupBlock.
|
Added the 'Association' column and the 'Restore Defaults' button to the SourceLookupBlock.
|
||||||
* SourceLookupBlock.java
|
* SourceLookupBlock.java
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 165 B |
|
@ -55,6 +55,7 @@ CDebugActionGroup.name=C/C++ Debug
|
||||||
SourcePropertyPage.name=Source Lookup
|
SourcePropertyPage.name=Source Lookup
|
||||||
|
|
||||||
DisassemblyEditor.name=Disassembly Editor
|
DisassemblyEditor.name=Disassembly Editor
|
||||||
|
AttachSourceEditor.name= Attach Source Editor
|
||||||
|
|
||||||
LoadSymbolsAction.label=Load Symbols
|
LoadSymbolsAction.label=Load Symbols
|
||||||
SignalAction.label=Resume With Signal
|
SignalAction.label=Resume With Signal
|
||||||
|
|
|
@ -1090,6 +1090,12 @@
|
||||||
class="org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditor"
|
class="org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditor"
|
||||||
id="org.eclipse.cdt.debug.ui.DisassemblyEditor">
|
id="org.eclipse.cdt.debug.ui.DisassemblyEditor">
|
||||||
</editor>
|
</editor>
|
||||||
|
<editor
|
||||||
|
name="%AttachSourceEditor.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">
|
||||||
|
</editor>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -34,7 +34,10 @@ import org.eclipse.cdt.debug.core.model.IState;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.IDisassemblyStorage;
|
import org.eclipse.cdt.debug.core.sourcelookup.IDisassemblyStorage;
|
||||||
import org.eclipse.cdt.debug.internal.core.CDebugUtils;
|
import org.eclipse.cdt.debug.internal.core.CDebugUtils;
|
||||||
import org.eclipse.cdt.debug.internal.core.sourcelookup.DisassemblyManager;
|
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.DisassemblyEditorInput;
|
import org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditorInput;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.editors.FileNotFoundElement;
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
import org.eclipse.cdt.internal.ui.util.ExternalEditorInput;
|
import org.eclipse.cdt.internal.ui.util.ExternalEditorInput;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
@ -159,6 +162,10 @@ public class CDTDebugModelPresentation extends LabelProvider
|
||||||
{
|
{
|
||||||
return new DisassemblyEditorInput( (IStorage)element );
|
return new DisassemblyEditorInput( (IStorage)element );
|
||||||
}
|
}
|
||||||
|
if ( element instanceof FileNotFoundElement )
|
||||||
|
{
|
||||||
|
return new AttachSourceEditorInput( (FileNotFoundElement)element );
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,6 +176,10 @@ public class CDTDebugModelPresentation extends LabelProvider
|
||||||
{
|
{
|
||||||
if ( input != null )
|
if ( input != null )
|
||||||
{
|
{
|
||||||
|
if ( input instanceof AttachSourceEditorInput )
|
||||||
|
{
|
||||||
|
return AttachSourceEditor.EDITOR_ID;
|
||||||
|
}
|
||||||
IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry();
|
IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry();
|
||||||
IEditorDescriptor descriptor = registry.getDefaultEditor( input.getName() );
|
IEditorDescriptor descriptor = registry.getDefaultEditor( input.getName() );
|
||||||
if ( descriptor != null )
|
if ( descriptor != null )
|
||||||
|
|
|
@ -0,0 +1,382 @@
|
||||||
|
/*
|
||||||
|
*(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 = new 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 = new 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 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
/*
|
||||||
|
*(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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
/*
|
||||||
|
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.debug.internal.ui.editors;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
|
||||||
|
import org.eclipse.debug.core.ILaunch;
|
||||||
|
import org.eclipse.debug.core.model.IStackFrame;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter type comment.
|
||||||
|
*
|
||||||
|
* @since: Feb 21, 2003
|
||||||
|
*/
|
||||||
|
public class FileNotFoundElement
|
||||||
|
{
|
||||||
|
private IStackFrame fStackFrame;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for FileNotFoundElement.
|
||||||
|
*/
|
||||||
|
public FileNotFoundElement( IStackFrame stackFrame )
|
||||||
|
{
|
||||||
|
fStackFrame = stackFrame;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
IStackFrameInfo frameInfo = (IStackFrameInfo)fStackFrame.getAdapter( IStackFrameInfo.class );
|
||||||
|
if ( frameInfo != null && frameInfo.getFile() != null && frameInfo.getFile().length() > 0 )
|
||||||
|
{
|
||||||
|
return frameInfo.getFile();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public IStackFrame getStackFrame()
|
||||||
|
{
|
||||||
|
return fStackFrame;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ILaunch getLaunch()
|
||||||
|
{
|
||||||
|
return ( fStackFrame != null ) ? fStackFrame.getLaunch() : null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,6 +12,7 @@ import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.ISourceMode;
|
import org.eclipse.cdt.debug.core.sourcelookup.ISourceMode;
|
||||||
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLocator;
|
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLocator;
|
||||||
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceManager;
|
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceManager;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.editors.FileNotFoundElement;
|
||||||
import org.eclipse.cdt.debug.internal.ui.wizards.AddDirectorySourceLocationWizard;
|
import org.eclipse.cdt.debug.internal.ui.wizards.AddDirectorySourceLocationWizard;
|
||||||
import org.eclipse.cdt.debug.internal.ui.wizards.AddSourceLocationWizard;
|
import org.eclipse.cdt.debug.internal.ui.wizards.AddSourceLocationWizard;
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
|
@ -219,11 +220,14 @@ public class CUISourceLocator implements IAdaptable
|
||||||
IStackFrameInfo frameInfo = (IStackFrameInfo)stackFrame.getAdapter( IStackFrameInfo.class );
|
IStackFrameInfo frameInfo = (IStackFrameInfo)stackFrame.getAdapter( IStackFrameInfo.class );
|
||||||
if ( frameInfo != null && frameInfo.getFile() != null && frameInfo.getFile().length() > 0 )
|
if ( frameInfo != null && frameInfo.getFile() != null && frameInfo.getFile().length() > 0 )
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
showDebugSourcePage( stackFrame.getLaunch(), frameInfo.getFile() );
|
showDebugSourcePage( stackFrame.getLaunch(), frameInfo.getFile() );
|
||||||
if ( fNewLocationAttached )
|
if ( fNewLocationAttached )
|
||||||
{
|
{
|
||||||
res = fSourceLocator.getSourceElement( stackFrame );
|
res = fSourceLocator.getSourceElement( stackFrame );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
res = new FileNotFoundElement( stackFrame );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
Loading…
Add table
Reference in a new issue