mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
new source locator ui pages
This commit is contained in:
parent
92119895bc
commit
03dea5e8ec
9 changed files with 301 additions and 5 deletions
|
@ -9,6 +9,7 @@
|
||||||
<classpathentry kind="src" path="/org.eclipse.cdt.ui"/>
|
<classpathentry kind="src" path="/org.eclipse.cdt.ui"/>
|
||||||
<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.debug.ui"/>
|
<classpathentry kind="src" path="/org.eclipse.cdt.debug.ui"/>
|
||||||
|
<classpathentry kind="src" path="/org.apache.xerces"/>
|
||||||
<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"/>
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<name>org.eclipse.cdt.launch</name>
|
<name>org.eclipse.cdt.launch</name>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
<projects>
|
<projects>
|
||||||
|
<project>org.apache.xerces</project>
|
||||||
<project>org.eclipse.cdt.core</project>
|
<project>org.eclipse.cdt.core</project>
|
||||||
<project>org.eclipse.cdt.debug.core</project>
|
<project>org.eclipse.cdt.debug.core</project>
|
||||||
<project>org.eclipse.cdt.debug.ui</project>
|
<project>org.eclipse.cdt.debug.ui</project>
|
||||||
|
|
|
@ -1,3 +1,17 @@
|
||||||
|
2003-02-18 Mikhail Khodjaiants
|
||||||
|
New 'Source Lookup' tab.
|
||||||
|
* plugin.xml
|
||||||
|
Added dependency on the 'org.apache.xerces' plugin and the 'sourceLocator' extension.
|
||||||
|
* plugin.properties
|
||||||
|
Name for the source locator.
|
||||||
|
* CoreFileCLaunchConfigurationTabGroup.java
|
||||||
|
* LocalCLaunchConfigurationTabGroup.java
|
||||||
|
Added the 'Source Lookup' tab.
|
||||||
|
* DefaultSourceLocator.java
|
||||||
|
Implementation of 'IPersistableSourceLocator'.
|
||||||
|
* CSourceLookupTab.java
|
||||||
|
Implementation of 'ILaunchConfiguartionTab'.
|
||||||
|
|
||||||
2003-02-07 David Inglis
|
2003-02-07 David Inglis
|
||||||
|
|
||||||
Refactor LaunchConstants into debug.core and make setting source locator happen before
|
Refactor LaunchConstants into debug.core and make setting source locator happen before
|
||||||
|
|
|
@ -13,3 +13,5 @@ providerName=Eclipse.org
|
||||||
|
|
||||||
LocalCDTLaunch.name= C/C++ Local
|
LocalCDTLaunch.name= C/C++ Local
|
||||||
CoreFileCDTLaunch.name= C/C++ Post-mortem debugger
|
CoreFileCDTLaunch.name= C/C++ Post-mortem debugger
|
||||||
|
|
||||||
|
DefaultSourceLocator.name=Default C/C++ Source Locator
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
<import plugin="org.eclipse.cdt.ui"/>
|
<import plugin="org.eclipse.cdt.ui"/>
|
||||||
<import plugin="org.eclipse.cdt.debug.core"/>
|
<import plugin="org.eclipse.cdt.debug.core"/>
|
||||||
<import plugin="org.eclipse.cdt.debug.ui"/>
|
<import plugin="org.eclipse.cdt.debug.ui"/>
|
||||||
|
<import plugin="org.apache.xerces"/>
|
||||||
</requires>
|
</requires>
|
||||||
|
|
||||||
|
|
||||||
|
@ -82,5 +83,13 @@
|
||||||
</perspective>
|
</perspective>
|
||||||
</shortcut>
|
</shortcut>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.debug.core.sourceLocators">
|
||||||
|
<sourceLocator
|
||||||
|
name="%DefaultSourceLocator.name"
|
||||||
|
class="org.eclipse.cdt.launch.sourcelookup.DefaultSourceLocator"
|
||||||
|
id="org.eclipse.cdt.launch.DefaultSourceLocator">
|
||||||
|
</sourceLocator>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.eclipse.cdt.launch.internal.ui;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||||
import org.eclipse.cdt.launch.ui.CMainTab;
|
import org.eclipse.cdt.launch.ui.CMainTab;
|
||||||
|
import org.eclipse.cdt.launch.ui.CSourceLookupTab;
|
||||||
import org.eclipse.cdt.launch.ui.CorefileDebuggerTab;
|
import org.eclipse.cdt.launch.ui.CorefileDebuggerTab;
|
||||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||||
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
|
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
|
||||||
|
@ -23,6 +24,7 @@ public class CoreFileCLaunchConfigurationTabGroup extends AbstractLaunchConfigur
|
||||||
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
|
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
|
||||||
new CMainTab(),
|
new CMainTab(),
|
||||||
new CorefileDebuggerTab(),
|
new CorefileDebuggerTab(),
|
||||||
|
new CSourceLookupTab(),
|
||||||
new CommonTab()
|
new CommonTab()
|
||||||
};
|
};
|
||||||
setTabs(tabs);
|
setTabs(tabs);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import org.eclipse.cdt.launch.ui.CArgumentsTab;
|
||||||
import org.eclipse.cdt.launch.ui.CDebuggerTab;
|
import org.eclipse.cdt.launch.ui.CDebuggerTab;
|
||||||
import org.eclipse.cdt.launch.ui.CEnvironmentTab;
|
import org.eclipse.cdt.launch.ui.CEnvironmentTab;
|
||||||
import org.eclipse.cdt.launch.ui.CMainTab;
|
import org.eclipse.cdt.launch.ui.CMainTab;
|
||||||
|
import org.eclipse.cdt.launch.ui.CSourceLookupTab;
|
||||||
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
|
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
|
||||||
import org.eclipse.debug.ui.CommonTab;
|
import org.eclipse.debug.ui.CommonTab;
|
||||||
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
|
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
|
||||||
|
@ -25,6 +26,7 @@ public class LocalCLaunchConfigurationTabGroup extends AbstractLaunchConfigurati
|
||||||
new CArgumentsTab(),
|
new CArgumentsTab(),
|
||||||
new CEnvironmentTab(),
|
new CEnvironmentTab(),
|
||||||
new CDebuggerTab(),
|
new CDebuggerTab(),
|
||||||
|
new CSourceLookupTab(),
|
||||||
new CommonTab()
|
new CommonTab()
|
||||||
};
|
};
|
||||||
setTabs(tabs);
|
setTabs(tabs);
|
||||||
|
|
|
@ -5,11 +5,19 @@
|
||||||
*/
|
*/
|
||||||
package org.eclipse.cdt.launch.sourcelookup;
|
package org.eclipse.cdt.launch.sourcelookup;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.StringReader;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
|
import org.apache.xerces.dom.DocumentImpl;
|
||||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
|
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.CDebugUtils;
|
||||||
import org.eclipse.cdt.debug.ui.sourcelookup.CUISourceLocator;
|
import org.eclipse.cdt.debug.ui.sourcelookup.CUISourceLocator;
|
||||||
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
|
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
@ -21,6 +29,10 @@ import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
import org.eclipse.debug.core.model.IPersistableSourceLocator;
|
import org.eclipse.debug.core.model.IPersistableSourceLocator;
|
||||||
import org.eclipse.debug.core.model.IStackFrame;
|
import org.eclipse.debug.core.model.IStackFrame;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
import org.xml.sax.InputSource;
|
||||||
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The wrapper for the CUISourceLocator class.
|
* The wrapper for the CUISourceLocator class.
|
||||||
|
@ -29,6 +41,10 @@ import org.eclipse.debug.core.model.IStackFrame;
|
||||||
*/
|
*/
|
||||||
public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptable
|
public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptable
|
||||||
{
|
{
|
||||||
|
private static final String ELEMENT_NAME = "PromptingSourceLocator";
|
||||||
|
private static final String ATTR_PROJECT = "project";
|
||||||
|
private static final String ATTR_MEMENTO = "memento";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier for the 'Default C/C++ Source Locator' extension
|
* Identifier for the 'Default C/C++ Source Locator' extension
|
||||||
* (value <code>"org.eclipse.cdt.launch.DefaultSourceLocator"</code>).
|
* (value <code>"org.eclipse.cdt.launch.DefaultSourceLocator"</code>).
|
||||||
|
@ -45,11 +61,40 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for DefaultSourceLocator.
|
||||||
|
*/
|
||||||
|
public DefaultSourceLocator( CUISourceLocator locator )
|
||||||
|
{
|
||||||
|
fSourceLocator = locator;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.debug.core.model.IPersistableSourceLocator#getMemento()
|
* @see org.eclipse.debug.core.model.IPersistableSourceLocator#getMemento()
|
||||||
*/
|
*/
|
||||||
public String getMemento() throws CoreException
|
public String getMemento() throws CoreException
|
||||||
{
|
{
|
||||||
|
if ( fSourceLocator != null )
|
||||||
|
{
|
||||||
|
Document doc = new DocumentImpl();
|
||||||
|
Element node = doc.createElement( ELEMENT_NAME );
|
||||||
|
doc.appendChild( node );
|
||||||
|
node.setAttribute( ATTR_PROJECT, fSourceLocator.getProject().getName() );
|
||||||
|
|
||||||
|
IPersistableSourceLocator psl = getPersistableSourceLocator();
|
||||||
|
if ( psl != null )
|
||||||
|
{
|
||||||
|
node.setAttribute( ATTR_MEMENTO, psl.getMemento() );
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return CDebugUtils.serializeDocument( doc, " " );
|
||||||
|
}
|
||||||
|
catch( IOException e )
|
||||||
|
{
|
||||||
|
abort( "Unable to create memento for C/C++ source locator.", e );
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +103,60 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
|
||||||
*/
|
*/
|
||||||
public void initializeFromMemento( String memento ) throws CoreException
|
public void initializeFromMemento( String memento ) throws CoreException
|
||||||
{
|
{
|
||||||
|
Exception ex = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Element root = null;
|
||||||
|
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||||
|
StringReader reader = new StringReader( memento );
|
||||||
|
InputSource source = new InputSource( reader );
|
||||||
|
root = parser.parse( source ).getDocumentElement();
|
||||||
|
|
||||||
|
if ( !root.getNodeName().equalsIgnoreCase( ELEMENT_NAME ) )
|
||||||
|
{
|
||||||
|
abort( "Unable to restore prompting source locator - invalid format.", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
String projectName = root.getAttribute( ATTR_PROJECT );
|
||||||
|
String data = root.getAttribute( ATTR_MEMENTO );
|
||||||
|
if ( isEmpty( projectName ) )
|
||||||
|
{
|
||||||
|
abort( "Unable to restore prompting source locator - invalid format.", null );
|
||||||
|
}
|
||||||
|
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( projectName );
|
||||||
|
if ( project != null )
|
||||||
|
{
|
||||||
|
fSourceLocator = new CUISourceLocator( project );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
abort( MessageFormat.format( "Unable to restore prompting source locator - project {0} not found.", new String[] { projectName } ), null );
|
||||||
|
}
|
||||||
|
|
||||||
|
IPersistableSourceLocator psl = getPersistableSourceLocator();
|
||||||
|
if ( psl != null )
|
||||||
|
{
|
||||||
|
psl.initializeFromMemento( data );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
abort( "Unable to restore C/C++ source locator - invalid format.", null );
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch( ParserConfigurationException e )
|
||||||
|
{
|
||||||
|
ex = e;
|
||||||
|
}
|
||||||
|
catch( SAXException e )
|
||||||
|
{
|
||||||
|
ex = e;
|
||||||
|
}
|
||||||
|
catch( IOException e )
|
||||||
|
{
|
||||||
|
ex = e;
|
||||||
|
}
|
||||||
|
abort( "Exception occurred initializing source locator.", ex );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -87,11 +186,8 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new CoreException( new Status( IStatus.ERROR,
|
abort( MessageFormat.format( "Project \"{0}\" does not exist.", new String[] { projectName } ), null );
|
||||||
LaunchUIPlugin.getUniqueIdentifier(),
|
return null;
|
||||||
ERROR,
|
|
||||||
MessageFormat.format( "Project \"{0}\" does not exist.", new String[] { projectName } ),
|
|
||||||
null ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -112,4 +208,38 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ICSourceLocator getCSourceLocator()
|
||||||
|
{
|
||||||
|
if ( fSourceLocator != null )
|
||||||
|
{
|
||||||
|
return (ICSourceLocator)fSourceLocator.getAdapter( ICSourceLocator.class );
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IPersistableSourceLocator getPersistableSourceLocator()
|
||||||
|
{
|
||||||
|
ICSourceLocator sl = getCSourceLocator();
|
||||||
|
return ( sl instanceof IPersistableSourceLocator ) ? (IPersistableSourceLocator)sl : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Throws an internal error exception
|
||||||
|
*/
|
||||||
|
private void abort( String message, Throwable e ) throws CoreException
|
||||||
|
{
|
||||||
|
IStatus s = new Status( IStatus.ERROR,
|
||||||
|
LaunchUIPlugin.getUniqueIdentifier(),
|
||||||
|
ERROR,
|
||||||
|
message,
|
||||||
|
e );
|
||||||
|
throw new CoreException( s );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private boolean isEmpty( String string )
|
||||||
|
{
|
||||||
|
return string == null || string.length() == 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,135 @@
|
||||||
|
/*
|
||||||
|
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.launch.ui;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||||
|
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
|
||||||
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
|
import org.eclipse.cdt.debug.ui.sourcelookup.SourceLookupBlock;
|
||||||
|
import org.eclipse.cdt.launch.sourcelookup.DefaultSourceLocator;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
|
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter type comment.
|
||||||
|
*
|
||||||
|
* @since: Feb 13, 2003
|
||||||
|
*/
|
||||||
|
public class CSourceLookupTab extends CLaunchConfigurationTab
|
||||||
|
{
|
||||||
|
private SourceLookupBlock fBlock = null;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
|
||||||
|
*/
|
||||||
|
public void createControl( Composite parent )
|
||||||
|
{
|
||||||
|
fBlock = new SourceLookupBlock();
|
||||||
|
fBlock.createControl( parent );
|
||||||
|
fBlock.setLaunchConfigurationDialog( getLaunchConfigurationDialog() );
|
||||||
|
setControl( fBlock.getControl() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
|
||||||
|
*/
|
||||||
|
public void setDefaults( ILaunchConfigurationWorkingCopy configuration )
|
||||||
|
{
|
||||||
|
configuration.setAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, DefaultSourceLocator.ID_DEFAULT_SOURCE_LOCATOR );
|
||||||
|
DefaultSourceLocator locator = new DefaultSourceLocator();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
locator.initializeDefaults( configuration );
|
||||||
|
configuration.setAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, locator.getMemento() );
|
||||||
|
}
|
||||||
|
catch( CoreException e )
|
||||||
|
{
|
||||||
|
CDebugUIPlugin.log( e.getStatus() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
|
||||||
|
*/
|
||||||
|
public void initializeFrom( ILaunchConfiguration configuration )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
String id = configuration.getAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, "" );
|
||||||
|
if ( isEmpty( id )|| DefaultSourceLocator.ID_DEFAULT_SOURCE_LOCATOR.equals( id ) )
|
||||||
|
{
|
||||||
|
DefaultSourceLocator locator = new DefaultSourceLocator();
|
||||||
|
String memento = configuration.getAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, "" );
|
||||||
|
if ( !isEmpty( memento ) )
|
||||||
|
{
|
||||||
|
locator.initializeFromMemento( memento );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
locator.initializeDefaults( configuration );
|
||||||
|
}
|
||||||
|
ICSourceLocator clocator = (ICSourceLocator)locator.getAdapter( ICSourceLocator.class );
|
||||||
|
if ( clocator != null )
|
||||||
|
fBlock.initialize( clocator.getSourceLocations() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( CoreException e )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
|
||||||
|
*/
|
||||||
|
public void performApply( ILaunchConfigurationWorkingCopy configuration )
|
||||||
|
{
|
||||||
|
DefaultSourceLocator locator = new DefaultSourceLocator();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
locator.initializeDefaults( configuration );
|
||||||
|
ICSourceLocator clocator = (ICSourceLocator)locator.getAdapter( ICSourceLocator.class );
|
||||||
|
if ( clocator != null )
|
||||||
|
clocator.setSourceLocations( fBlock.getSourceLocations() );
|
||||||
|
configuration.setAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, DefaultSourceLocator.ID_DEFAULT_SOURCE_LOCATOR );
|
||||||
|
configuration.setAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, locator.getMemento() );
|
||||||
|
}
|
||||||
|
catch( CoreException e )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
|
||||||
|
*/
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return "Source Lookup";
|
||||||
|
}
|
||||||
|
|
||||||
|
private IProject getProject( ILaunchConfiguration configuration )
|
||||||
|
{
|
||||||
|
IProject project = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
String projectName = configuration.getAttribute( ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "" );
|
||||||
|
if ( !isEmpty( projectName ) )
|
||||||
|
project = ResourcesPlugin.getWorkspace().getRoot().getProject( projectName );
|
||||||
|
}
|
||||||
|
catch( CoreException e )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isEmpty( String string )
|
||||||
|
{
|
||||||
|
return string == null || string.length() == 0;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue