// Some context menu items don't need a GUI (e.g. an item for deleting a
// message) and will be run in the current daemon application.
ApplicationDescriptor appDescr = new ApplicationDescriptor(ApplicationDescriptor.currentApplicationDescriptor(),new String[]{});
CustomMessageStore messages = CustomMessageStore.getInstance(GUID);
ReadableListImpl inboxMessages = messages.getInboxMessages();
ApplicationMessageFolder inbox = reg.registerFolder(CustomMessage.INBOX_FOLDER_ID, _folderName, inboxMessages);
// Register as a listener for callback notifications
inbox.addListener(this, ApplicationMessageFolderListener.MESSAGE_DELETED | ApplicationMessageFolderListener.MESSAGE_MARKED_OPENED
| ApplicationMessageFolderListener.MESSAGE_MARKED_UNOPENED, appDescr);
// We've registered two folders, specify root folder name for the [View Folder] screen.
reg.setRootFolderName(_folderName);
// Set up menu items --------------------------------------
ApplicationMenuItem openMenuItem = new OpenContextMenu(0x230010);
ApplicationMenuItem markOpenedMenuItem = new MarkOpenedContextMenu(0x230030);
ApplicationMenuItem markUnreadMenuItem = new MarkUnreadContextMenu(0x230031);
_newGuiMenuItems = new ApplicationMenuItem[] {openMenuItem};
_newDaemonMenuItems = new ApplicationMenuItem[] {markOpenedMenuItem};
_openedGuiMenuItems = new ApplicationMenuItem[] {openMenuItem};
_markedUnreadMenuItems = new ApplicationMenuItem[] {markUnreadMenuItem};
//Register Default type
registerType(CustomMessage.DEFAULT_IMAGE_TYPE, "", "");
//Register persisted types
ToIntHashtable customTypeTable = inboxMessages.getCustomTypeTable();
if(!customTypeTable.isEmpty()){
for(Enumeration e =customTypeTable.keys();e.hasMoreElements();){
String JSON = (String) e.nextElement();
int commaIndex = JSON.indexOf(',');
String newImage = JSON.substring(12, commaIndex);