Program: 148977
Project: 148977
Buggy source:
protected void fillContextMenu(IMenuManager manager){
  TreeObject xobject=(TreeObject)((IStructuredSelection)viewer.getSelection()).getFirstElement();
  boolean hasVersioning=false;
  try {
    XtentisPort port=Util.getPort(xobject);
    if (port == null)     return;
    WSVersioningInfo info=port.versioningGetInfo(new WSVersioningGetInfo(null));
    hasVersioning=info.isEnabled();
  }
 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:
manager.add(uploadCustomTypeAction);
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);
}
int type=LocalTreeObjectRepository.getInstance().receiveUnCertainTreeObjectType(xobject);
if (!LocalTreeObjectRepository.getInstance().isInSystemCatalog(xobject) && type != TreeObject.ROLE && xobject.getType() != TreeObject.WORKFLOW_PROCESS && xobject.getType() != TreeObject.JOB && xobject.getType() != TreeObject.WORKFLOW && xobject.getType() != TreeObject.JOB_REGISTRY) {
if (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) manager.add(newXObjectAction);
}
 else if (type == TreeObject.ROLE && (xobject.getType() == TreeObject.CATEGORY_FOLDER || xobject instanceof TreeParent)) {
manager.add(newUserActon);
}
if (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 (LocalTreeObjectRepository.getInstance().isInSystemCatalog(xobject) == false) {
manager.add(newCategoryAction);
}
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();
  boolean hasVersioning=false;
  try {
    XtentisPort port=Util.getPort(xobject);
    if (port == null)     return;
    WSVersioningInfo info=port.versioningGetInfo(new WSVersioningGetInfo(null));
    hasVersioning=info.isEnabled();
  }
 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:
manager.add(uploadCustomTypeAction);
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) {
manager.add(browseViewAction);
}
int type=LocalTreeObjectRepository.getInstance().receiveUnCertainTreeObjectType(xobject);
if (!LocalTreeObjectRepository.getInstance().isInSystemCatalog(xobject) && type != TreeObject.ROLE && xobject.getType() != TreeObject.WORKFLOW_PROCESS && xobject.getType() != TreeObject.JOB && xobject.getType() != TreeObject.WORKFLOW && xobject.getType() != TreeObject.JOB_REGISTRY) {
if (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) manager.add(newXObjectAction);
}
 else if (type == TreeObject.ROLE && (xobject.getType() == TreeObject.CATEGORY_FOLDER || xobject instanceof TreeParent)) {
manager.add(newUserActon);
}
if (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 (LocalTreeObjectRepository.getInstance().isInSystemCatalog(xobject) == false) {
manager.add(newCategoryAction);
}
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));
}