Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorMikhail Khodjaiants2003-11-18 17:25:13 -0500
committerMikhail Khodjaiants2003-11-18 17:25:13 -0500
commite0486ead58ad07851c43b4339e07c25e56987042 (patch)
tree6251de6895bfbf8e1f0cf27da04e2979538bc90a /debug
parent493af749257f9853a69a14aa0c7682123f55e41d (diff)
downloadorg.eclipse.cdt-e0486ead58ad07851c43b4339e07c25e56987042.tar.gz
org.eclipse.cdt-e0486ead58ad07851c43b4339e07c25e56987042.tar.xz
org.eclipse.cdt-e0486ead58ad07851c43b4339e07c25e56987042.zip
Fix for PR 46884: Add a preference page to set common source location
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.core/ChangeLog43
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java12
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConstants.java11
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/ICSourceLocation.java2
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/SourceLocationFactory.java35
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java43
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java9
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java12
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java6
-rw-r--r--debug/org.eclipse.cdt.debug.ui/.classpath1
-rw-r--r--debug/org.eclipse.cdt.debug.ui/.project1
-rw-r--r--debug/org.eclipse.cdt.debug.ui/ChangeLog55
-rw-r--r--debug/org.eclipse.cdt.debug.ui/plugin.properties4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/plugin.xml20
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ICDebugHelpContextIds.java1
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/wizards/AddDirectorySourceLocationBlock.java4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/wizards/AddProjectSourceLocationBlock.java4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java20
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/CUISourceLocator.java258
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourceLookupBlock.java521
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourcePropertyPage.java48
21 files changed, 471 insertions, 639 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog
index 57760fa3488..dd56f810b5b 100644
--- a/debug/org.eclipse.cdt.debug.core/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.core/ChangeLog
@@ -3,6 +3,49 @@
'setCurrentThread': check if the old current thread is not null.
* 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
Core support of the "Search subfolders" option for directory source locations.
* IDirectorySourceLocation.java
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java
index b4373fa2ecf..76e4ae846ca 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java
@@ -8,9 +8,11 @@ package org.eclipse.cdt.debug.core;
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.SessionManager;
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.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -229,4 +231,14 @@ public class CDebugCorePlugin extends Plugin
fSessionManager.dispose();
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 ) );
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConstants.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConstants.java
index c7be4df97cf..1529622fd02 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConstants.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConstants.java
@@ -59,6 +59,17 @@ public interface ICDebugConstants
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.
*/
public static final int DEF_NUMBER_OF_INSTRUCTIONS = 100;
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/ICSourceLocation.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/ICSourceLocation.java
index 1f8f10db517..e3eaf285078 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/ICSourceLocation.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/ICSourceLocation.java
@@ -67,4 +67,6 @@ public interface ICSourceLocation extends IAdaptable
* @param search - a value to set
*/
void setSearchForDuplicateFiles( boolean search );
+
+ void dispose();
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/SourceLocationFactory.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/SourceLocationFactory.java
deleted file mode 100644
index c09a581900e..00000000000
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/SourceLocationFactory.java
+++ /dev/null
@@ -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 );
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java
index d539140c551..4781c9c8f8f 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java
@@ -91,7 +91,7 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
public Object findSourceElement( String name ) throws CoreException
{
Object result = null;
- if ( getDirectory() != null )
+ if ( !isEmpty( name ) && getDirectory() != null )
{
File file = new File( name );
if ( file.isAbsolute() )
@@ -187,7 +187,8 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
return result;
}
}
- return list;
+ if ( list.size() > 0 )
+ return ( list.size() == 1 ) ? list.getFirst() : list;
}
return null;
}
@@ -200,17 +201,12 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
IPath filePath = new Path( name );
IPath path = new Path( folder.getAbsolutePath() );
IPath association = getAssociation();
- if ( isPrefix( path, filePath ) )
- {
- filePath = path.append( filePath.removeFirstSegments( path.segmentCount() ) );
- }
- else if ( association != null && isPrefix( association, filePath ) )
+ if ( !isPrefix( path, filePath ) || path.segmentCount() + 1 != filePath.segmentCount() )
{
- filePath = path.append( filePath.removeFirstSegments( association.segmentCount() ) );
- }
- else
- {
- return null;
+ if ( association != null && isPrefix( association, filePath ) && association.segmentCount() + 1 == filePath.segmentCount() )
+ filePath = path.append( filePath.removeFirstSegments( association.segmentCount() ) );
+ else
+ return null;
}
// Try for a file in another workspace project
@@ -226,7 +222,7 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
return ( list.size() == 1 ) ? list.getFirst() : list;
file = filePath.toFile();
- if ( file.exists() )
+ if ( file.exists() && file.isFile() )
{
return createExternalFileStorage( filePath );
}
@@ -257,7 +253,8 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
return result;
}
}
- return list;
+ if ( list.size() > 0 )
+ return ( list.size() == 1 ) ? list.getFirst() : list;
}
return null;
}
@@ -267,7 +264,7 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
IPath path = new Path( folder.getAbsolutePath() );
path = path.append( fileName );
File file = path.toFile();
- if ( file.exists() )
+ if ( file.exists() && file.isFile() )
{
path = new Path( file.getAbsolutePath() );
IFile[] wsFiles = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation( path );
@@ -458,6 +455,7 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
public void setSearchSubfolders( boolean search )
{
+ resetFolders();
fSearchSubfolders = search;
}
@@ -502,4 +500,19 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
list.addAll( getFileFolders( folders[i] ) );
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()
+ {
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java
index 2890bfde7a3..0f7c9328cc9 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java
@@ -96,7 +96,7 @@ public class CProjectSourceLocation implements IProjectSourceLocation
public Object findSourceElement( String name ) throws CoreException
{
Object result = null;
- if ( getProject() != null && !notFoundCacheLookup( name ) )
+ if ( !isEmpty( name ) && getProject() != null && !notFoundCacheLookup( name ) )
{
result = cacheLookup( name );
if ( result == null )
@@ -216,7 +216,7 @@ public class CProjectSourceLocation implements IProjectSourceLocation
fNotFoundCache.add( name );
}
- protected void dispose()
+ public void dispose()
{
fCache.clear();
fNotFoundCache.clear();
@@ -388,4 +388,9 @@ public class CProjectSourceLocation implements IProjectSourceLocation
fNotFoundCache.clear();
fSearchForDuplicateFiles = search;
}
+
+ public String toString()
+ {
+ return ( getProject() != null ) ? fProject.toString() : "";
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java
index bff11bee30d..0866a38b71b 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java
@@ -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.ICSourceLocator;
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.IProject;
import org.eclipse.core.resources.IResource;
@@ -219,7 +219,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
ArrayList list = new ArrayList();
if ( project != null && project.exists() )
{
- list.add( SourceLocationFactory.createProjectSourceLocation( project ) );
+ list.add( SourceLookupFactory.createProjectSourceLocation( project ) );
addReferencedSourceLocations( list, project );
}
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] ) )
{
- list.add( SourceLocationFactory.createProjectSourceLocation( projects[i] ) );
+ list.add( SourceLookupFactory.createProjectSourceLocation( projects[i] ) );
addReferencedSourceLocations( list, projects[i] );
}
}
@@ -656,12 +656,12 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
Iterator it = fReferencedProjects.iterator();
ArrayList list = new ArrayList( fReferencedProjects.size() );
if ( getProject() != null && getProject().exists() && getProject().isOpen() )
- list.add( SourceLocationFactory.createProjectSourceLocation( getProject() ) );
+ list.add( SourceLookupFactory.createProjectSourceLocation( getProject() ) );
while( it.hasNext() )
{
IProject project = (IProject)it.next();
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()] );
}
@@ -721,7 +721,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
{
IProject project = (IProject)it.next();
if ( !fReferencedProjects.contains( project ) )
- newLocations.add( SourceLocationFactory.createProjectSourceLocation( project ) );
+ newLocations.add( SourceLookupFactory.createProjectSourceLocation( project ) );
}
fReferencedProjects = newRefs;
setSourceLocations( (ICSourceLocation[])newLocations.toArray( new ICSourceLocation[newLocations.size()] ) );
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java
index 58728b25cfe..c8e2ca56da0 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java
@@ -136,6 +136,12 @@ public class CSourceManager implements ICSourceLocator,
{
if ( adapter.equals( CSourceManager.class ) )
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 ) &&
fSourceLocator instanceof IResourceChangeListener )
return fSourceLocator;
diff --git a/debug/org.eclipse.cdt.debug.ui/.classpath b/debug/org.eclipse.cdt.debug.ui/.classpath
index 3ca60357b63..712ef3d8f53 100644
--- a/debug/org.eclipse.cdt.debug.ui/.classpath
+++ b/debug/org.eclipse.cdt.debug.ui/.classpath
@@ -8,6 +8,7 @@
<classpathentry kind="src" path="/org.eclipse.cdt.debug.core"/>
<classpathentry kind="src" path="/org.eclipse.cdt.ui"/>
<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.boot"/>
<classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
diff --git a/debug/org.eclipse.cdt.debug.ui/.project b/debug/org.eclipse.cdt.debug.ui/.project
index 3c1535e67bd..f5ffeabe9d4 100644
--- a/debug/org.eclipse.cdt.debug.ui/.project
+++ b/debug/org.eclipse.cdt.debug.ui/.project
@@ -3,6 +3,7 @@
<name>org.eclipse.cdt.debug.ui</name>
<comment></comment>
<projects>
+ <project>org.apache.xerces</project>
<project>org.eclipse.cdt.core</project>
<project>org.eclipse.cdt.debug.core</project>
<project>org.eclipse.cdt.ui</project>
diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog
index 291171ee3ea..dd27a359f85 100644
--- a/debug/org.eclipse.cdt.debug.ui/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog
@@ -2,6 +2,61 @@
Fix for PR 45957: Memory view: last column does not show updates.
* 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
Implementation of the "Search subfolders" option for directory source locations.
* AddDirectorySourceLocationBlock.java
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.properties b/debug/org.eclipse.cdt.debug.ui/plugin.properties
index b6809bf8562..ba3637b28df 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.properties
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.properties
@@ -16,6 +16,7 @@ MemoryPreferencePage.name=Memory View
RegistersPreferencePage.name=Registers View
CDebugPreferencePage.name=Debug
SharedLibrariesPreferencePage.name=Shared Libraries View
+SourcePreferencePage.name=Source Code Locations
RunMenu.label=&Run
DebugActionSet.label=C/C++ Debug
@@ -79,3 +80,6 @@ EnableVariablesAction.tooltip=Enable Selected Variables
DisableVariablesAction.label=Disable
DisableVariablesAction.tooltip=Disable Selected Variables
+
+DefaultSourceLocator.name=Default C/C++ Source Locator
+OldDefaultSourceLocator.name=Default C/C++ Source Locator (old)
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml
index 9d243f5ce18..58ce745ff35 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml
@@ -19,6 +19,7 @@
<import plugin="org.eclipse.cdt.debug.core"/>
<import plugin="org.eclipse.cdt.ui"/>
<import plugin="org.eclipse.cdt.core"/>
+ <import plugin="org.apache.xerces"/>
</requires>
@@ -130,6 +131,12 @@
class="org.eclipse.cdt.debug.internal.ui.preferences.CDebugPreferencePage"
id="org.eclipse.cdt.debug.ui.CDebugPreferencePage">
</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
point="org.eclipse.ui.actionSets">
@@ -1237,5 +1244,18 @@
id="org.eclipse.cdt.debug.ui.editor.CDebugEditor">
</editor>
</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>
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ICDebugHelpContextIds.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ICDebugHelpContextIds.java
index 34b3c41cb72..df0ad8a4f2f 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ICDebugHelpContextIds.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ICDebugHelpContextIds.java
@@ -43,6 +43,7 @@ public interface ICDebugHelpContextIds
public static final String SIGNALS_VIEW = PREFIX + "signals_view_context"; //$NON-NLS-1$
// 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 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$
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/wizards/AddDirectorySourceLocationBlock.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/wizards/AddDirectorySourceLocationBlock.java
index 36a3332e842..f3b57aa2ee2 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/wizards/AddDirectorySourceLocationBlock.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/wizards/AddDirectorySourceLocationBlock.java
@@ -6,7 +6,7 @@
package org.eclipse.cdt.debug.internal.ui.wizards;
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.SWTUtil;
import org.eclipse.core.runtime.IPath;
@@ -194,7 +194,7 @@ public class AddDirectorySourceLocationBlock
if ( isLocationPathValid() )
{
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;
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/wizards/AddProjectSourceLocationBlock.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/wizards/AddProjectSourceLocationBlock.java
index 12eac3c738f..1e7f0571536 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/wizards/AddProjectSourceLocationBlock.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/wizards/AddProjectSourceLocationBlock.java
@@ -6,7 +6,7 @@
package org.eclipse.cdt.debug.internal.ui.wizards;
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.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.IDoubleClickListener;
@@ -92,7 +92,7 @@ public class AddProjectSourceLocationBlock
{
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;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java
index 9deb4521e26..2e1f484bf8e 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java
@@ -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.RegistersViewPreferencePage;
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.IWorkspace;
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.model.IDebugElement;
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.IThread;
import org.eclipse.debug.ui.IDebugUIConstants;
@@ -508,4 +510,22 @@ public class CDebugUIPlugin extends AbstractUIPlugin
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;
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/CUISourceLocator.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/CUISourceLocator.java
deleted file mode 100644
index 53b4cfa2a81..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/CUISourceLocator.java
+++ /dev/null
@@ -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;
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourceLookupBlock.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourceLookupBlock.java
index 3a5cca33130..444555d1451 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourceLookupBlock.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourceLookupBlock.java
@@ -8,54 +8,48 @@ package org.eclipse.cdt.debug.ui.sourcelookup;
import java.util.ArrayList;
import java.util.Iterator;
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.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.debug.core.ICDebugConstants;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
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.SourceLocationFactory;
-import org.eclipse.cdt.debug.internal.core.sourcelookup.CDirectorySourceLocation;
+import org.eclipse.cdt.debug.core.sourcelookup.SourceLookupFactory;
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.dialogfields.CheckedListDialogField;
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.IListAdapter;
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.Separator;
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.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.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
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.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.wizard.WizardDialog;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
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
*/
-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 Shell fShell = null;
private CheckedListDialogField fGeneratedSourceListField;
@@ -176,7 +66,6 @@ public class SourceLookupBlock
private SelectionButtonDialogField fSearchForDuplicateFiles;
private ILaunchConfigurationDialog fLaunchConfigurationDialog = null;
private boolean fIsDirty = false;
- private ICSourceLocator fLocator = null;
private IProject fProject = null;
/**
@@ -184,76 +73,9 @@ public class SourceLookupBlock
*/
public SourceLookupBlock()
{
- String[] generatedSourceButtonLabels = new String[]
- {
- /* 0 */ "Select All",
- /* 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();
- }
-
- } );
+ fGeneratedSourceListField = createGeneratedSourceListField();
+ fAddedSourceListField = createAddedSourceListField();
+ fSearchForDuplicateFiles = createSearchForDuplicateFilesButton();
}
public void createControl( Composite parent )
@@ -292,100 +114,93 @@ public class SourceLookupBlock
LayoutUtil.setWidthHint( fAddedSourceListField.getLabelControl( null ), converter.convertWidthInCharsToPixels( 40 ) );
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 ) );
fSearchForDuplicateFiles.doFillIntoGrid( fControl, 3 );
}
- private ICellModifier createCellModifier()
+ public Control getControl()
{
- return new ICellModifier()
+ return fControl;
+ }
+
+ public void initialize( ILaunchConfiguration configuration )
+ {
+ IProject project = getProjectFromLaunchConfiguration( configuration );
+ if ( project != null )
+ {
+ IProject oldProject = getProject();
+ setProject( project );
+ if ( project.equals( oldProject ) )
+ {
+ try
+ {
+ String id = configuration.getAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, "" );
+ if ( isEmpty( id ) ||
+ CDebugUIPlugin.getDefaultSourceLocatorID().equals( id ) ||
+ CDebugUIPlugin.getDefaultSourceLocatorOldID().equals( id ) )
{
- 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;
- }
+ 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 ) );
+ }
+ }
- 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();
- }
- }
- }
- };
+ 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 );
+ }
}
- public Control getControl()
+ private void initializeDefaults()
{
- return fControl;
+ initializeGeneratedLocations( getProject(), new ICSourceLocation[] { SourceLookupFactory.createProjectSourceLocation( getProject() ) } );
+ resetAdditionalLocations( CDebugCorePlugin.getDefault().getCommonSourceLocations() );
+ fSearchForDuplicateFiles.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_SEARCH_DUPLICATE_FILES ) );
}
-
- public void initialize( ICSourceLocator locator )
+
+ private void initializeFromLocator( ICSourceLocator locator )
{
- fLocator = locator;
- if ( fLocator != null )
- {
- ICSourceLocation[] locations = fLocator.getSourceLocations();
- initializeGeneratedLocations( fLocator.getProject(), locations );
- resetAdditionalLocations( locations );
- fSearchForDuplicateFiles.setSelection( fLocator.searchForDuplicateFiles() );
- }
+ ICSourceLocation[] locations = locator.getSourceLocations();
+ initializeGeneratedLocations( locator.getProject(), locations );
+ resetAdditionalLocations( locations );
+ fSearchForDuplicateFiles.setSelection( locator.searchForDuplicateFiles() );
}
private void initializeGeneratedLocations( IProject project, ICSourceLocation[] locations )
{
fGeneratedSourceListField.removeAllElements();
- if ( project == null && project.exists() && project.isOpen() )
+ if ( project == null || !project.exists() || !project.isOpen() )
return;
List list = CDebugUtils.getReferencedProjects( project );
IProject[] refs = (IProject[])list.toArray( new IProject[list.size()] );
ICSourceLocation loc = getLocationForProject( project, locations );
boolean checked = ( loc != null && ((IProjectSourceLocation)loc).isGeneric() );
if ( loc == null )
- loc = SourceLocationFactory.createProjectSourceLocation( project, true );
+ loc = SourceLookupFactory.createProjectSourceLocation( project, true );
fGeneratedSourceListField.addElement( loc );
fGeneratedSourceListField.setChecked( loc, checked );
@@ -394,7 +209,7 @@ public class SourceLookupBlock
loc = getLocationForProject( refs[i], locations );
checked = ( loc != null );
if ( loc == null )
- loc = SourceLocationFactory.createProjectSourceLocation( refs[i], true );
+ loc = SourceLookupFactory.createProjectSourceLocation( refs[i], true );
fGeneratedSourceListField.addElement( loc );
fGeneratedSourceListField.setChecked( loc, checked );
}
@@ -421,26 +236,26 @@ public class SourceLookupBlock
}
}
- protected void doAddedSourceButtonPressed( int index )
+ public void performApply( ILaunchConfigurationWorkingCopy configuration )
{
- switch( index )
+ IPersistableSourceLocator locator = CDebugUIPlugin.createDefaultSourceLocator();
+ try
+ {
+ locator.initializeDefaults( configuration );
+ if ( locator instanceof IAdaptable )
+ {
+ ICSourceLocator clocator = (ICSourceLocator)((IAdaptable)locator).getAdapter( ICSourceLocator.class );
+ if ( clocator != null )
+ {
+ clocator.setSourceLocations( getSourceLocations() );
+ clocator.setSearchForDuplicateFiles( searchForDuplicateFiles() );
+ }
+ }
+ configuration.setAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, locator.getMemento() );
+ }
+ catch( CoreException e )
{
- case 0: // Add...
- if ( addSourceLocation() )
- fIsDirty = true;
- break;
- case 2: // Up
- case 3: // Down
- case 5: // Remove
- fIsDirty = true;
- break;
}
- if ( isDirty() )
- updateLaunchConfigurationDialog();
- }
-
- protected void doAddedSourceSelectionChanged()
- {
}
protected void doCheckStateChanged()
@@ -465,6 +280,24 @@ public class SourceLookupBlock
protected void doGeneratedSourceSelectionChanged()
{
}
+
+ 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()
{
@@ -530,7 +363,7 @@ public class SourceLookupBlock
locations = CSourceLocator.getDefaultSourceLocations( getProject() );
resetGeneratedLocations( locations );
resetAdditionalLocations( locations );
- fSearchForDuplicateFiles.setSelection( false );
+ fSearchForDuplicateFiles.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_SEARCH_DUPLICATE_FILES ) );
}
public IProject getProject()
@@ -538,7 +371,7 @@ public class SourceLookupBlock
return fProject;
}
- public void setProject( IProject project )
+ private void setProject( IProject project )
{
fProject = project;
}
@@ -566,4 +399,122 @@ public class SourceLookupBlock
{
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;
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourcePropertyPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourcePropertyPage.java
index 06379db740f..523496f93d8 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourcePropertyPage.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourcePropertyPage.java
@@ -5,12 +5,9 @@
*/
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.sourcelookup.ICSourceLocator;
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.IAdaptable;
import org.eclipse.core.runtime.IStatus;
@@ -68,8 +65,7 @@ public class SourcePropertyPage extends PropertyPage
protected Control createActiveContents( Composite parent )
{
- fBlock.setProject( getProject() );
- fBlock.initialize( getSourceLocator() );
+ fBlock.initialize( getLaunchConfiguration() );
fBlock.createControl( parent );
return fBlock.getControl();
}
@@ -84,19 +80,6 @@ public class SourcePropertyPage extends PropertyPage
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)
* @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();
- if ( target != null )
- {
- ILaunchConfiguration configuration = target.getLaunch().getLaunchConfiguration();
- try
- {
- 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;
+ return ( target != null ) ? target.getLaunch().getLaunchConfiguration() : null;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#dispose()
+ */
+ public void dispose()
+ {
+ if ( fBlock != null )
+ fBlock.dispose();
+ super.dispose();
+ }
+
}

Back to the top