if(restname.indexOf("/")==restname.length()-1){
entriesMol.put(restname.substring(0,restname.length()-1), new ArrayList<IAtomContainer>());
}else if(restname.indexOf("/")>-1 && withsubdirs){
if(entry.getName().indexOf(".mol")>-1){
InputStream ins = dummy.getClass().getClassLoader().getResourceAsStream(entry.getName());
MDLV2000Reader reader = new MDLV2000Reader(ins, Mode.RELAXED);
IAtomContainer cdkmol = (IAtomContainer)reader.read(DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class));
entriesMol.get(restname.substring(0,restname.indexOf("/"))).add(cdkmol);
entriesMolName.put(cdkmol,entry.getName().substring(0,entry.getName().length()-4));
}else{
Icon icon = new ImageIcon(new URL(url.toString()+entry.getName()));
entriesIcon.put(entry.getName().substring(0,entry.getName().length()-4),icon);
}
}
}
}
}
}catch(IOException ex){
//This is a version we fall back to if no jar available. This should be in Eclipse only.
File file = new File(new File(dummy.getClass().getProtectionDomain().getCodeSource().getLocation().toURI()).getAbsolutePath()+File.separator+TEMPLATES_PACKAGE.replace('/', File.separatorChar));
for (int i=0;i<file.listFiles().length ; i++) {
if(file.listFiles()[i].isDirectory()){
File dir = file.listFiles()[i];
if(!dir.getName().startsWith(".")) {
entriesMol.put(dir.getName(), new ArrayList<IAtomContainer>());
if(withsubdirs){
for(int k=0;k<dir.list().length;k++){
if(dir.listFiles()[k].getName().indexOf(".mol")>-1){
MDLV2000Reader reader = new MDLV2000Reader(new FileInputStream(dir.listFiles()[k]), Mode.RELAXED);
IAtomContainer cdkmol = (IAtomContainer)reader.read(DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class));
entriesMol.get(dir.getName()).add(cdkmol);
entriesMolName.put(cdkmol,dir.listFiles()[k].getName().substring(0,dir.listFiles()[k].getName().length()-4));
}else{
Icon icon = new ImageIcon(dir.listFiles()[k].getAbsolutePath());