diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index d671242c6e0..40b72b4d6a0 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,8 @@ +2003-07-30 Mikhail Khodjaiants + Moved the 'getReferencedProject' method to 'CDebugUtils'. Added the cycle checking. + * CDebugUtils.java + * CSourceLocator.java + 2003-07-28 Mikhail Khodjaiants Minimize the number of the "evaluate expression" requests when changing the value of the floating point types. * CDebugUtils.java diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java index 33aff2c3e82..6fd9253afcc 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java @@ -8,7 +8,9 @@ package org.eclipse.cdt.debug.core; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import org.apache.xml.serialize.Method; import org.apache.xml.serialize.OutputFormat; @@ -405,4 +407,53 @@ public class CDebugUtils } return false; } + + public static List getReferencedProjects( IProject project ) + { + ArrayList list = new ArrayList( 10 ); + if ( project != null && project.exists() && project.isOpen() ) + { + IProject[] refs = new IProject[0]; + try + { + refs = project.getReferencedProjects(); + } + catch( CoreException e ) + { + } + for ( int i = 0; i < refs.length; ++i ) + { + if ( !project.equals( refs[i] ) && refs[i] != null && refs[i].exists() && refs[i].isOpen() ) + { + list.add( refs[i] ); + getReferencedProjects( project, refs[i], list ); + } + } + } + return list; + } + + private static void getReferencedProjects( IProject root, IProject project, List list ) + { + if ( project != null && project.exists() && project.isOpen() ) + { + IProject[] refs = new IProject[0]; + try + { + refs = project.getReferencedProjects(); + } + catch( CoreException e ) + { + } + for ( int i = 0; i < refs.length; ++i ) + { + if ( !list.contains( refs[i] ) && refs[i] != null && + !refs[i].equals( root ) && refs[i].exists() && refs[i].isOpen() ) + { + list.add( refs[i] ); + getReferencedProjects( root, refs[i], list ); + } + } + } + } } 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 d92917ca667..7d30ea04991 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 @@ -562,7 +562,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato IProject project = getProject(); if ( project != null && project.exists() && project.isOpen() ) { - List list = getReferencedProjects( project ); + List list = CDebugUtils.getReferencedProjects( project ); HashSet names = new HashSet( list.size() + 1 ); names.add( project.getName() ); Iterator it = list.iterator(); @@ -639,27 +639,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato private void setReferencedProjects() { fReferencedProjects.clear(); - fReferencedProjects = getReferencedProjects( getProject() ); - } - - private List getReferencedProjects( IProject project ) - { - ArrayList list = new ArrayList( 10 ); - if ( project != null && project.exists() && project.isOpen() ) - { - IProject[] refs = new IProject[0]; - try - { - refs = project.getReferencedProjects(); - } - catch( CoreException e ) - { - } - list.addAll( Arrays.asList( refs ) ); - for ( int i = 0; i < refs.length; ++i ) - list.addAll( getReferencedProjects( refs[i] ) ); - } - return list; + fReferencedProjects = CDebugUtils.getReferencedProjects( getProject() ); } protected ICSourceLocation[] getDefaultSourceLocations() @@ -705,7 +685,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato private void updateGenericSourceLocations( List affectedProjects ) { - List newRefs = getReferencedProjects( getProject() ); + List newRefs = CDebugUtils.getReferencedProjects( getProject() ); ICSourceLocation[] locations = getSourceLocations(); ArrayList newLocations = new ArrayList( locations.length ); for ( int i = 0; i < locations.length; ++i ) diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog index e9412f00c50..6e2e2d5addc 100644 --- a/debug/org.eclipse.cdt.debug.ui/ChangeLog +++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog @@ -1,3 +1,7 @@ +2003-07-30 Mikhail Khodjaiants + Moved the 'getReferencedProject' method to 'CDebugUtils'. Added the cycle checking. + * SourceLookupBlock.java + 2003-07-29 Mikhail Khodjaiants Fix for PR 40911: Double clicking on breakpoint with no source causes internal error. * CDTDebugModelPresentation.java: check if the resource associated with breakpoint is a file. 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 d9985ce38ce..7e6562cbd7e 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 @@ -6,10 +6,10 @@ package org.eclipse.cdt.debug.ui.sourcelookup; import java.util.ArrayList; -import java.util.Arrays; import java.util.Iterator; import java.util.List; +import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation; import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator; import org.eclipse.cdt.debug.core.sourcelookup.IDirectorySourceLocation; @@ -28,7 +28,6 @@ import org.eclipse.cdt.debug.internal.ui.dialogfields.ListDialogField; import org.eclipse.cdt.debug.internal.ui.dialogfields.Separator; import org.eclipse.cdt.debug.internal.ui.wizards.AddSourceLocationWizard; import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Path; import org.eclipse.debug.ui.ILaunchConfigurationDialog; import org.eclipse.jface.resource.JFaceResources; @@ -342,7 +341,7 @@ public class SourceLookupBlock fGeneratedSourceListField.removeAllElements(); if ( project == null && project.exists() && project.isOpen() ) return; - List list = getReferencedProjects( project ); + 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() ); @@ -522,24 +521,4 @@ public class SourceLookupBlock return locations[i]; return null; } - - private List getReferencedProjects( IProject project ) - { - ArrayList list = new ArrayList( 10 ); - if ( project != null && project.exists() && project.isOpen() ) - { - IProject[] refs = new IProject[0]; - try - { - refs = project.getReferencedProjects(); - } - catch( CoreException e ) - { - } - list.addAll( Arrays.asList( refs ) ); - for ( int i = 0; i < refs.length; ++i ) - list.addAll( getReferencedProjects( refs[i] ) ); - } - return list; - } }