for (IAtomContainer container :
ReactionManipulator.getAllAtomContainers(
(IReaction)object)) {
wholeModel.add(container);
}
ShapeSelection container = new RectangleSelection();
for (IAtom atom : wholeModel.atoms()) {
container.atoms.add(atom);
}
for (IBond bond : wholeModel.bonds()) {
container.bonds.add(bond);
}
renderModel.setSelection(container);
}
else {
logger.warn("Cannot select everything in : ", object);
}
} else if (type.equals("selectReactionReactants")) {
IChemObject object = getSource(e);
if (object instanceof IReaction) {
IReaction reaction = (IReaction) object;
IAtomContainer wholeModel =
jcpPanel.getChemModel().getBuilder().newInstance(IAtomContainer.class);
for (IAtomContainer container :
MoleculeSetManipulator.getAllAtomContainers(
reaction.getReactants())) {
wholeModel.add(container);
}
ShapeSelection container = new RectangleSelection();
for (IAtom atom : wholeModel.atoms()) {
container.atoms.add(atom);
}
for (IBond bond : wholeModel.bonds()) {
container.bonds.add(bond);
}
renderModel.setSelection(container);
}
else {
logger.warn("Cannot select reactants from : ", object);
}
} else if (type.equals("selectReactionProducts")) {
IChemObject object = getSource(e);
if (object instanceof IReaction) {
IReaction reaction = (IReaction) object;
IAtomContainer wholeModel =
jcpPanel.getChemModel().getBuilder().newInstance(IAtomContainer.class);
for (IAtomContainer container :
MoleculeSetManipulator.getAllAtomContainers(
reaction.getProducts())) {
wholeModel.add(container);
}
ShapeSelection container = new RectangleSelection();
for (IAtom atom : wholeModel.atoms()) {
container.atoms.add(atom);
}
for (IBond bond : wholeModel.bonds()) {
container.bonds.add(bond);