counter++;
if(counter==container.getAtomCount())
lastplaced=null;
}
if(chemModelRelay.getUndoRedoFactory()!=null && chemModelRelay.getUndoRedoHandler()!=null){
IUndoRedoable undoredo = chemModelRelay.getUndoRedoFactory().getAddAtomsAndBondsEdit(chemModelRelay.getIChemModel(), ac.getBuilder().newInstance(IAtomContainer.class,ac), null, GT.get("Add Functional Group"), chemModelRelay);
chemModelRelay.getUndoRedoHandler().postEdit(undoredo);
}
chemModelRelay.getController2DModel().setDrawElement(x);
}else if(x!=null && x.length()>0){
if(Character.isLowerCase(x.toCharArray()[0]))
x=Character.toUpperCase(x.charAt(0))+x.substring(1);
IsotopeFactory ifa=XMLIsotopeFactory.getInstance(chemModelRelay.getIChemModel().getBuilder());
IIsotope iso=ifa.getMajorIsotope(x);
if(iso!=null){
if(closestAtom==null){
IAtomContainer addatom=chemModelRelay.getIChemModel().getBuilder().newInstance(IAtomContainer.class);
addatom.addAtom(chemModelRelay.addAtomWithoutUndo(x, worldCoord, false));
if(chemModelRelay.getUndoRedoFactory()!=null && chemModelRelay.getUndoRedoHandler()!=null){
IUndoRedoable undoredo = chemModelRelay.getUndoRedoFactory().getAddAtomsAndBondsEdit(chemModelRelay.getIChemModel(), addatom, null, GT.get("Add Atom"), chemModelRelay);
chemModelRelay.getUndoRedoHandler().postEdit(undoredo);
}
}else{
chemModelRelay.setSymbol(closestAtom, x);
}