IReaction reaction = newContainer.getBuilder().newInstance(IReaction.class);
reaction.setID(newReactionId(controllerhub));
IAtomContainer mol=newContainer.getBuilder().newInstance(IAtomContainer.class,newContainer);
mol.setID(newContainer.getID());
reaction.addReactant(mol);
IReactionSet reactionSet = chemModel.getReactionSet();
if (reactionSet == null)
{
reactionSet = chemModel.getBuilder().newInstance(IReactionSet.class);
}
reactionSet.addReaction(reaction);
chemModel.setReactionSet(reactionSet);
chemModel.getMoleculeSet().removeAtomContainer(oldcontainer);
if(chemModel.getMoleculeSet().getAtomContainerCount()==0)
chemModel.getMoleculeSet().addAtomContainer(chemModel.getBuilder().newInstance(IAtomContainer.class));
if(controllerhub.getUndoRedoFactory()!=null && controllerhub.getUndoRedoHandler()!=null){