if (spreadSheet instanceof CommonSpreadSheet && spreadSheet.getSpreadSheetCategory() != null){
CommonSpreadSheet sp=(CommonSpreadSheet)spreadSheet;
if (sp.isCanSelectFieldArray()) {
//need to build menu each time because it can change
if (spreadSheet instanceof TimeSpreadSheet){
TimeSpreadSheetColumnsPopupMenu columnsPopup = new TimeSpreadSheetColumnsPopupMenu((TimeSpreadSheet)sp,sp.getSpreadSheetCategory());
columnsPopup.show(sp,e.getX(),e.getY());
}else{
SpreadSheetColumnsPopupMenu columnsPopup = new SpreadSheetColumnsPopupMenu(sp,sp.getSpreadSheetCategory());
columnsPopup.show(sp,e.getX(),e.getY());
}
}
}
}else{
SpreadSheetSelectionModel selection=spreadSheet.getSelection();