mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-22 15:53:58 +02:00
Fix for PR 46884: Add a preference page to set common source location
This commit is contained in:
parent
493af74925
commit
e0486ead58
21 changed files with 472 additions and 640 deletions
|
@ -3,6 +3,49 @@
|
||||||
'setCurrentThread': check if the old current thread is not null.
|
'setCurrentThread': check if the old current thread is not null.
|
||||||
* CDebugTarget.java
|
* CDebugTarget.java
|
||||||
|
|
||||||
|
2003-11-07 Mikhail Khodjaiants
|
||||||
|
Fix for PR 46303: Exception when selecting Debug... menu.
|
||||||
|
Check if the string passed to the 'getCommonSourceLocationsFromMemento' method is not empty.
|
||||||
|
* SourceUtils.java
|
||||||
|
|
||||||
|
2003-10-30 Mikhail Khodjaiants
|
||||||
|
* CSourceManager.java: implements adapters for 'ISourceMode' and 'IPersistableSourceLocator'.
|
||||||
|
|
||||||
|
2003-10-29 Mikhail Khodjaiants
|
||||||
|
* CProjectSourceLocation.java: check if the searched element name is not null or empty.
|
||||||
|
|
||||||
|
2003-10-29 Mikhail Khodjaiants
|
||||||
|
Added the 'dispose' method to 'ICSourceLocation'.
|
||||||
|
* ICSourceLocation.java
|
||||||
|
* CDirectorySourceLocation.java
|
||||||
|
* CProjectSourceLocation.java: made 'dispose' public.
|
||||||
|
|
||||||
|
2003-10-29 Mikhail Khodjaiants
|
||||||
|
* CProjectSourceLocation.java: added 'toString' method.
|
||||||
|
|
||||||
|
2003-10-28 Mikhail Khodjaiants
|
||||||
|
Search only in the parent folders if the given file path is absolute.
|
||||||
|
Return a list only if the number of resulting files is > 1.
|
||||||
|
* CDirectorySourceLocation.java
|
||||||
|
|
||||||
|
2003-10-27 Mikhail Khodjaiants
|
||||||
|
Renamed 'SourceLocationFactory' to 'SourceLookupFactory'.
|
||||||
|
Added the 'createSourceLocator' method to 'SourceLookupFactory'.
|
||||||
|
* SourceLookupFactory.java
|
||||||
|
* CSourceLocator.java
|
||||||
|
|
||||||
|
2003-10-27 Mikhail Khodjaiants
|
||||||
|
Changed the 'getAdapter' method of 'CSourceManager' to return the adapter of
|
||||||
|
the 'ICSourceLocator' class.
|
||||||
|
* CSourceManager.java
|
||||||
|
|
||||||
|
2003-10-23 Mikhail Khodjaiants
|
||||||
|
Core support of the new workbench preferences: 'Source Locations' and 'Search
|
||||||
|
For Duplicate Source Files'.
|
||||||
|
* CDebugCorePlugin.java
|
||||||
|
* ICDebugConstants.java
|
||||||
|
* SourceUtils.java: new
|
||||||
|
|
||||||
2003-10-20 Mikhail Khodjaiants
|
2003-10-20 Mikhail Khodjaiants
|
||||||
Core support of the "Search subfolders" option for directory source locations.
|
Core support of the "Search subfolders" option for directory source locations.
|
||||||
* IDirectorySourceLocation.java
|
* IDirectorySourceLocation.java
|
||||||
|
|
|
@ -8,9 +8,11 @@ package org.eclipse.cdt.debug.core;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
|
||||||
import org.eclipse.cdt.debug.internal.core.DebugConfiguration;
|
import org.eclipse.cdt.debug.internal.core.DebugConfiguration;
|
||||||
import org.eclipse.cdt.debug.internal.core.SessionManager;
|
import org.eclipse.cdt.debug.internal.core.SessionManager;
|
||||||
import org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint;
|
import org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint;
|
||||||
|
import org.eclipse.cdt.debug.internal.core.sourcelookup.SourceUtils;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -229,4 +231,14 @@ public class CDebugCorePlugin extends Plugin
|
||||||
fSessionManager.dispose();
|
fSessionManager.dispose();
|
||||||
fSessionManager = sm;
|
fSessionManager = sm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void saveCommonSourceLocations( ICSourceLocation[] locations )
|
||||||
|
{
|
||||||
|
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_SOURCE_LOCATIONS, SourceUtils.getCommonSourceLocationsMemento( locations ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICSourceLocation[] getCommonSourceLocations()
|
||||||
|
{
|
||||||
|
return SourceUtils.getCommonSourceLocationsFromMemento( CDebugCorePlugin.getDefault().getPluginPreferences().getString( ICDebugConstants.PREF_SOURCE_LOCATIONS ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,17 @@ public interface ICDebugConstants
|
||||||
*/
|
*/
|
||||||
public static final String PREF_MAX_NUMBER_OF_INSTRUCTIONS = PLUGIN_ID + "cDebug.max_number_of_instructions"; //$NON-NLS-1$
|
public static final String PREF_MAX_NUMBER_OF_INSTRUCTIONS = PLUGIN_ID + "cDebug.max_number_of_instructions"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boolean preference controlling whether the search for duplicate source files
|
||||||
|
* will be performed by debugger.
|
||||||
|
*/
|
||||||
|
public static final String PREF_SEARCH_DUPLICATE_FILES = PLUGIN_ID + "cDebug.Source.search_duplicate_files"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The identifier of the common source locations list
|
||||||
|
*/
|
||||||
|
public static final String PREF_SOURCE_LOCATIONS = PLUGIN_ID + "cDebug.Source.source_locations"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default number of instructions displayed in disassembly.
|
* The default number of instructions displayed in disassembly.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -67,4 +67,6 @@ public interface ICSourceLocation extends IAdaptable
|
||||||
* @param search - a value to set
|
* @param search - a value to set
|
||||||
*/
|
*/
|
||||||
void setSearchForDuplicateFiles( boolean search );
|
void setSearchForDuplicateFiles( boolean search );
|
||||||
|
|
||||||
|
void dispose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
/*
|
|
||||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.eclipse.cdt.debug.core.sourcelookup;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.internal.core.sourcelookup.CDirectorySourceLocation;
|
|
||||||
import org.eclipse.cdt.debug.internal.core.sourcelookup.CProjectSourceLocation;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
|
||||||
import org.eclipse.core.runtime.IPath;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enter type comment.
|
|
||||||
*
|
|
||||||
* @since Jul 14, 2003
|
|
||||||
*/
|
|
||||||
public class SourceLocationFactory
|
|
||||||
{
|
|
||||||
public static IProjectSourceLocation createProjectSourceLocation( IProject project )
|
|
||||||
{
|
|
||||||
return new CProjectSourceLocation( project );
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IProjectSourceLocation createProjectSourceLocation( IProject project, boolean generated )
|
|
||||||
{
|
|
||||||
return new CProjectSourceLocation( project, generated );
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IDirectorySourceLocation createDirectorySourceLocation( IPath directory, IPath association, boolean searchSubfolders )
|
|
||||||
{
|
|
||||||
return new CDirectorySourceLocation( directory, association, searchSubfolders );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -91,7 +91,7 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
public Object findSourceElement( String name ) throws CoreException
|
public Object findSourceElement( String name ) throws CoreException
|
||||||
{
|
{
|
||||||
Object result = null;
|
Object result = null;
|
||||||
if ( getDirectory() != null )
|
if ( !isEmpty( name ) && getDirectory() != null )
|
||||||
{
|
{
|
||||||
File file = new File( name );
|
File file = new File( name );
|
||||||
if ( file.isAbsolute() )
|
if ( file.isAbsolute() )
|
||||||
|
@ -187,7 +187,8 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list;
|
if ( list.size() > 0 )
|
||||||
|
return ( list.size() == 1 ) ? list.getFirst() : list;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -200,16 +201,11 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
IPath filePath = new Path( name );
|
IPath filePath = new Path( name );
|
||||||
IPath path = new Path( folder.getAbsolutePath() );
|
IPath path = new Path( folder.getAbsolutePath() );
|
||||||
IPath association = getAssociation();
|
IPath association = getAssociation();
|
||||||
if ( isPrefix( path, filePath ) )
|
if ( !isPrefix( path, filePath ) || path.segmentCount() + 1 != filePath.segmentCount() )
|
||||||
{
|
|
||||||
filePath = path.append( filePath.removeFirstSegments( path.segmentCount() ) );
|
|
||||||
}
|
|
||||||
else if ( association != null && isPrefix( association, filePath ) )
|
|
||||||
{
|
{
|
||||||
|
if ( association != null && isPrefix( association, filePath ) && association.segmentCount() + 1 == filePath.segmentCount() )
|
||||||
filePath = path.append( filePath.removeFirstSegments( association.segmentCount() ) );
|
filePath = path.append( filePath.removeFirstSegments( association.segmentCount() ) );
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +222,7 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
return ( list.size() == 1 ) ? list.getFirst() : list;
|
return ( list.size() == 1 ) ? list.getFirst() : list;
|
||||||
|
|
||||||
file = filePath.toFile();
|
file = filePath.toFile();
|
||||||
if ( file.exists() )
|
if ( file.exists() && file.isFile() )
|
||||||
{
|
{
|
||||||
return createExternalFileStorage( filePath );
|
return createExternalFileStorage( filePath );
|
||||||
}
|
}
|
||||||
|
@ -257,7 +253,8 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list;
|
if ( list.size() > 0 )
|
||||||
|
return ( list.size() == 1 ) ? list.getFirst() : list;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -267,7 +264,7 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
IPath path = new Path( folder.getAbsolutePath() );
|
IPath path = new Path( folder.getAbsolutePath() );
|
||||||
path = path.append( fileName );
|
path = path.append( fileName );
|
||||||
File file = path.toFile();
|
File file = path.toFile();
|
||||||
if ( file.exists() )
|
if ( file.exists() && file.isFile() )
|
||||||
{
|
{
|
||||||
path = new Path( file.getAbsolutePath() );
|
path = new Path( file.getAbsolutePath() );
|
||||||
IFile[] wsFiles = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation( path );
|
IFile[] wsFiles = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation( path );
|
||||||
|
@ -458,6 +455,7 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
|
|
||||||
public void setSearchSubfolders( boolean search )
|
public void setSearchSubfolders( boolean search )
|
||||||
{
|
{
|
||||||
|
resetFolders();
|
||||||
fSearchSubfolders = search;
|
fSearchSubfolders = search;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,4 +500,19 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
list.addAll( getFileFolders( folders[i] ) );
|
list.addAll( getFileFolders( folders[i] ) );
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.lang.Object#toString()
|
||||||
|
*/
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return ( getDirectory() != null ) ? getDirectory().toOSString() : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation#dispose()
|
||||||
|
*/
|
||||||
|
public void dispose()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class CProjectSourceLocation implements IProjectSourceLocation
|
||||||
public Object findSourceElement( String name ) throws CoreException
|
public Object findSourceElement( String name ) throws CoreException
|
||||||
{
|
{
|
||||||
Object result = null;
|
Object result = null;
|
||||||
if ( getProject() != null && !notFoundCacheLookup( name ) )
|
if ( !isEmpty( name ) && getProject() != null && !notFoundCacheLookup( name ) )
|
||||||
{
|
{
|
||||||
result = cacheLookup( name );
|
result = cacheLookup( name );
|
||||||
if ( result == null )
|
if ( result == null )
|
||||||
|
@ -216,7 +216,7 @@ public class CProjectSourceLocation implements IProjectSourceLocation
|
||||||
fNotFoundCache.add( name );
|
fNotFoundCache.add( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
fCache.clear();
|
fCache.clear();
|
||||||
fNotFoundCache.clear();
|
fNotFoundCache.clear();
|
||||||
|
@ -388,4 +388,9 @@ public class CProjectSourceLocation implements IProjectSourceLocation
|
||||||
fNotFoundCache.clear();
|
fNotFoundCache.clear();
|
||||||
fSearchForDuplicateFiles = search;
|
fSearchForDuplicateFiles = search;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return ( getProject() != null ) ? fProject.toString() : "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
|
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
|
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.IProjectSourceLocation;
|
import org.eclipse.cdt.debug.core.sourcelookup.IProjectSourceLocation;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.SourceLocationFactory;
|
import org.eclipse.cdt.debug.core.sourcelookup.SourceLookupFactory;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
@ -219,7 +219,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
|
||||||
ArrayList list = new ArrayList();
|
ArrayList list = new ArrayList();
|
||||||
if ( project != null && project.exists() )
|
if ( project != null && project.exists() )
|
||||||
{
|
{
|
||||||
list.add( SourceLocationFactory.createProjectSourceLocation( project ) );
|
list.add( SourceLookupFactory.createProjectSourceLocation( project ) );
|
||||||
addReferencedSourceLocations( list, project );
|
addReferencedSourceLocations( list, project );
|
||||||
}
|
}
|
||||||
return (ICSourceLocation[])list.toArray( new ICSourceLocation[list.size()] );
|
return (ICSourceLocation[])list.toArray( new ICSourceLocation[list.size()] );
|
||||||
|
@ -236,7 +236,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
|
||||||
{
|
{
|
||||||
if ( projects[i].exists() && !containsProject( list, projects[i] ) )
|
if ( projects[i].exists() && !containsProject( list, projects[i] ) )
|
||||||
{
|
{
|
||||||
list.add( SourceLocationFactory.createProjectSourceLocation( projects[i] ) );
|
list.add( SourceLookupFactory.createProjectSourceLocation( projects[i] ) );
|
||||||
addReferencedSourceLocations( list, projects[i] );
|
addReferencedSourceLocations( list, projects[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -656,12 +656,12 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
|
||||||
Iterator it = fReferencedProjects.iterator();
|
Iterator it = fReferencedProjects.iterator();
|
||||||
ArrayList list = new ArrayList( fReferencedProjects.size() );
|
ArrayList list = new ArrayList( fReferencedProjects.size() );
|
||||||
if ( getProject() != null && getProject().exists() && getProject().isOpen() )
|
if ( getProject() != null && getProject().exists() && getProject().isOpen() )
|
||||||
list.add( SourceLocationFactory.createProjectSourceLocation( getProject() ) );
|
list.add( SourceLookupFactory.createProjectSourceLocation( getProject() ) );
|
||||||
while( it.hasNext() )
|
while( it.hasNext() )
|
||||||
{
|
{
|
||||||
IProject project = (IProject)it.next();
|
IProject project = (IProject)it.next();
|
||||||
if ( project != null && project.exists() && project.isOpen() )
|
if ( project != null && project.exists() && project.isOpen() )
|
||||||
list.add( SourceLocationFactory.createProjectSourceLocation( project ) );
|
list.add( SourceLookupFactory.createProjectSourceLocation( project ) );
|
||||||
}
|
}
|
||||||
return (ICSourceLocation[])list.toArray( new ICSourceLocation[list.size()] );
|
return (ICSourceLocation[])list.toArray( new ICSourceLocation[list.size()] );
|
||||||
}
|
}
|
||||||
|
@ -721,7 +721,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
|
||||||
{
|
{
|
||||||
IProject project = (IProject)it.next();
|
IProject project = (IProject)it.next();
|
||||||
if ( !fReferencedProjects.contains( project ) )
|
if ( !fReferencedProjects.contains( project ) )
|
||||||
newLocations.add( SourceLocationFactory.createProjectSourceLocation( project ) );
|
newLocations.add( SourceLookupFactory.createProjectSourceLocation( project ) );
|
||||||
}
|
}
|
||||||
fReferencedProjects = newRefs;
|
fReferencedProjects = newRefs;
|
||||||
setSourceLocations( (ICSourceLocation[])newLocations.toArray( new ICSourceLocation[newLocations.size()] ) );
|
setSourceLocations( (ICSourceLocation[])newLocations.toArray( new ICSourceLocation[newLocations.size()] ) );
|
||||||
|
|
|
@ -136,6 +136,12 @@ public class CSourceManager implements ICSourceLocator,
|
||||||
{
|
{
|
||||||
if ( adapter.equals( CSourceManager.class ) )
|
if ( adapter.equals( CSourceManager.class ) )
|
||||||
return this;
|
return this;
|
||||||
|
if ( adapter.equals( ICSourceLocator.class ) )
|
||||||
|
return this;
|
||||||
|
if ( adapter.equals( ISourceMode.class ) )
|
||||||
|
return this;
|
||||||
|
if ( adapter.equals( IPersistableSourceLocator.class ) )
|
||||||
|
return this;
|
||||||
if ( adapter.equals( IResourceChangeListener.class ) &&
|
if ( adapter.equals( IResourceChangeListener.class ) &&
|
||||||
fSourceLocator instanceof IResourceChangeListener )
|
fSourceLocator instanceof IResourceChangeListener )
|
||||||
return fSourceLocator;
|
return fSourceLocator;
|
||||||
|
|
|
@ -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 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.debug.ui</name>
|
<name>org.eclipse.cdt.debug.ui</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.ui</project>
|
<project>org.eclipse.cdt.ui</project>
|
||||||
|
|
|
@ -2,6 +2,61 @@
|
||||||
Fix for PR 45957: Memory view: last column does not show updates.
|
Fix for PR 45957: Memory view: last column does not show updates.
|
||||||
* MemoryPresentation.java
|
* MemoryPresentation.java
|
||||||
|
|
||||||
|
2003-10-28 Mikhail Khodjaiants
|
||||||
|
Changed name of source lookup preference page.
|
||||||
|
* plugin.properties
|
||||||
|
|
||||||
|
2003-10-27 Mikhail Khodjaiants
|
||||||
|
Added support of the old launch configurations.
|
||||||
|
* plugin.xml
|
||||||
|
* plugin.properties
|
||||||
|
|
||||||
|
2003-10-27 Mikhail Khodjaiants
|
||||||
|
Changed the initialization of 'SourceLookupBlock'.
|
||||||
|
* SourceLookupBlock.java
|
||||||
|
* SourcePropertyPage.java
|
||||||
|
|
||||||
|
2003-10-27 Mikhail Khodjaiants
|
||||||
|
Moved the 'org.eclipse.debug.core.sourceLocators' extension from the launcher.
|
||||||
|
* plugin.xml
|
||||||
|
* plugin.properties
|
||||||
|
|
||||||
|
2003-10-27 Mikhail Khodjaiants
|
||||||
|
Added dependency to 'org.apache.xerces'.
|
||||||
|
* plugin.xml
|
||||||
|
* .classpath
|
||||||
|
* .project
|
||||||
|
|
||||||
|
2003-10-27 Mikhail Khodjaiants
|
||||||
|
Moved 'DefaultSourceLocator' from the 'org.eclipse.cdt.launch' plugin and merge it with 'CUISourceLocator'.
|
||||||
|
* CUISourceLocator.java: removed
|
||||||
|
* DefaultSourceLocator.java: moved from the launcher.
|
||||||
|
* CDebugUIPlugin.java: added the 'createSourceLocator' method.
|
||||||
|
|
||||||
|
2003-10-27 Mikhail Khodjaiants
|
||||||
|
Renamed 'SourceLocationFactory' to 'SourceLookupFactory'.
|
||||||
|
* AddDirectorySourceLocationBlock.java
|
||||||
|
* AddProjectSourceLocationBlock.java
|
||||||
|
|
||||||
|
2003-10-23 Mikhail Khodjaiants
|
||||||
|
Added a preference page for the source lookup.
|
||||||
|
It includes two new preferences: 'Source Locations' and 'Search For Duplicate Source Files'.
|
||||||
|
* plugin.properties
|
||||||
|
* plugin.xml
|
||||||
|
* ICDebugHelpContextIds.java
|
||||||
|
* SourcePreferencePage.java
|
||||||
|
* SourceListDialogField.java
|
||||||
|
* SourceLookupBlock.java
|
||||||
|
|
||||||
|
2003-10-22 Mikhail Khodjaiants
|
||||||
|
Refactoring: converting nested types 'SourceListDialogField' and 'SourceLookupLabelProvider'
|
||||||
|
of 'SourceLookupBlock' to the top level types.
|
||||||
|
Added 'dispose' method to 'SourceLookupBlock'.
|
||||||
|
* SourceLookupBlock.java
|
||||||
|
* SourcePropertyPage.java
|
||||||
|
* SourceListDialogField.java
|
||||||
|
* SourceLookupLabelProvider.java
|
||||||
|
|
||||||
2003-10-20 Mikhail Khodjaiants
|
2003-10-20 Mikhail Khodjaiants
|
||||||
Implementation of the "Search subfolders" option for directory source locations.
|
Implementation of the "Search subfolders" option for directory source locations.
|
||||||
* AddDirectorySourceLocationBlock.java
|
* AddDirectorySourceLocationBlock.java
|
||||||
|
|
|
@ -16,6 +16,7 @@ MemoryPreferencePage.name=Memory View
|
||||||
RegistersPreferencePage.name=Registers View
|
RegistersPreferencePage.name=Registers View
|
||||||
CDebugPreferencePage.name=Debug
|
CDebugPreferencePage.name=Debug
|
||||||
SharedLibrariesPreferencePage.name=Shared Libraries View
|
SharedLibrariesPreferencePage.name=Shared Libraries View
|
||||||
|
SourcePreferencePage.name=Source Code Locations
|
||||||
|
|
||||||
RunMenu.label=&Run
|
RunMenu.label=&Run
|
||||||
DebugActionSet.label=C/C++ Debug
|
DebugActionSet.label=C/C++ Debug
|
||||||
|
@ -79,3 +80,6 @@ EnableVariablesAction.tooltip=Enable Selected Variables
|
||||||
|
|
||||||
DisableVariablesAction.label=Disable
|
DisableVariablesAction.label=Disable
|
||||||
DisableVariablesAction.tooltip=Disable Selected Variables
|
DisableVariablesAction.tooltip=Disable Selected Variables
|
||||||
|
|
||||||
|
DefaultSourceLocator.name=Default C/C++ Source Locator
|
||||||
|
OldDefaultSourceLocator.name=Default C/C++ Source Locator (old)
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
<import plugin="org.eclipse.cdt.debug.core"/>
|
<import plugin="org.eclipse.cdt.debug.core"/>
|
||||||
<import plugin="org.eclipse.cdt.ui"/>
|
<import plugin="org.eclipse.cdt.ui"/>
|
||||||
<import plugin="org.eclipse.cdt.core"/>
|
<import plugin="org.eclipse.cdt.core"/>
|
||||||
|
<import plugin="org.apache.xerces"/>
|
||||||
</requires>
|
</requires>
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,6 +131,12 @@
|
||||||
class="org.eclipse.cdt.debug.internal.ui.preferences.CDebugPreferencePage"
|
class="org.eclipse.cdt.debug.internal.ui.preferences.CDebugPreferencePage"
|
||||||
id="org.eclipse.cdt.debug.ui.CDebugPreferencePage">
|
id="org.eclipse.cdt.debug.ui.CDebugPreferencePage">
|
||||||
</page>
|
</page>
|
||||||
|
<page
|
||||||
|
name="%SourcePreferencePage.name"
|
||||||
|
category="org.eclipse.cdt.debug.ui.CDebugPreferencePage"
|
||||||
|
class="org.eclipse.cdt.debug.internal.ui.preferences.SourcePreferencePage"
|
||||||
|
id="org.eclipse.cdt.debug.ui.SourcePreferencePage">
|
||||||
|
</page>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.actionSets">
|
point="org.eclipse.ui.actionSets">
|
||||||
|
@ -1237,5 +1244,18 @@
|
||||||
id="org.eclipse.cdt.debug.ui.editor.CDebugEditor">
|
id="org.eclipse.cdt.debug.ui.editor.CDebugEditor">
|
||||||
</editor>
|
</editor>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.debug.core.sourceLocators">
|
||||||
|
<sourceLocator
|
||||||
|
name="%DefaultSourceLocator.name"
|
||||||
|
class="org.eclipse.cdt.debug.ui.sourcelookup.DefaultSourceLocator"
|
||||||
|
id="org.eclipse.cdt.debug.ui.DefaultSourceLocator">
|
||||||
|
</sourceLocator>
|
||||||
|
<sourceLocator
|
||||||
|
class="org.eclipse.cdt.debug.ui.sourcelookup.DefaultSourceLocator"
|
||||||
|
name="%OldDefaultSourceLocator.name"
|
||||||
|
id="org.eclipse.cdt.launch.DefaultSourceLocator">
|
||||||
|
</sourceLocator>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -43,6 +43,7 @@ public interface ICDebugHelpContextIds
|
||||||
public static final String SIGNALS_VIEW = PREFIX + "signals_view_context"; //$NON-NLS-1$
|
public static final String SIGNALS_VIEW = PREFIX + "signals_view_context"; //$NON-NLS-1$
|
||||||
|
|
||||||
// Preference pages
|
// Preference pages
|
||||||
|
public static final String SOURCE_PREFERENCE_PAGE = PREFIX + "source_preference_page_context"; //$NON-NLS-1$
|
||||||
public static final String SHARED_LIBRARIES_PREFERENCE_PAGE = PREFIX + "shared_libraries_preference_page_context"; //$NON-NLS-1$
|
public static final String SHARED_LIBRARIES_PREFERENCE_PAGE = PREFIX + "shared_libraries_preference_page_context"; //$NON-NLS-1$
|
||||||
public static final String MEMORY_PREFERENCE_PAGE = PREFIX + "memory_preference_page_context"; //$NON-NLS-1$
|
public static final String MEMORY_PREFERENCE_PAGE = PREFIX + "memory_preference_page_context"; //$NON-NLS-1$
|
||||||
public static final String REGISTERS_PREFERENCE_PAGE = PREFIX + "registers_preference_page_context"; //$NON-NLS-1$
|
public static final String REGISTERS_PREFERENCE_PAGE = PREFIX + "registers_preference_page_context"; //$NON-NLS-1$
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
package org.eclipse.cdt.debug.internal.ui.wizards;
|
package org.eclipse.cdt.debug.internal.ui.wizards;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.IDirectorySourceLocation;
|
import org.eclipse.cdt.debug.core.sourcelookup.IDirectorySourceLocation;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.SourceLocationFactory;
|
import org.eclipse.cdt.debug.core.sourcelookup.SourceLookupFactory;
|
||||||
import org.eclipse.cdt.debug.internal.ui.PixelConverter;
|
import org.eclipse.cdt.debug.internal.ui.PixelConverter;
|
||||||
import org.eclipse.cdt.debug.internal.ui.SWTUtil;
|
import org.eclipse.cdt.debug.internal.ui.SWTUtil;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
@ -194,7 +194,7 @@ public class AddDirectorySourceLocationBlock
|
||||||
if ( isLocationPathValid() )
|
if ( isLocationPathValid() )
|
||||||
{
|
{
|
||||||
Path association = ( isAssociationPathValid() ) ? new Path( getAssociationPath() ) : null;
|
Path association = ( isAssociationPathValid() ) ? new Path( getAssociationPath() ) : null;
|
||||||
return SourceLocationFactory.createDirectorySourceLocation( new Path( getLocationPath() ), association, searchSubfolders() );
|
return SourceLookupFactory.createDirectorySourceLocation( new Path( getLocationPath() ), association, searchSubfolders() );
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
package org.eclipse.cdt.debug.internal.ui.wizards;
|
package org.eclipse.cdt.debug.internal.ui.wizards;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.IProjectSourceLocation;
|
import org.eclipse.cdt.debug.core.sourcelookup.IProjectSourceLocation;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.SourceLocationFactory;
|
import org.eclipse.cdt.debug.core.sourcelookup.SourceLookupFactory;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.jface.resource.JFaceResources;
|
import org.eclipse.jface.resource.JFaceResources;
|
||||||
import org.eclipse.jface.viewers.IDoubleClickListener;
|
import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||||
|
@ -92,7 +92,7 @@ public class AddProjectSourceLocationBlock
|
||||||
{
|
{
|
||||||
if ( !((IStructuredSelection)fViewer.getSelection()).isEmpty() )
|
if ( !((IStructuredSelection)fViewer.getSelection()).isEmpty() )
|
||||||
{
|
{
|
||||||
return SourceLocationFactory.createProjectSourceLocation( (IProject)((IStructuredSelection)fViewer.getSelection()).getFirstElement(), false );
|
return SourceLookupFactory.createProjectSourceLocation( (IProject)((IStructuredSelection)fViewer.getSelection()).getFirstElement(), false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.eclipse.cdt.debug.internal.ui.preferences.CDebugPreferencePage;
|
||||||
import org.eclipse.cdt.debug.internal.ui.preferences.MemoryViewPreferencePage;
|
import org.eclipse.cdt.debug.internal.ui.preferences.MemoryViewPreferencePage;
|
||||||
import org.eclipse.cdt.debug.internal.ui.preferences.RegistersViewPreferencePage;
|
import org.eclipse.cdt.debug.internal.ui.preferences.RegistersViewPreferencePage;
|
||||||
import org.eclipse.cdt.debug.internal.ui.preferences.SharedLibrariesViewPreferencePage;
|
import org.eclipse.cdt.debug.internal.ui.preferences.SharedLibrariesViewPreferencePage;
|
||||||
|
import org.eclipse.cdt.debug.ui.sourcelookup.DefaultSourceLocator;
|
||||||
import org.eclipse.core.resources.IStorage;
|
import org.eclipse.core.resources.IStorage;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
|
@ -34,6 +35,7 @@ import org.eclipse.debug.core.DebugPlugin;
|
||||||
import org.eclipse.debug.core.IDebugEventSetListener;
|
import org.eclipse.debug.core.IDebugEventSetListener;
|
||||||
import org.eclipse.debug.core.model.IDebugElement;
|
import org.eclipse.debug.core.model.IDebugElement;
|
||||||
import org.eclipse.debug.core.model.IDebugTarget;
|
import org.eclipse.debug.core.model.IDebugTarget;
|
||||||
|
import org.eclipse.debug.core.model.IPersistableSourceLocator;
|
||||||
import org.eclipse.debug.core.model.IStackFrame;
|
import org.eclipse.debug.core.model.IStackFrame;
|
||||||
import org.eclipse.debug.core.model.IThread;
|
import org.eclipse.debug.core.model.IThread;
|
||||||
import org.eclipse.debug.ui.IDebugUIConstants;
|
import org.eclipse.debug.ui.IDebugUIConstants;
|
||||||
|
@ -508,4 +510,22 @@ public class CDebugUIPlugin extends AbstractUIPlugin
|
||||||
display.asyncExec( runnable );
|
display.asyncExec( runnable );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IPersistableSourceLocator createDefaultSourceLocator()
|
||||||
|
{
|
||||||
|
return new DefaultSourceLocator();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDefaultSourceLocatorID()
|
||||||
|
{
|
||||||
|
return DefaultSourceLocator.ID_DEFAULT_SOURCE_LOCATOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* to support old launch configurations
|
||||||
|
*/
|
||||||
|
public static String getDefaultSourceLocatorOldID()
|
||||||
|
{
|
||||||
|
return DefaultSourceLocator.ID_OLD_DEFAULT_SOURCE_LOCATOR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,258 +0,0 @@
|
||||||
/*
|
|
||||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.eclipse.cdt.debug.ui.sourcelookup;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.resources.FileStorage;
|
|
||||||
import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
|
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
|
|
||||||
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.CSourceManager;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.CDebugImageDescriptorRegistry;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.dialogfields.SelectionButtonDialogField;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.editors.FileNotFoundElement;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.editors.NoSymbolOrSourceElement;
|
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
|
||||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
|
||||||
import org.eclipse.core.resources.IFile;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
|
||||||
import org.eclipse.core.resources.IResourceChangeListener;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
|
||||||
import org.eclipse.core.runtime.IStatus;
|
|
||||||
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.jface.viewers.ArrayContentProvider;
|
|
||||||
import org.eclipse.jface.viewers.LabelProvider;
|
|
||||||
import org.eclipse.swt.SWT;
|
|
||||||
import org.eclipse.swt.graphics.Image;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
|
||||||
import org.eclipse.swt.widgets.Control;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
import org.eclipse.ui.dialogs.ListDialog;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* A source locator that prompts the user to find source when source cannot
|
|
||||||
* be found on the current source lookup path.
|
|
||||||
*
|
|
||||||
* @since Sep 24, 2002
|
|
||||||
*/
|
|
||||||
public class CUISourceLocator implements IAdaptable
|
|
||||||
{
|
|
||||||
public class SourceSelectionDialog extends ListDialog
|
|
||||||
{
|
|
||||||
private SelectionButtonDialogField fAlwaysUseThisFileButton = new SelectionButtonDialogField( SWT.CHECK );
|
|
||||||
|
|
||||||
public SourceSelectionDialog( Shell parent )
|
|
||||||
{
|
|
||||||
super( parent );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.dialogs.ListDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
|
|
||||||
*/
|
|
||||||
protected Control createDialogArea( Composite parent )
|
|
||||||
{
|
|
||||||
Composite comp = ControlFactory.createComposite( parent, 1 );
|
|
||||||
super.createDialogArea( comp );
|
|
||||||
Composite comp1 = ControlFactory.createComposite( comp, 1 );
|
|
||||||
fAlwaysUseThisFileButton.setLabelText( "Always map to the selection" );
|
|
||||||
fAlwaysUseThisFileButton.doFillIntoGrid( comp1, 1 );
|
|
||||||
return comp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean alwaysMapToSelection()
|
|
||||||
{
|
|
||||||
return fAlwaysUseThisFileButton.isSelected();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class SourceElementLabelProvider extends LabelProvider
|
|
||||||
{
|
|
||||||
protected CDebugImageDescriptorRegistry fDebugImageRegistry = CDebugUIPlugin.getImageDescriptorRegistry();
|
|
||||||
|
|
||||||
public SourceElementLabelProvider()
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getText(Object element)
|
|
||||||
{
|
|
||||||
if ( element instanceof IFile )
|
|
||||||
return ((IFile)element).getFullPath().toString();
|
|
||||||
if ( element instanceof FileStorage )
|
|
||||||
return ((FileStorage)element).getFullPath().toOSString();
|
|
||||||
return super.getText(element);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Image getImage( Object element )
|
|
||||||
{
|
|
||||||
if ( element instanceof IFile )
|
|
||||||
return fDebugImageRegistry.get( CDebugImages.DESC_OBJS_WORKSPACE_SOURCE_FILE );
|
|
||||||
if ( element instanceof FileStorage )
|
|
||||||
return fDebugImageRegistry.get( CDebugImages.DESC_OBJS_EXTERNAL_SOURCE_FILE );
|
|
||||||
return super.getImage( element );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The project being debugged.
|
|
||||||
*/
|
|
||||||
private IProject fProject = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Underlying source locator.
|
|
||||||
*/
|
|
||||||
private CSourceManager fSourceLocator;
|
|
||||||
|
|
||||||
private HashMap fFramesToSource = null;
|
|
||||||
private HashMap fNamesToSource = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for CUISourceLocator.
|
|
||||||
*/
|
|
||||||
public CUISourceLocator( IProject project )
|
|
||||||
{
|
|
||||||
fProject = project;
|
|
||||||
fSourceLocator = new CSourceManager( new CSourceLocator( project ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getSourceElement( IStackFrame stackFrame )
|
|
||||||
{
|
|
||||||
Object res = cacheLookup( stackFrame );
|
|
||||||
if ( res == null )
|
|
||||||
{
|
|
||||||
res = fSourceLocator.getSourceElement( stackFrame );
|
|
||||||
if ( res instanceof List )
|
|
||||||
{
|
|
||||||
List list = (List)res;
|
|
||||||
if ( list.size() != 0 )
|
|
||||||
{
|
|
||||||
SourceSelectionDialog dialog = createSourceSelectionDialog( list );
|
|
||||||
dialog.open();
|
|
||||||
Object[] objs = dialog.getResult();
|
|
||||||
res = ( objs != null && objs.length > 0 ) ? objs[0] : null;
|
|
||||||
if ( res != null )
|
|
||||||
cacheSourceElement( stackFrame, res, dialog.alwaysMapToSelection() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
res = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( res == null )
|
|
||||||
{
|
|
||||||
IStackFrameInfo frameInfo = (IStackFrameInfo)stackFrame.getAdapter( IStackFrameInfo.class );
|
|
||||||
if ( frameInfo != null && frameInfo.getFile() != null && frameInfo.getFile().length() > 0 )
|
|
||||||
{
|
|
||||||
res = new FileNotFoundElement( stackFrame );
|
|
||||||
}
|
|
||||||
else // don't show in editor
|
|
||||||
{
|
|
||||||
res = new NoSymbolOrSourceElement( stackFrame );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
|
|
||||||
*/
|
|
||||||
public Object getAdapter( Class adapter )
|
|
||||||
{
|
|
||||||
if ( fSourceLocator != null )
|
|
||||||
{
|
|
||||||
if ( adapter.equals( ICSourceLocator.class ) )
|
|
||||||
return fSourceLocator;
|
|
||||||
if ( adapter.equals( IResourceChangeListener.class ) && fSourceLocator instanceof IAdaptable )
|
|
||||||
return ((IAdaptable)fSourceLocator).getAdapter( IResourceChangeListener.class );
|
|
||||||
if ( adapter.equals( ISourceMode.class ) )
|
|
||||||
return fSourceLocator;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IProject getProject()
|
|
||||||
{
|
|
||||||
return fProject;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private SourceSelectionDialog createSourceSelectionDialog( List list )
|
|
||||||
{
|
|
||||||
SourceSelectionDialog dialog = new SourceSelectionDialog( CDebugUIPlugin.getActiveWorkbenchShell() );
|
|
||||||
dialog.setInput( list.toArray() );
|
|
||||||
dialog.setContentProvider( new ArrayContentProvider() );
|
|
||||||
dialog.setLabelProvider( new SourceElementLabelProvider() );
|
|
||||||
dialog.setTitle( "Selection needed" );
|
|
||||||
dialog.setMessage( "Debugger has found multiple files with the same name.\nPlease select one associated with the selected stack frame." );
|
|
||||||
dialog.setInitialSelections( new Object[] { list.get( 0 ) } );
|
|
||||||
return dialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cacheSourceElement( IStackFrame frame, Object sourceElement, boolean alwaysMapToSelection )
|
|
||||||
{
|
|
||||||
if ( alwaysMapToSelection )
|
|
||||||
{
|
|
||||||
String name = getFileName( frame );
|
|
||||||
if ( name != null )
|
|
||||||
{
|
|
||||||
if ( fNamesToSource == null )
|
|
||||||
fNamesToSource = new HashMap();
|
|
||||||
fNamesToSource.put( name, sourceElement );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( fFramesToSource == null )
|
|
||||||
fFramesToSource = new HashMap();
|
|
||||||
fFramesToSource.put( frame, sourceElement );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Object cacheLookup( IStackFrame frame )
|
|
||||||
{
|
|
||||||
String name = getFileName( frame );
|
|
||||||
if ( name != null && fNamesToSource != null )
|
|
||||||
{
|
|
||||||
Object result = fNamesToSource.get( name );
|
|
||||||
if ( result != null )
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
return ( fFramesToSource != null ) ? fFramesToSource.get( frame ) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getFileName( IStackFrame frame )
|
|
||||||
{
|
|
||||||
IStackFrameInfo frameInfo = (IStackFrameInfo)frame.getAdapter( IStackFrameInfo.class );
|
|
||||||
if ( frameInfo != null )
|
|
||||||
{
|
|
||||||
String name = frameInfo.getFile();
|
|
||||||
if ( name != null && name.trim().length() > 0 )
|
|
||||||
return name.trim();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,54 +8,48 @@ package org.eclipse.cdt.debug.ui.sourcelookup;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Observable;
|
||||||
|
import java.util.Observer;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||||
import org.eclipse.cdt.debug.core.CDebugUtils;
|
import org.eclipse.cdt.debug.core.CDebugUtils;
|
||||||
|
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||||
|
import org.eclipse.cdt.debug.core.ICDebugConstants;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
|
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
|
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.IDirectorySourceLocation;
|
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.IProjectSourceLocation;
|
import org.eclipse.cdt.debug.core.sourcelookup.IProjectSourceLocation;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.SourceLocationFactory;
|
import org.eclipse.cdt.debug.core.sourcelookup.SourceLookupFactory;
|
||||||
import org.eclipse.cdt.debug.internal.core.sourcelookup.CDirectorySourceLocation;
|
|
||||||
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLocator;
|
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLocator;
|
||||||
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.PixelConverter;
|
import org.eclipse.cdt.debug.internal.ui.PixelConverter;
|
||||||
import org.eclipse.cdt.debug.internal.ui.dialogfields.CheckedListDialogField;
|
import org.eclipse.cdt.debug.internal.ui.dialogfields.CheckedListDialogField;
|
||||||
import org.eclipse.cdt.debug.internal.ui.dialogfields.DialogField;
|
import org.eclipse.cdt.debug.internal.ui.dialogfields.DialogField;
|
||||||
import org.eclipse.cdt.debug.internal.ui.dialogfields.IDialogFieldListener;
|
import org.eclipse.cdt.debug.internal.ui.dialogfields.IDialogFieldListener;
|
||||||
import org.eclipse.cdt.debug.internal.ui.dialogfields.IListAdapter;
|
import org.eclipse.cdt.debug.internal.ui.dialogfields.IListAdapter;
|
||||||
import org.eclipse.cdt.debug.internal.ui.dialogfields.LayoutUtil;
|
import org.eclipse.cdt.debug.internal.ui.dialogfields.LayoutUtil;
|
||||||
import org.eclipse.cdt.debug.internal.ui.dialogfields.ListDialogField;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.dialogfields.SelectionButtonDialogField;
|
import org.eclipse.cdt.debug.internal.ui.dialogfields.SelectionButtonDialogField;
|
||||||
import org.eclipse.cdt.debug.internal.ui.dialogfields.Separator;
|
import org.eclipse.cdt.debug.internal.ui.dialogfields.Separator;
|
||||||
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.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
|
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||||
|
import org.eclipse.debug.core.model.IPersistableSourceLocator;
|
||||||
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
|
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
|
||||||
import org.eclipse.jface.resource.JFaceResources;
|
import org.eclipse.jface.resource.JFaceResources;
|
||||||
import org.eclipse.jface.viewers.CellEditor;
|
|
||||||
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
||||||
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
||||||
import org.eclipse.jface.viewers.ColumnWeightData;
|
|
||||||
import org.eclipse.jface.viewers.ComboBoxCellEditor;
|
|
||||||
import org.eclipse.jface.viewers.ICellModifier;
|
|
||||||
import org.eclipse.jface.viewers.ICheckStateListener;
|
import org.eclipse.jface.viewers.ICheckStateListener;
|
||||||
import org.eclipse.jface.viewers.ILabelProvider;
|
|
||||||
import org.eclipse.jface.viewers.ITableLabelProvider;
|
|
||||||
import org.eclipse.jface.viewers.LabelProvider;
|
|
||||||
import org.eclipse.jface.viewers.TableLayout;
|
|
||||||
import org.eclipse.jface.viewers.TableViewer;
|
|
||||||
import org.eclipse.jface.viewers.TextCellEditor;
|
|
||||||
import org.eclipse.jface.window.Window;
|
import org.eclipse.jface.window.Window;
|
||||||
import org.eclipse.jface.wizard.WizardDialog;
|
import org.eclipse.jface.wizard.WizardDialog;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.graphics.Image;
|
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Table;
|
|
||||||
import org.eclipse.swt.widgets.TableColumn;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -63,112 +57,8 @@ import org.eclipse.swt.widgets.TableColumn;
|
||||||
*
|
*
|
||||||
* @since Dec 18, 2002
|
* @since Dec 18, 2002
|
||||||
*/
|
*/
|
||||||
public class SourceLookupBlock
|
public class SourceLookupBlock implements Observer
|
||||||
{
|
{
|
||||||
private class SourceListDialogField extends ListDialogField
|
|
||||||
{
|
|
||||||
public SourceListDialogField( IListAdapter adapter, String[] buttonLabels, ILabelProvider lprovider )
|
|
||||||
{
|
|
||||||
super( adapter, buttonLabels, lprovider );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean managedButtonPressed( int index )
|
|
||||||
{
|
|
||||||
super.managedButtonPressed( index );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected TableViewer createTableViewer( Composite parent )
|
|
||||||
{
|
|
||||||
TableViewer viewer = super.createTableViewer( parent );
|
|
||||||
Table table = viewer.getTable();
|
|
||||||
|
|
||||||
TableLayout tableLayout = new TableLayout();
|
|
||||||
table.setLayout( tableLayout );
|
|
||||||
|
|
||||||
GridData gd = new GridData( GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL );
|
|
||||||
gd.grabExcessVerticalSpace = true;
|
|
||||||
gd.grabExcessHorizontalSpace = true;
|
|
||||||
table.setLayoutData( gd );
|
|
||||||
|
|
||||||
table.setLinesVisible( true );
|
|
||||||
table.setHeaderVisible( true );
|
|
||||||
|
|
||||||
new TableColumn( table, SWT.NULL );
|
|
||||||
tableLayout.addColumnData( new ColumnWeightData( 2, true ) );
|
|
||||||
new TableColumn( table, SWT.NULL );
|
|
||||||
tableLayout.addColumnData( new ColumnWeightData( 2, true ) );
|
|
||||||
new TableColumn( table, SWT.NULL );
|
|
||||||
tableLayout.addColumnData( new ColumnWeightData( 1, true ) );
|
|
||||||
|
|
||||||
TableColumn[] columns = table.getColumns();
|
|
||||||
columns[0].setText( "Location" );
|
|
||||||
columns[1].setText( "Association" );
|
|
||||||
columns[2].setText( "Search subfolders" );
|
|
||||||
|
|
||||||
return viewer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class SourceLookupLabelProvider extends LabelProvider implements ITableLabelProvider
|
|
||||||
{
|
|
||||||
public Image getColumnImage( Object element, int columnIndex )
|
|
||||||
{
|
|
||||||
if ( columnIndex == 0 )
|
|
||||||
{
|
|
||||||
if ( element instanceof IProjectSourceLocation )
|
|
||||||
{
|
|
||||||
if ( ((IProjectSourceLocation)element).getProject().isOpen() )
|
|
||||||
return CDebugImages.get( CDebugImages.IMG_OBJS_PROJECT );
|
|
||||||
else
|
|
||||||
return CDebugImages.get( CDebugImages.IMG_OBJS_CLOSED_PROJECT );
|
|
||||||
}
|
|
||||||
if ( element instanceof IDirectorySourceLocation )
|
|
||||||
{
|
|
||||||
return CDebugImages.get( CDebugImages.IMG_OBJS_FOLDER );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getColumnText( Object element, int columnIndex )
|
|
||||||
{
|
|
||||||
if ( columnIndex == 0 )
|
|
||||||
{
|
|
||||||
if ( element instanceof IProjectSourceLocation )
|
|
||||||
{
|
|
||||||
return ((IProjectSourceLocation)element).getProject().getName();
|
|
||||||
}
|
|
||||||
if ( element instanceof IDirectorySourceLocation )
|
|
||||||
{
|
|
||||||
return ((IDirectorySourceLocation)element).getDirectory().toOSString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( columnIndex == 1 )
|
|
||||||
{
|
|
||||||
if ( element instanceof IDirectorySourceLocation && ((IDirectorySourceLocation)element).getAssociation() != null )
|
|
||||||
{
|
|
||||||
return ((IDirectorySourceLocation)element).getAssociation().toOSString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( columnIndex == 2 )
|
|
||||||
{
|
|
||||||
if ( element instanceof IDirectorySourceLocation )
|
|
||||||
return ( ((IDirectorySourceLocation)element).searchSubfolders() ) ? YES_VALUE : NO_VALUE;
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// String constants
|
|
||||||
protected static final String YES_VALUE = "yes";
|
|
||||||
protected static final String NO_VALUE = "no";
|
|
||||||
|
|
||||||
// Column properties
|
|
||||||
private static final String CP_LOCATION = "location";
|
|
||||||
private static final String CP_ASSOCIATION = "association";
|
|
||||||
private static final String CP_SEARCH_SUBFOLDERS = "searchSubfolders";
|
|
||||||
|
|
||||||
private Composite fControl = null;
|
private Composite fControl = null;
|
||||||
private Shell fShell = null;
|
private Shell fShell = null;
|
||||||
private CheckedListDialogField fGeneratedSourceListField;
|
private CheckedListDialogField fGeneratedSourceListField;
|
||||||
|
@ -176,7 +66,6 @@ public class SourceLookupBlock
|
||||||
private SelectionButtonDialogField fSearchForDuplicateFiles;
|
private SelectionButtonDialogField fSearchForDuplicateFiles;
|
||||||
private ILaunchConfigurationDialog fLaunchConfigurationDialog = null;
|
private ILaunchConfigurationDialog fLaunchConfigurationDialog = null;
|
||||||
private boolean fIsDirty = false;
|
private boolean fIsDirty = false;
|
||||||
private ICSourceLocator fLocator = null;
|
|
||||||
private IProject fProject = null;
|
private IProject fProject = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -184,76 +73,9 @@ public class SourceLookupBlock
|
||||||
*/
|
*/
|
||||||
public SourceLookupBlock()
|
public SourceLookupBlock()
|
||||||
{
|
{
|
||||||
String[] generatedSourceButtonLabels = new String[]
|
fGeneratedSourceListField = createGeneratedSourceListField();
|
||||||
{
|
fAddedSourceListField = createAddedSourceListField();
|
||||||
/* 0 */ "Select All",
|
fSearchForDuplicateFiles = createSearchForDuplicateFilesButton();
|
||||||
/* 1 */ "Deselect All",
|
|
||||||
};
|
|
||||||
|
|
||||||
String[] addedSourceButtonLabels = new String[]
|
|
||||||
{
|
|
||||||
/* 0 */ "Add...",
|
|
||||||
/* 1 */ null,
|
|
||||||
/* 2 */ "Up",
|
|
||||||
/* 3 */ "Down",
|
|
||||||
/* 4 */ null,
|
|
||||||
/* 5 */ "Remove",
|
|
||||||
};
|
|
||||||
|
|
||||||
IListAdapter generatedSourceAdapter = new IListAdapter()
|
|
||||||
{
|
|
||||||
public void customButtonPressed( DialogField field, int index )
|
|
||||||
{
|
|
||||||
doGeneratedSourceButtonPressed( index );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void selectionChanged( DialogField field )
|
|
||||||
{
|
|
||||||
doGeneratedSourceSelectionChanged();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
fGeneratedSourceListField = new CheckedListDialogField( generatedSourceAdapter, generatedSourceButtonLabels, new SourceLookupLabelProvider() );
|
|
||||||
fGeneratedSourceListField.setLabelText( "Generic Source Locations" );
|
|
||||||
fGeneratedSourceListField.setCheckAllButtonIndex( 0 );
|
|
||||||
fGeneratedSourceListField.setUncheckAllButtonIndex( 1 );
|
|
||||||
fGeneratedSourceListField.setDialogFieldListener( new IDialogFieldListener()
|
|
||||||
{
|
|
||||||
public void dialogFieldChanged( DialogField field )
|
|
||||||
{
|
|
||||||
doCheckStateChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
} );
|
|
||||||
IListAdapter addedSourceAdapter = new IListAdapter()
|
|
||||||
{
|
|
||||||
public void customButtonPressed( DialogField field, int index )
|
|
||||||
{
|
|
||||||
doAddedSourceButtonPressed( index );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void selectionChanged( DialogField field )
|
|
||||||
{
|
|
||||||
doAddedSourceSelectionChanged();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
fAddedSourceListField = new SourceListDialogField( addedSourceAdapter, addedSourceButtonLabels, new SourceLookupLabelProvider() );
|
|
||||||
fAddedSourceListField.setLabelText( "Additional Source Locations" );
|
|
||||||
fAddedSourceListField.setUpButtonIndex( 2 );
|
|
||||||
fAddedSourceListField.setDownButtonIndex( 3 );
|
|
||||||
fAddedSourceListField.setRemoveButtonIndex( 5 );
|
|
||||||
fSearchForDuplicateFiles = new SelectionButtonDialogField( SWT.CHECK );
|
|
||||||
fSearchForDuplicateFiles.setLabelText( "Search for duplicate source files" );
|
|
||||||
fSearchForDuplicateFiles.setDialogFieldListener(
|
|
||||||
new IDialogFieldListener()
|
|
||||||
{
|
|
||||||
public void dialogFieldChanged( DialogField field )
|
|
||||||
{
|
|
||||||
doCheckStateChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
} );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createControl( Composite parent )
|
public void createControl( Composite parent )
|
||||||
|
@ -292,100 +114,93 @@ public class SourceLookupBlock
|
||||||
LayoutUtil.setWidthHint( fAddedSourceListField.getLabelControl( null ), converter.convertWidthInCharsToPixels( 40 ) );
|
LayoutUtil.setWidthHint( fAddedSourceListField.getLabelControl( null ), converter.convertWidthInCharsToPixels( 40 ) );
|
||||||
LayoutUtil.setHorizontalGrabbing( fAddedSourceListField.getListControl( null ) );
|
LayoutUtil.setHorizontalGrabbing( fAddedSourceListField.getListControl( null ) );
|
||||||
|
|
||||||
TableViewer viewer = fAddedSourceListField.getTableViewer();
|
|
||||||
Table table = viewer.getTable();
|
|
||||||
CellEditor textCellEditor = new TextCellEditor( table );
|
|
||||||
CellEditor comboCellEditor = new ComboBoxCellEditor( table, new String[]{ YES_VALUE, NO_VALUE } );
|
|
||||||
viewer.setCellEditors( new CellEditor[]{ null, textCellEditor, comboCellEditor } );
|
|
||||||
viewer.setColumnProperties( new String[]{ CP_LOCATION, CP_ASSOCIATION, CP_SEARCH_SUBFOLDERS } );
|
|
||||||
viewer.setCellModifier( createCellModifier() );
|
|
||||||
|
|
||||||
// new Separator().doFillIntoGrid( fControl, 3, converter.convertHeightInCharsToPixels( 1 ) );
|
// new Separator().doFillIntoGrid( fControl, 3, converter.convertHeightInCharsToPixels( 1 ) );
|
||||||
|
|
||||||
fSearchForDuplicateFiles.doFillIntoGrid( fControl, 3 );
|
fSearchForDuplicateFiles.doFillIntoGrid( fControl, 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICellModifier createCellModifier()
|
|
||||||
{
|
|
||||||
return new ICellModifier()
|
|
||||||
{
|
|
||||||
public boolean canModify( Object element, String property )
|
|
||||||
{
|
|
||||||
return ( element instanceof CDirectorySourceLocation && ( property.equals( CP_ASSOCIATION ) || property.equals( CP_SEARCH_SUBFOLDERS ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getValue( Object element, String property )
|
|
||||||
{
|
|
||||||
if ( element instanceof CDirectorySourceLocation && property.equals( CP_ASSOCIATION ) )
|
|
||||||
{
|
|
||||||
return ( ((CDirectorySourceLocation)element).getAssociation() != null ) ?
|
|
||||||
((CDirectorySourceLocation)element).getAssociation().toOSString() : "";
|
|
||||||
}
|
|
||||||
if ( element instanceof CDirectorySourceLocation && property.equals( CP_SEARCH_SUBFOLDERS ) )
|
|
||||||
{
|
|
||||||
return ( ((CDirectorySourceLocation)element).searchSubfolders() ) ? new Integer( 0 ) : new Integer( 1 );
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void modify( Object element, String property, Object value )
|
|
||||||
{
|
|
||||||
Object entry = getSelection();
|
|
||||||
if ( entry instanceof CDirectorySourceLocation )
|
|
||||||
{
|
|
||||||
boolean changed = false;
|
|
||||||
if ( property.equals( CP_ASSOCIATION ) && value instanceof String )
|
|
||||||
{
|
|
||||||
Path association = new Path( (String)value );
|
|
||||||
if ( association.isValidPath( (String)value ) )
|
|
||||||
{
|
|
||||||
((CDirectorySourceLocation)entry).setAssociation( association );
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( property.equals( CP_SEARCH_SUBFOLDERS ) && value instanceof Integer )
|
|
||||||
{
|
|
||||||
((CDirectorySourceLocation)entry).setSearchSubfolders( ((Integer)value).intValue() == 0 );
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
if ( changed )
|
|
||||||
{
|
|
||||||
getAddedSourceListField().refresh();
|
|
||||||
updateLaunchConfigurationDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public Control getControl()
|
public Control getControl()
|
||||||
{
|
{
|
||||||
return fControl;
|
return fControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize( ICSourceLocator locator )
|
public void initialize( ILaunchConfiguration configuration )
|
||||||
{
|
{
|
||||||
fLocator = locator;
|
IProject project = getProjectFromLaunchConfiguration( configuration );
|
||||||
if ( fLocator != null )
|
if ( project != null )
|
||||||
{
|
{
|
||||||
ICSourceLocation[] locations = fLocator.getSourceLocations();
|
IProject oldProject = getProject();
|
||||||
initializeGeneratedLocations( fLocator.getProject(), locations );
|
setProject( project );
|
||||||
resetAdditionalLocations( locations );
|
if ( project.equals( oldProject ) )
|
||||||
fSearchForDuplicateFiles.setSelection( fLocator.searchForDuplicateFiles() );
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
String id = configuration.getAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, "" );
|
||||||
|
if ( isEmpty( id ) ||
|
||||||
|
CDebugUIPlugin.getDefaultSourceLocatorID().equals( id ) ||
|
||||||
|
CDebugUIPlugin.getDefaultSourceLocatorOldID().equals( id ) )
|
||||||
|
{
|
||||||
|
String memento = configuration.getAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, "" );
|
||||||
|
if ( !isEmpty( memento ) )
|
||||||
|
initializeFromMemento( memento );
|
||||||
|
else
|
||||||
|
initializeDefaults();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch( CoreException e )
|
||||||
|
{
|
||||||
|
initializeDefaults();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
initializeDefaults();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
initializeGeneratedLocations( null, new ICSourceLocation[0] );
|
||||||
|
resetAdditionalLocations( CDebugCorePlugin.getDefault().getCommonSourceLocations() );
|
||||||
|
fSearchForDuplicateFiles.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_SEARCH_DUPLICATE_FILES ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeFromMemento( String memento ) throws CoreException
|
||||||
|
{
|
||||||
|
IPersistableSourceLocator locator = CDebugUIPlugin.createDefaultSourceLocator();
|
||||||
|
locator.initializeFromMemento( memento );
|
||||||
|
if ( locator instanceof IAdaptable )
|
||||||
|
{
|
||||||
|
ICSourceLocator clocator = (ICSourceLocator)((IAdaptable)locator).getAdapter( ICSourceLocator.class );
|
||||||
|
if ( clocator != null )
|
||||||
|
initializeFromLocator( clocator );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeDefaults()
|
||||||
|
{
|
||||||
|
initializeGeneratedLocations( getProject(), new ICSourceLocation[] { SourceLookupFactory.createProjectSourceLocation( getProject() ) } );
|
||||||
|
resetAdditionalLocations( CDebugCorePlugin.getDefault().getCommonSourceLocations() );
|
||||||
|
fSearchForDuplicateFiles.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_SEARCH_DUPLICATE_FILES ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeFromLocator( ICSourceLocator locator )
|
||||||
|
{
|
||||||
|
ICSourceLocation[] locations = locator.getSourceLocations();
|
||||||
|
initializeGeneratedLocations( locator.getProject(), locations );
|
||||||
|
resetAdditionalLocations( locations );
|
||||||
|
fSearchForDuplicateFiles.setSelection( locator.searchForDuplicateFiles() );
|
||||||
|
}
|
||||||
|
|
||||||
private void initializeGeneratedLocations( IProject project, ICSourceLocation[] locations )
|
private void initializeGeneratedLocations( IProject project, ICSourceLocation[] locations )
|
||||||
{
|
{
|
||||||
fGeneratedSourceListField.removeAllElements();
|
fGeneratedSourceListField.removeAllElements();
|
||||||
if ( project == null && project.exists() && project.isOpen() )
|
if ( project == null || !project.exists() || !project.isOpen() )
|
||||||
return;
|
return;
|
||||||
List list = CDebugUtils.getReferencedProjects( project );
|
List list = CDebugUtils.getReferencedProjects( project );
|
||||||
IProject[] refs = (IProject[])list.toArray( new IProject[list.size()] );
|
IProject[] refs = (IProject[])list.toArray( new IProject[list.size()] );
|
||||||
ICSourceLocation loc = getLocationForProject( project, locations );
|
ICSourceLocation loc = getLocationForProject( project, locations );
|
||||||
boolean checked = ( loc != null && ((IProjectSourceLocation)loc).isGeneric() );
|
boolean checked = ( loc != null && ((IProjectSourceLocation)loc).isGeneric() );
|
||||||
if ( loc == null )
|
if ( loc == null )
|
||||||
loc = SourceLocationFactory.createProjectSourceLocation( project, true );
|
loc = SourceLookupFactory.createProjectSourceLocation( project, true );
|
||||||
fGeneratedSourceListField.addElement( loc );
|
fGeneratedSourceListField.addElement( loc );
|
||||||
fGeneratedSourceListField.setChecked( loc, checked );
|
fGeneratedSourceListField.setChecked( loc, checked );
|
||||||
|
|
||||||
|
@ -394,7 +209,7 @@ public class SourceLookupBlock
|
||||||
loc = getLocationForProject( refs[i], locations );
|
loc = getLocationForProject( refs[i], locations );
|
||||||
checked = ( loc != null );
|
checked = ( loc != null );
|
||||||
if ( loc == null )
|
if ( loc == null )
|
||||||
loc = SourceLocationFactory.createProjectSourceLocation( refs[i], true );
|
loc = SourceLookupFactory.createProjectSourceLocation( refs[i], true );
|
||||||
fGeneratedSourceListField.addElement( loc );
|
fGeneratedSourceListField.addElement( loc );
|
||||||
fGeneratedSourceListField.setChecked( loc, checked );
|
fGeneratedSourceListField.setChecked( loc, checked );
|
||||||
}
|
}
|
||||||
|
@ -421,27 +236,27 @@ public class SourceLookupBlock
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doAddedSourceButtonPressed( int index )
|
public void performApply( ILaunchConfigurationWorkingCopy configuration )
|
||||||
{
|
{
|
||||||
switch( index )
|
IPersistableSourceLocator locator = CDebugUIPlugin.createDefaultSourceLocator();
|
||||||
|
try
|
||||||
{
|
{
|
||||||
case 0: // Add...
|
locator.initializeDefaults( configuration );
|
||||||
if ( addSourceLocation() )
|
if ( locator instanceof IAdaptable )
|
||||||
fIsDirty = true;
|
{
|
||||||
break;
|
ICSourceLocator clocator = (ICSourceLocator)((IAdaptable)locator).getAdapter( ICSourceLocator.class );
|
||||||
case 2: // Up
|
if ( clocator != null )
|
||||||
case 3: // Down
|
{
|
||||||
case 5: // Remove
|
clocator.setSourceLocations( getSourceLocations() );
|
||||||
fIsDirty = true;
|
clocator.setSearchForDuplicateFiles( searchForDuplicateFiles() );
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if ( isDirty() )
|
|
||||||
updateLaunchConfigurationDialog();
|
|
||||||
}
|
}
|
||||||
|
configuration.setAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, locator.getMemento() );
|
||||||
protected void doAddedSourceSelectionChanged()
|
}
|
||||||
|
catch( CoreException e )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void doCheckStateChanged()
|
protected void doCheckStateChanged()
|
||||||
{
|
{
|
||||||
|
@ -466,6 +281,24 @@ public class SourceLookupBlock
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void doAddedSourceButtonPressed( int index )
|
||||||
|
{
|
||||||
|
switch( index )
|
||||||
|
{
|
||||||
|
case 0: // Add...
|
||||||
|
if ( addSourceLocation() )
|
||||||
|
fIsDirty = true;
|
||||||
|
break;
|
||||||
|
case 2: // Up
|
||||||
|
case 3: // Down
|
||||||
|
case 5: // Remove
|
||||||
|
fIsDirty = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ( isDirty() )
|
||||||
|
updateLaunchConfigurationDialog();
|
||||||
|
}
|
||||||
|
|
||||||
public ICSourceLocation[] getSourceLocations()
|
public ICSourceLocation[] getSourceLocations()
|
||||||
{
|
{
|
||||||
ArrayList list = new ArrayList( getGeneratedSourceListField().getElements().size() + getAddedSourceListField().getElements().size() );
|
ArrayList list = new ArrayList( getGeneratedSourceListField().getElements().size() + getAddedSourceListField().getElements().size() );
|
||||||
|
@ -530,7 +363,7 @@ public class SourceLookupBlock
|
||||||
locations = CSourceLocator.getDefaultSourceLocations( getProject() );
|
locations = CSourceLocator.getDefaultSourceLocations( getProject() );
|
||||||
resetGeneratedLocations( locations );
|
resetGeneratedLocations( locations );
|
||||||
resetAdditionalLocations( locations );
|
resetAdditionalLocations( locations );
|
||||||
fSearchForDuplicateFiles.setSelection( false );
|
fSearchForDuplicateFiles.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_SEARCH_DUPLICATE_FILES ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public IProject getProject()
|
public IProject getProject()
|
||||||
|
@ -538,7 +371,7 @@ public class SourceLookupBlock
|
||||||
return fProject;
|
return fProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProject( IProject project )
|
private void setProject( IProject project )
|
||||||
{
|
{
|
||||||
fProject = project;
|
fProject = project;
|
||||||
}
|
}
|
||||||
|
@ -566,4 +399,122 @@ public class SourceLookupBlock
|
||||||
{
|
{
|
||||||
return ( fSearchForDuplicateFiles != null ) ? fSearchForDuplicateFiles.isSelected() : false;
|
return ( fSearchForDuplicateFiles != null ) ? fSearchForDuplicateFiles.isSelected() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private CheckedListDialogField createGeneratedSourceListField()
|
||||||
|
{
|
||||||
|
String[] generatedSourceButtonLabels = new String[]
|
||||||
|
{
|
||||||
|
/* 0 */ "Select All",
|
||||||
|
/* 1 */ "Deselect All",
|
||||||
|
};
|
||||||
|
|
||||||
|
IListAdapter generatedSourceAdapter = new IListAdapter()
|
||||||
|
{
|
||||||
|
public void customButtonPressed( DialogField field, int index )
|
||||||
|
{
|
||||||
|
doGeneratedSourceButtonPressed( index );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void selectionChanged( DialogField field )
|
||||||
|
{
|
||||||
|
doGeneratedSourceSelectionChanged();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CheckedListDialogField field = new CheckedListDialogField( generatedSourceAdapter, generatedSourceButtonLabels, new SourceLookupLabelProvider() );
|
||||||
|
field.setLabelText( "Generic Source Locations" );
|
||||||
|
field.setCheckAllButtonIndex( 0 );
|
||||||
|
field.setUncheckAllButtonIndex( 1 );
|
||||||
|
field.setDialogFieldListener(
|
||||||
|
new IDialogFieldListener()
|
||||||
|
{
|
||||||
|
public void dialogFieldChanged( DialogField field )
|
||||||
|
{
|
||||||
|
doCheckStateChanged();
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
|
private SourceListDialogField createAddedSourceListField()
|
||||||
|
{
|
||||||
|
SourceListDialogField field =
|
||||||
|
new SourceListDialogField( "Additional Source Locations",
|
||||||
|
new IListAdapter()
|
||||||
|
{
|
||||||
|
public void customButtonPressed( DialogField field, int index )
|
||||||
|
{
|
||||||
|
doAddedSourceButtonPressed( index );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void selectionChanged(DialogField field)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
field.addObserver( this );
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
|
private SelectionButtonDialogField createSearchForDuplicateFilesButton()
|
||||||
|
{
|
||||||
|
SelectionButtonDialogField button = new SelectionButtonDialogField( SWT.CHECK );
|
||||||
|
button.setLabelText( "Search for duplicate source files" );
|
||||||
|
button.setDialogFieldListener(
|
||||||
|
new IDialogFieldListener()
|
||||||
|
{
|
||||||
|
public void dialogFieldChanged( DialogField field )
|
||||||
|
{
|
||||||
|
doCheckStateChanged();
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
return button;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.util.Observer#update(java.util.Observable, java.lang.Object)
|
||||||
|
*/
|
||||||
|
public void update( Observable o, Object arg )
|
||||||
|
{
|
||||||
|
if ( arg instanceof Integer && ((Integer)arg).intValue() == 0 )
|
||||||
|
{
|
||||||
|
if ( addSourceLocation() )
|
||||||
|
fIsDirty = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fIsDirty = true;
|
||||||
|
if ( fIsDirty )
|
||||||
|
updateLaunchConfigurationDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isEmpty( String string )
|
||||||
|
{
|
||||||
|
return string == null || string.length() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose()
|
||||||
|
{
|
||||||
|
if ( getAddedSourceListField() != null )
|
||||||
|
{
|
||||||
|
getAddedSourceListField().deleteObserver( this );
|
||||||
|
getAddedSourceListField().dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IProject getProjectFromLaunchConfiguration( ILaunchConfiguration configuration )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
String projectName = configuration.getAttribute( ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "" );
|
||||||
|
if ( !isEmpty( projectName ) )
|
||||||
|
{
|
||||||
|
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( projectName );
|
||||||
|
if ( project != null && project.exists() && project.isOpen() )
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( CoreException e )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,9 @@
|
||||||
*/
|
*/
|
||||||
package org.eclipse.cdt.debug.ui.sourcelookup;
|
package org.eclipse.cdt.debug.ui.sourcelookup;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
|
||||||
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
|
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
|
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
import org.eclipse.core.resources.IProject;
|
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
@ -68,8 +65,7 @@ public class SourcePropertyPage extends PropertyPage
|
||||||
|
|
||||||
protected Control createActiveContents( Composite parent )
|
protected Control createActiveContents( Composite parent )
|
||||||
{
|
{
|
||||||
fBlock.setProject( getProject() );
|
fBlock.initialize( getLaunchConfiguration() );
|
||||||
fBlock.initialize( getSourceLocator() );
|
|
||||||
fBlock.createControl( parent );
|
fBlock.createControl( parent );
|
||||||
return fBlock.getControl();
|
return fBlock.getControl();
|
||||||
}
|
}
|
||||||
|
@ -84,19 +80,6 @@ public class SourcePropertyPage extends PropertyPage
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICSourceLocator getSourceLocator()
|
|
||||||
{
|
|
||||||
ICDebugTarget target = getDebugTarget();
|
|
||||||
if ( target != null )
|
|
||||||
{
|
|
||||||
if ( target.getLaunch().getSourceLocator() instanceof IAdaptable )
|
|
||||||
{
|
|
||||||
return (ICSourceLocator)((IAdaptable)target.getLaunch().getSourceLocator()).getAdapter( ICSourceLocator.class );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.preference.IPreferencePage#performOk()
|
* @see org.eclipse.jface.preference.IPreferencePage#performOk()
|
||||||
*/
|
*/
|
||||||
|
@ -153,23 +136,20 @@ public class SourcePropertyPage extends PropertyPage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IProject getProject()
|
private ILaunchConfiguration getLaunchConfiguration()
|
||||||
{
|
{
|
||||||
IProject project = null;
|
|
||||||
ICDebugTarget target = getDebugTarget();
|
ICDebugTarget target = getDebugTarget();
|
||||||
if ( target != null )
|
return ( target != null ) ? target.getLaunch().getLaunchConfiguration() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.dialogs.IDialogPage#dispose()
|
||||||
|
*/
|
||||||
|
public void dispose()
|
||||||
{
|
{
|
||||||
ILaunchConfiguration configuration = target.getLaunch().getLaunchConfiguration();
|
if ( fBlock != null )
|
||||||
try
|
fBlock.dispose();
|
||||||
{
|
super.dispose();
|
||||||
String projectName = configuration.getAttribute( ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "" );
|
|
||||||
if ( projectName != null && projectName.length() > 0 )
|
|
||||||
project = ResourcesPlugin.getWorkspace().getRoot().getProject( projectName );
|
|
||||||
}
|
|
||||||
catch( CoreException e )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return project;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue