public XJMenuItem getItemForTag(int tag) {
   Iterator iterator = items.iterator();
   while (iterator.hasNext()) {
     XJMenuItem menuItem = (XJMenuItem) iterator.next();
     if (menuItem.getTag() == tag) return menuItem;
   }
   return null;
 }
 public void menuItemState(XJMenuItem item) {
   switch (item.getTag()) {
     case XJMainMenuBar.MI_NEW:
       item.setTitle(
           XJLocalizable.getXJString("New")
               + ((XJApplication.shared().getDocumentExtensions().size() > 1) ? "..." : ""));
       break;
     case XJMainMenuBar.MI_UNDO:
     case XJMainMenuBar.MI_REDO:
       getMainMenuBar().menuUndoRedoItemState(undoEngine.getCurrentUndo());
       break;
   }
 }
 public void handleMenuEvent(XJMenu menu, XJMenuItem item) {
   switch (item.getTag()) {
     case XJMainMenuBar.MI_UNDO:
       performUndo();
       break;
     case XJMainMenuBar.MI_REDO:
       performRedo();
       break;
     case XJMainMenuBar.MI_CUT:
       performActionOnFocusedJComponent(DefaultEditorKit.cutAction);
       break;
     case XJMainMenuBar.MI_COPY:
       performActionOnFocusedJComponent(DefaultEditorKit.copyAction);
       break;
     case XJMainMenuBar.MI_PASTE:
       performActionOnFocusedJComponent(DefaultEditorKit.pasteAction);
       break;
     case XJMainMenuBar.MI_SELECT_ALL:
       performActionOnFocusedJComponent(DefaultEditorKit.selectAllAction);
       break;
   }
 }