Program: 148828
Project: 148828
Buggy source:
protected void fillContextMenu(IMenuManager manager){
  TreeObject xobject=(TreeObject)((IStructuredSelection)viewer.getSelection()).getFirstElement();
  try {
    XtentisPort port=Util.getPort(xobject);
    if (port == null)     return;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  if (xobject == null) {
    manager.add(loginAction);
  }
 else {
    java.util.List<IAvailableModel> availablemodels=AvailableModelUtil.getAvailableModels();
    for (    IAvailableModel model : availablemodels) {
      model.fillContextMenu(xobject,manager);
    }
switch (xobject.getType()) {
case TreeObject._SERVER_:
      manager.add(loginAction);
    manager.add(logoutAction);
  manager.add(serverRefreshAction);
manager.add(importAction);
manager.add(exportAction);
if (!WorkbenchClipboard.getWorkbenchClipboard().isEmpty()) manager.add(pasteAction);
break;
case TreeObject._ACTION_:
manager.add((Action)xobject.getWsObject());
break;
case TreeObject.SUBSCRIPTION_ENGINE:
manager.add(browseViewAction);
break;
case TreeObject.CUSTOM_TYPE:
case TreeObject.CUSTOM_TYPES_RESOURCE:
break;
case TreeObject.SERVICE_CONFIGURATION:
case TreeObject.RESOURCES:
case TreeObject.DATA_MODEL_RESOURCE:
case TreeObject.DATA_MODEL_TYPES_RESOURCE:
case TreeObject.PICTURES_RESOURCE:
break;
case TreeObject.DATA_CLUSTER:
if (xobject.isXObject()) {
manager.add(browseViewAction);
}
case TreeObject.ROLE:
case TreeObject.VIEW:
default :
if (xobject.getType() != TreeObject.CATEGORY_FOLDER) {
manager.add(exportAction);
manager.add(importAction);
}
if (xobject.getType() == TreeObject.VIEW && xobject.isXObject()) {
manager.add(browseViewAction);
}
int type=LocalTreeObjectRepository.getInstance().receiveUnCertainTreeObjectType(xobject);
if (!LocalTreeObjectRepository.getInstance().isInSystemCatalog(xobject) && xobject.getType() != TreeObject.WORKFLOW_PROCESS && xobject.getType() != TreeObject.JOB && xobject.getType() != TreeObject.WORKFLOW && xobject.getType() != TreeObject.JOB_REGISTRY) {
if (type != TreeObject.ROLE && xobject.getType() != TreeObject.RESOURCES && xobject.getType() != TreeObject.DATA_MODEL_RESOURCE && xobject.getType() != TreeObject.DATA_MODEL_TYPES_RESOURCE && xobject.getType() != TreeObject.CUSTOM_TYPES_RESOURCE && xobject.getType() != TreeObject.PICTURES_RESOURCE && xobject.getType() != TreeObject.EVENT_MANAGEMENT) manager.add(newXObjectAction);
if (!(xobject instanceof TreeParent)) manager.add(renameXObjectAction);
}
if (Util.IsEnterPrise() && Util.hasUniverse(xobject)) manager.add(browseRevisionAction);
if (xobject.getType() != TreeObject.WORKFLOW_PROCESS && xobject.getType() != TreeObject.JOB && xobject.isXObject() && !XSystemObjects.isExist(xobject.getType(),xobject.getDisplayName())) {
manager.add(editXObjectAction);
manager.add(deleteXObjectAction);
manager.add(copyAction);
}
 else if (xobject.getType() != TreeObject.EVENT_MANAGEMENT && LocalTreeObjectRepository.getInstance().isInSystemCatalog(xobject) == false) {
manager.add(newCategoryAction);
}
if (xobject.getType() == TreeObject.CATEGORY_FOLDER && LocalTreeObjectRepository.getInstance().isInSystemCatalog(xobject) == false) {
manager.add(deleteXObjectAction);
}
if (!WorkbenchClipboard.getWorkbenchClipboard().isEmpty()) {
TreeObject remoteObj=(TreeObject)((IStructuredSelection)viewer.getSelection()).getFirstElement();
((PasteXObjectAction)pasteAction).setXtentisPort(remoteObj);
((PasteXObjectAction)pasteAction).setParent(remoteObj instanceof TreeParent ? (TreeParent)remoteObj : remoteObj.getParent());
manager.add(pasteAction);
}
}
}
manager.add(new Separator());
drillDownAdapter.addNavigationActions(manager);
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}

Fixed version (ground truth):
protected void fillContextMenu(IMenuManager manager){
  TreeObject xobject=(TreeObject)((IStructuredSelection)viewer.getSelection()).getFirstElement();
  try {
    XtentisPort port=Util.getPort(xobject);
    if (port == null)     return;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  if (xobject == null) {
    manager.add(loginAction);
  }
 else {
    java.util.List<IAvailableModel> availablemodels=AvailableModelUtil.getAvailableModels();
    for (    IAvailableModel model : availablemodels) {
      model.fillContextMenu(xobject,manager);
    }
switch (xobject.getType()) {
case TreeObject._SERVER_:
      manager.add(loginAction);
    manager.add(logoutAction);
  manager.add(serverRefreshAction);
manager.add(importAction);
manager.add(exportAction);
if (!WorkbenchClipboard.getWorkbenchClipboard().isEmpty()) manager.add(pasteAction);
break;
case TreeObject._ACTION_:
manager.add((Action)xobject.getWsObject());
break;
case TreeObject.SUBSCRIPTION_ENGINE:
manager.add(browseViewAction);
break;
case TreeObject.CUSTOM_TYPE:
case TreeObject.CUSTOM_TYPES_RESOURCE:
break;
case TreeObject.SERVICE_CONFIGURATION:
case TreeObject.RESOURCES:
case TreeObject.DATA_MODEL_RESOURCE:
case TreeObject.DATA_MODEL_TYPES_RESOURCE:
case TreeObject.PICTURES_RESOURCE:
break;
case TreeObject.DATA_CLUSTER:
if (xobject.isXObject()) {
manager.add(browseViewAction);
}
case TreeObject.ROLE:
case TreeObject.VIEW:
default :
if (xobject.getType() != TreeObject.CATEGORY_FOLDER) {
manager.add(exportAction);
manager.add(importAction);
}
if (xobject.getType() == TreeObject.VIEW && xobject.isXObject()) {
manager.add(browseViewAction);
}
int type=LocalTreeObjectRepository.getInstance().receiveUnCertainTreeObjectType(xobject);
if (!LocalTreeObjectRepository.getInstance().isInSystemCatalog(xobject) && xobject.getType() != TreeObject.WORKFLOW_PROCESS && xobject.getType() != TreeObject.JOB && xobject.getType() != TreeObject.WORKFLOW && xobject.getType() != TreeObject.JOB_REGISTRY) {
if (type != TreeObject.ROLE && xobject.getType() != TreeObject.RESOURCES && xobject.getType() != TreeObject.DATA_MODEL_RESOURCE && xobject.getType() != TreeObject.DATA_MODEL_TYPES_RESOURCE && xobject.getType() != TreeObject.CUSTOM_TYPES_RESOURCE && xobject.getType() != TreeObject.PICTURES_RESOURCE && xobject.getType() != TreeObject.EVENT_MANAGEMENT) manager.add(newXObjectAction);
if (!(xobject instanceof TreeParent) && xobject.getType() != TreeObject.DATA_CLUSTER) manager.add(renameXObjectAction);
}
if (Util.IsEnterPrise() && Util.hasUniverse(xobject)) manager.add(browseRevisionAction);
if (xobject.getType() != TreeObject.WORKFLOW_PROCESS && xobject.getType() != TreeObject.JOB && xobject.isXObject() && !XSystemObjects.isExist(xobject.getType(),xobject.getDisplayName())) {
manager.add(editXObjectAction);
manager.add(deleteXObjectAction);
manager.add(copyAction);
}
 else if (xobject.getType() != TreeObject.EVENT_MANAGEMENT && LocalTreeObjectRepository.getInstance().isInSystemCatalog(xobject) == false) {
manager.add(newCategoryAction);
}
if (xobject.getType() == TreeObject.CATEGORY_FOLDER && LocalTreeObjectRepository.getInstance().isInSystemCatalog(xobject) == false) {
manager.add(deleteXObjectAction);
}
if (!WorkbenchClipboard.getWorkbenchClipboard().isEmpty()) {
TreeObject remoteObj=(TreeObject)((IStructuredSelection)viewer.getSelection()).getFirstElement();
((PasteXObjectAction)pasteAction).setXtentisPort(remoteObj);
((PasteXObjectAction)pasteAction).setParent(remoteObj instanceof TreeParent ? (TreeParent)remoteObj : remoteObj.getParent());
manager.add(pasteAction);
}
}
}
manager.add(new Separator());
drillDownAdapter.addNavigationActions(manager);
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}