String s = event.getActionCommand();
String type = s.substring(s.indexOf("@") + 1);
//first switch mode
AddBondDragModule newActiveModule = new AddBondDragModule(jcpPanel.get2DHub(),IBond.Stereo.NONE, true);;
if(type.equals("down_bond")){
newActiveModule = new AddBondDragModule(jcpPanel.get2DHub(),IBond.Stereo.DOWN, true);
}else if(type.equals("up_bond")){
newActiveModule = new AddBondDragModule(jcpPanel.get2DHub(),IBond.Stereo.UP, true);
}else if(type.equals("undefined_bond")){
newActiveModule = new AddBondDragModule(jcpPanel.get2DHub(),IBond.Stereo.UP_OR_DOWN, true);
}else if(type.equals("undefined_stereo_bond")){
newActiveModule = new AddBondDragModule(jcpPanel.get2DHub(),IBond.Stereo.E_OR_Z, true);
}else if(type.equals("bondTool")){
newActiveModule = new AddBondDragModule(jcpPanel.get2DHub(),IBond.Stereo.NONE, true);
}else if(type.equals("double_bondTool")){
newActiveModule = new AddBondDragModule(jcpPanel.get2DHub(),IBond.Order.DOUBLE, true);
}else if(type.equals("triple_bondTool")){
newActiveModule = new AddBondDragModule(jcpPanel.get2DHub(),IBond.Order.TRIPLE, true);
}
if (newActiveModule != null) { // null means that menu was used => don't change module
newActiveModule.setID(type);
jcpPanel.get2DHub().setActiveDrawModule(newActiveModule);
}
// xxxTool -> xxx
int l = type.length();