mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-12 10:45:37 +02:00
Moved the 'getReferencedProject' method to 'CDebugUtils'.
Added the cycle checking.
This commit is contained in:
parent
5aae8a1f5d
commit
022ba9b789
5 changed files with 65 additions and 46 deletions
|
@ -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
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue