Program: 149021
Project: 149021
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 {
switch (xobject.getType()) {
case TreeObject._SERVER_:
      manager.add(loginAction);
    manager.add(logoutAction);
  manager.add(serverRefreshAction);
manager.add(importAction);
manager.add(exportAction);
manager.add(versionUniverseAction);
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.WORKFLOW:
manager.add(workflowAction);
break;
case TreeObject.WORKFLOW_PROCESS:
manager.add(deleteWorkflowProcessAction);
manager.add(defaultworkflowTransformeraction);
break;
case TreeObject.JOB:
manager.add(deleteJobAction);
manager.add(defaultjobtransformeraction);
break;
case TreeObject.JOB_REGISTRY:
manager.add(importjobaction);
break;
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) {
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 (Util.hasTags(xobject)) manager.add(versionAction);
if (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 {
switch (xobject.getType()) {
case TreeObject._SERVER_:
      manager.add(loginAction);
    manager.add(logoutAction);
  manager.add(serverRefreshAction);
manager.add(importAction);
manager.add(exportAction);
manager.add(versionUniverseAction);
if (!WorkbenchClipboard.getWorkbenchClipboard().isEmpty()) manager.add(pasteAction);
break;
case TreeObject.WORKFLOW:
manager.add(workflowAction);
break;
case TreeObject.WORKFLOW_PROCESS:
manager.add(deleteWorkflowProcessAction);
manager.add(defaultworkflowTransformeraction);
break;
case TreeObject.JOB:
manager.add(deleteJobAction);
manager.add(defaultjobtransformeraction);
break;
case TreeObject.JOB_REGISTRY:
manager.add(importjobaction);
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) {
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 (Util.hasTags(xobject)) manager.add(versionAction);
if (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));
}