if ( !config.isPde() )
{
List duplicates = new ArrayList();
for ( int j = 0; j < dependencies.length; j++ )
{
IdeDependency dep = dependencies[j];
// Avoid duplicates entries when same project is refered using multiple types
// (ejb, test-jar ...)
if ( dep.isReferencedProject() && !duplicates.contains( dep.getEclipseProjectName() ) )
{
writer.startElement( "project" ); //$NON-NLS-1$
writer.writeText( dep.getEclipseProjectName() );
writer.endElement();
duplicates.add( dep.getEclipseProjectName() );
}
}
}
writer.endElement(); // projects
writer.startElement( ELT_BUILD_SPEC );
for ( Iterator it = buildCommands.iterator(); it.hasNext(); )
{
( (BuildCommand) it.next() ).print( writer );
}
writer.endElement(); // buildSpec
writer.startElement( ELT_NATURES );
for ( Iterator it = projectnatures.iterator(); it.hasNext(); )
{
writer.startElement( ELT_NATURE );
writer.writeText( (String) it.next() );
writer.endElement(); // name
}
writer.endElement(); // natures
boolean addLinks = !config.getProjectBaseDir().equals( config.getEclipseProjectDirectory() );
if ( addLinks || ( config.isPde() && dependencies.length > 0 ) || linkedResources.size() > 0 )
{
writer.startElement( "linkedResources" ); //$NON-NLS-1$
// preserve the symbolic links
if ( linkedResources.size() > 0 )
{
for ( Iterator it = linkedResources.iterator(); it.hasNext(); )
{
( (LinkedResource) it.next() ).print( writer );
}
}
if ( addLinks )
{
addFileLink( writer, config.getProjectBaseDir(), config.getEclipseProjectDirectory(),
config.getProject().getFile() );
addSourceLinks( writer, config.getProjectBaseDir(), config.getEclipseProjectDirectory(),
config.getProject().getCompileSourceRoots() );
addResourceLinks( writer, config.getProjectBaseDir(), config.getEclipseProjectDirectory(),
config.getProject().getBuild().getResources() );
addSourceLinks( writer, config.getProjectBaseDir(), config.getEclipseProjectDirectory(),
config.getProject().getTestCompileSourceRoots() );
addResourceLinks( writer, config.getProjectBaseDir(), config.getEclipseProjectDirectory(),
config.getProject().getBuild().getTestResources() );
}
if ( config.isPde() )
{
for ( int j = 0; j < dependencies.length; j++ )
{
IdeDependency dep = dependencies[j];
if ( dep.isAddedToClasspath() && !dep.isProvided() && !dep.isReferencedProject()
&& !dep.isTestDependency() && !dep.isOsgiBundle() )
{
String name = dep.getFile().getName();
addLink( writer, name, IdeUtils.fixSeparator( IdeUtils.getCanonicalPath( dep.getFile() ) ),
LINK_TYPE_FILE );
}
}
}