* multiple instances at same location.
* @throws CoreException on core failure.
*/
private void addArchives(TapestryLibrary newLib) throws InvalidArchiveFilesCreationException, CoreException {
TapestryLibraryArchiveFilesDelegate jarCol = null;
ArchiveFile jar = null;
jarCol = (TapestryLibraryArchiveFilesDelegate)config_element.createExecutableExtension(DELEGATE);
if (jarCol != null){
jarCol.setConfigurationElement(config_element);
Collection jars = jarCol.getArchiveFiles();
if (jars == null)//TODO: better validation and error handling
return;
Iterator it = jars.iterator();
while (it.hasNext()){
Object aJar = it.next();
if (aJar instanceof ArchiveFile){//for now check to see ArchiveFiles were being returned
jar = (ArchiveFile)aJar;
if (!newLib.containsArchiveFile(jar.getSourceLocation()))
newLib.getArchiveFiles().add(jar);
}
else {
throw new InvalidArchiveFilesCreationException(
NLS.bind(
Messages.PluginProvidedTapestryLibraryCreationHelper_ErrorMultipleDefinition,
jar.getSourceLocation(),
config_element.getName()));
}
}
}