Program: 95047
Project: 95047
Buggy source:
/** 
 * Called when time to fill the context menu. First allows super class to fill menu, then adds on test action that simply sends shared object message to given buddy. Subclasses may override as appropriate to fill in context menu. Note that super.fillContextMenu(manager) should always be called first to allow the superclass to fill in the context menu.
 * @param manager the IMenuManager
 */
protected void fillContextMenu(IMenuManager manager){
  final RosterObject rosterObject=getSelectedTreeObject();
  final ID targetID=rosterObject.getID();
  if (rosterObject != null) {
    if (rosterObject instanceof RosterBuddy) {
      final RosterBuddy tb=(RosterBuddy)rosterObject;
      selectedChatAction=new Action(){
        public void run(){
          openChatWindowForTarget(targetID);
        }
      }
;
      selectedChatAction.setText("String_Node_Str" + rosterObject.getID().getName());
      selectedChatAction.setImageDescriptor(ImageDescriptor.createFromImage(Activator.getDefault().getImageRegistry().get(Constants.DECORATION_MESSAGE)));
      manager.add(selectedChatAction);
      RosterObject parent=rosterObject.getParent();
      RosterGroup tg=null;
      if (parent != null && parent instanceof RosterGroup) {
        tg=(RosterGroup)parent;
      }
      final RosterGroup rosterGroup=tg;
      Action removeUserAction=new Action(){
        public void run(){
          removeUserFromGroup(tb,rosterGroup);
        }
      }
;
      if (rosterGroup != null) {
        removeUserAction.setText("String_Node_Str" + rosterObject.getName() + "String_Node_Str"+ rosterGroup.getName()+ "String_Node_Str");
      }
 else {
        removeUserAction.setText("String_Node_Str" + rosterObject.getName());
      }
      removeUserAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
      manager.add(removeUserAction);
    }
 else     if (rosterObject instanceof RosterAccount) {
      final RosterAccount rosterAccount=(RosterAccount)rosterObject;
      final ID accountID=rosterAccount.getID();
      final RosterUserAccount ua=getAccount(accountID);
      if (ua != null) {
        Action addBuddyToGroupAction=new Action(){
          public void run(){
            sendRosterAdd(accountID,null);
          }
        }
;
        addBuddyToGroupAction.setImageDescriptor(ImageDescriptor.createFromImage(Activator.getDefault().getImageRegistry().get(Constants.DECORATION_ADD_BUDDY)));
        addBuddyToGroupAction.setText("String_Node_Str");
        addBuddyToGroupAction.setEnabled(true);
        manager.add(addBuddyToGroupAction);
        openChatRoomAccountAction=new Action(){
          public void run(){
            showChatRoomsForAccount(ua);
          }
        }
;
        openChatRoomAccountAction.setText("String_Node_Str");
        openChatRoomAccountAction.setEnabled(true);
        openChatRoomAccountAction.setImageDescriptor(ImageDescriptor.createFromImage(Activator.getDefault().getImageRegistry().get(Constants.DECORATION_ADD_CHAT)));
        manager.add(openChatRoomAccountAction);
        Action changePasswordAction=new Action(){
          public void run(){
            changePasswordForAccount(accountID);
          }
        }
;
        changePasswordAction.setText("String_Node_Str");
        changePasswordAction.setToolTipText("String_Node_Str");
        changePasswordAction.setEnabled(true);
        manager.add(changePasswordAction);
        disconnectAccountAction=new Action(){
          public void run(){
            if (MessageDialog.openConfirm(RosterView.this.getViewSite().getShell(),"String_Node_Str","String_Node_Str")) {
              disconnectAccount(ua);
            }
          }
        }
;
        disconnectAccountAction.setText("String_Node_Str");
        disconnectAccountAction.setEnabled(true);
        disconnectAccountAction.setImageDescriptor(ImageDescriptor.createFromImage(Activator.getDefault().getImageRegistry().get(Constants.DECORATION_DISCONNECT_ENABLED)));
        manager.add(disconnectAccountAction);
      }
    }
 else     if (rosterObject instanceof RosterGroup) {
      final RosterGroup rosterGroup=(RosterGroup)rosterObject;
      final String groupName=rosterGroup.getName();
      Action removeGroupAction=new Action(){
        public void run(){
          removeGroup(groupName);
        }
      }
;
      String accountName=rosterGroup.getID().getName();
      removeGroupAction.setText("String_Node_Str" + rosterObject.getName() + "String_Node_Str"+ accountName);
      removeGroupAction.setEnabled(rosterGroup.getTotalCount() == 0);
      removeGroupAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
      if (removeGroupAction.isEnabled())       manager.add(removeGroupAction);
    }
  }
  manager.add(new Separator());
  manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}

Fixed version (ground truth):
/** 
 * Called when time to fill the context menu. First allows super class to fill menu, then adds on test action that simply sends shared object message to given buddy. Subclasses may override as appropriate to fill in context menu. Note that super.fillContextMenu(manager) should always be called first to allow the superclass to fill in the context menu.
 * @param manager the IMenuManager
 */
protected void fillContextMenu(IMenuManager manager){
  final RosterObject rosterObject=getSelectedTreeObject();
  final ID targetID=rosterObject.getID();
  if (rosterObject != null) {
    if (rosterObject instanceof RosterBuddy) {
      final RosterBuddy tb=(RosterBuddy)rosterObject;
      selectedChatAction=new Action(){
        public void run(){
          openChatWindowForTarget(targetID);
        }
      }
;
      selectedChatAction.setText("String_Node_Str" + rosterObject.getID().getName());
      selectedChatAction.setImageDescriptor(ImageDescriptor.createFromImage(Activator.getDefault().getImageRegistry().get(Constants.DECORATION_MESSAGE)));
      manager.add(selectedChatAction);
      RosterObject parent=rosterObject.getParent();
      RosterGroup tg=null;
      if (parent != null && parent instanceof RosterGroup) {
        tg=(RosterGroup)parent;
      }
      final RosterGroup rosterGroup=tg;
      Action removeUserAction=new Action(){
        public void run(){
          removeUserFromGroup(tb,rosterGroup);
        }
      }
;
      if (rosterGroup != null) {
        removeUserAction.setText("String_Node_Str" + rosterObject.getName() + "String_Node_Str"+ rosterGroup.getName()+ "String_Node_Str");
      }
 else {
        removeUserAction.setText("String_Node_Str" + rosterObject.getName());
      }
      removeUserAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
      manager.add(removeUserAction);
    }
 else     if (rosterObject instanceof RosterAccount) {
      final RosterAccount rosterAccount=(RosterAccount)rosterObject;
      final ID accountID=rosterAccount.getID();
      final RosterUserAccount ua=getAccount(accountID);
      if (ua != null) {
        Action addBuddyToGroupAction=new Action(){
          public void run(){
            sendRosterAdd(accountID,null);
          }
        }
;
        addBuddyToGroupAction.setImageDescriptor(ImageDescriptor.createFromImage(Activator.getDefault().getImageRegistry().get(Constants.DECORATION_ADD_BUDDY)));
        addBuddyToGroupAction.setText("String_Node_Str");
        addBuddyToGroupAction.setEnabled(true);
        manager.add(addBuddyToGroupAction);
        openChatRoomAccountAction=new Action(){
          public void run(){
            showChatRoomsForAccount(ua);
          }
        }
;
        openChatRoomAccountAction.setText("String_Node_Str");
        openChatRoomAccountAction.setEnabled(true);
        openChatRoomAccountAction.setImageDescriptor(ImageDescriptor.createFromImage(Activator.getDefault().getImageRegistry().get(Constants.DECORATION_ADD_CHAT)));
        manager.add(openChatRoomAccountAction);
        Action changePasswordAction=new Action(){
          public void run(){
            changePasswordForAccount(accountID);
          }
        }
;
        changePasswordAction.setText("String_Node_Str");
        changePasswordAction.setToolTipText("String_Node_Str");
        changePasswordAction.setEnabled(true);
        manager.add(changePasswordAction);
        disconnectAccountAction=new Action(){
          public void run(){
            if (MessageDialog.openConfirm(RosterView.this.getViewSite().getShell(),"String_Node_Str","String_Node_Str")) {
              ua.getInputHandler().disconnect();
            }
          }
        }
;
        disconnectAccountAction.setText("String_Node_Str");
        disconnectAccountAction.setEnabled(true);
        disconnectAccountAction.setImageDescriptor(ImageDescriptor.createFromImage(Activator.getDefault().getImageRegistry().get(Constants.DECORATION_DISCONNECT_ENABLED)));
        manager.add(disconnectAccountAction);
      }
    }
 else     if (rosterObject instanceof RosterGroup) {
      final RosterGroup rosterGroup=(RosterGroup)rosterObject;
      final String groupName=rosterGroup.getName();
      Action removeGroupAction=new Action(){
        public void run(){
          removeGroup(groupName);
        }
      }
;
      String accountName=rosterGroup.getID().getName();
      removeGroupAction.setText("String_Node_Str" + rosterObject.getName() + "String_Node_Str"+ accountName);
      removeGroupAction.setEnabled(rosterGroup.getTotalCount() == 0);
      removeGroupAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
      if (removeGroupAction.isEnabled())       manager.add(removeGroupAction);
    }
  }
  manager.add(new Separator());
  manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}