Program: 148655
Project: 148655
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 {
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:
break;
case TreeObject.PICTURES_RESOURCE:
manager.add(exportAction);
manager.add(importAction);
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);
}
if (xobject.getType() == TreeObject.JOB_REGISTRY) {
manager.add(new ImportTISJobAction());
manager.add(new RefreshXObjectAction(ServerView.show()));
}
if (xobject.getType() == TreeObject.JOB) {
manager.add(new DeleteJobAction());
manager.add(new GenerateJobDefaultTransformerAction());
manager.add(new GenerateJobDefaultTriggerAction());
}
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);
manager.add(duplicateAction);
}
 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);
}
}
java.util.List<IAvailableModel> availablemodels=AvailableModelUtil.getAvailableModels();
for (IAvailableModel model : availablemodels) {
model.fillContextMenu(xobject,manager);
}
}
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 {
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:
break;
case TreeObject.PICTURES_RESOURCE:
manager.add(exportAction);
manager.add(importAction);
break;
case TreeObject.DATA_CLUSTER:
if (xobject.isXObject()) {
manager.add(browseViewAction);
}
case TreeObject.ROLE:
case TreeObject.VIEW:
default :
if (xobject.getType() != TreeObject.CATEGORY_FOLDER && xobject.getType() != TreeObject.BUILT_IN_CATEGORY_FOLDER) {
manager.add(exportAction);
manager.add(importAction);
}
if (xobject.getType() == TreeObject.VIEW && xobject.isXObject()) {
manager.add(browseViewAction);
}
if (xobject.getType() == TreeObject.JOB_REGISTRY) {
manager.add(new ImportTISJobAction());
manager.add(new RefreshXObjectAction(ServerView.show()));
}
if (xobject.getType() == TreeObject.JOB) {
manager.add(new DeleteJobAction());
manager.add(new GenerateJobDefaultTransformerAction());
manager.add(new GenerateJobDefaultTriggerAction());
}
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.BUILT_IN_CATEGORY_FOLDER && 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);
manager.add(duplicateAction);
}
 else if (xobject.getType() != TreeObject.EVENT_MANAGEMENT && xobject.getType() != TreeObject.BUILT_IN_CATEGORY_FOLDER && 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);
}
}
java.util.List<IAvailableModel> availablemodels=AvailableModelUtil.getAvailableModels();
for (IAvailableModel model : availablemodels) {
model.fillContextMenu(xobject,manager);
}
}
manager.add(new Separator());
drillDownAdapter.addNavigationActions(manager);
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}