selectionModel.clearSelection();
Set rootsFromOtherProjects = new HashSet ();
Set rootsFromRelatedSourceRoots = new HashSet();
out: for( int i = 0; i < files.length; i++ ) {
File normalizedFile = FileUtil.normalizeFile(files[i]);
Project p;
if (ownedFolders.contains(normalizedFile)) {
Vector dataVector = rootsModel.getDataVector();
for (int j=0; j<dataVector.size();j++) {
//Sequential search in this minor case is faster than update of positions during each modification
File f = (File )((Vector)dataVector.elementAt(j)).elementAt(0);
if (f.equals(normalizedFile)) {
selectionModel.addSelectionInterval(j,j);
}
}
}
else if (this.relatedEditMediator != null && this.relatedEditMediator.ownedFolders.contains(normalizedFile)) {
rootsFromRelatedSourceRoots.add (normalizedFile);
continue;
}
if ((p=FileOwnerQuery.getOwner(normalizedFile.toURI()))!=null && !p.getProjectDirectory().equals(project.getProjectDirectory())) {
final Sources sources = (Sources) p.getLookup().lookup (Sources.class);
if (sources == null) {
rootsFromOtherProjects.add (normalizedFile);
continue;
}
final SourceGroup[] sourceGroups = sources.getSourceGroups(Sources.TYPE_GENERIC);
final SourceGroup[] javaGroups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
final SourceGroup[] groups = new SourceGroup [sourceGroups.length + javaGroups.length];
System.arraycopy(sourceGroups,0,groups,0,sourceGroups.length);
System.arraycopy(javaGroups,0,groups,sourceGroups.length,javaGroups.length);
final FileObject projectDirectory = p.getProjectDirectory();
final FileObject fileObject = FileUtil.toFileObject(normalizedFile);
if (projectDirectory == null || fileObject == null) {
rootsFromOtherProjects.add (normalizedFile);
continue;
}