IChemObjectSelection sel = null;
if (shiftPressed && curSel != null && curSel.isFilled()) {
IAtomContainer container = new AtomContainer(curSel.getConnectedAtomContainer());
if (singleSelection instanceof IAtom) {
IAtom atom = (IAtom) singleSelection;
if (!container.contains(atom)) container.addAtom(atom);
else container.removeAtom(atom);
} else if (singleSelection instanceof IBond) {
IBond bond = (IBond) singleSelection;
if (!container.contains(bond)) container.addBond(bond);
else container.addBond(bond);