}
String s = event.getActionCommand();
String symbol = s.substring(s.indexOf("@") + 1);
if(symbol.equals("periodictable")){
if(jcpPanel.get2DHub().getActiveDrawModule() instanceof AddBondDragModule)
newActiveModule=new AddAtomModule(jcpPanel.get2DHub(), ((AddBondDragModule)jcpPanel.get2DHub().getActiveDrawModule()).getStereoForNewBond());
else if(jcpPanel.get2DHub().getActiveDrawModule() instanceof AddAtomModule)
newActiveModule=new AddAtomModule(jcpPanel.get2DHub(), ((AddAtomModule)jcpPanel.get2DHub().getActiveDrawModule()).getStereoForNewBond());
else
newActiveModule=new AddAtomModule(jcpPanel.get2DHub(), IBond.Stereo.NONE);
newActiveModule.setID(symbol);
jcpPanel.get2DHub().setActiveDrawModule(newActiveModule);
// open PeriodicTable panel
PeriodicTableDialog dialog = new PeriodicTableDialog();
dialog.setName("periodictabledialog");
symbol=dialog.getChoosenSymbol();
if(symbol.equals(""))
return;
jcpPanel.get2DHub().getController2DModel().setDrawElement(symbol);
jcpPanel.get2DHub().getController2DModel().setDrawIsotopeNumber(0);
jcpPanel.get2DHub().getController2DModel().setDrawPseudoAtom(false);
}else if(symbol.equals("enterelement")){
newActiveModule=new EnterElementSwingModule(jcpPanel.get2DHub());
newActiveModule.setID(symbol);
jcpPanel.get2DHub().setActiveDrawModule(newActiveModule);
if(atomsInRange!=null){
String[] funcGroupsKeys=new String[0];
symbol=EnterElementOrGroupDialog.showDialog(null,null, GT.get("Enter an element symbol:"), GT.get("Enter element"), funcGroupsKeys, "","");
if(symbol!=null && symbol.length()>0){
if(Character.isLowerCase(symbol.toCharArray()[0]))
symbol=Character.toUpperCase(symbol.charAt(0))+symbol.substring(1);
IsotopeFactory ifa;
try {
ifa = XMLIsotopeFactory.getInstance(jcpPanel.getChemModel().getBuilder());
IIsotope iso=ifa.getMajorIsotope(symbol);
if(iso==null){
JOptionPane.showMessageDialog(jcpPanel, GT.get("No valid element symbol entered"), GT.get("Invalid symbol"), JOptionPane.WARNING_MESSAGE);
return;
}
} catch (IOException e) {
e.printStackTrace();
return;
}
}
}
}else{
//it must be a symbol
if(jcpPanel.get2DHub().getActiveDrawModule() instanceof AddBondDragModule)
newActiveModule=new AddAtomModule(jcpPanel.get2DHub(), ((AddBondDragModule)jcpPanel.get2DHub().getActiveDrawModule()).getStereoForNewBond());
else if(jcpPanel.get2DHub().getActiveDrawModule() instanceof AddAtomModule)
newActiveModule=new AddAtomModule(jcpPanel.get2DHub(), ((AddAtomModule)jcpPanel.get2DHub().getActiveDrawModule()).getStereoForNewBond());
else
newActiveModule=new AddAtomModule(jcpPanel.get2DHub(), IBond.Stereo.NONE);
jcpPanel.get2DHub().getController2DModel().setDrawPseudoAtom(false);
newActiveModule.setID(symbol);
jcpPanel.get2DHub().getController2DModel().setDrawElement(symbol);
jcpPanel.get2DHub().getController2DModel().setDrawIsotopeNumber(0);