Program: 57326
Project: 57326
Buggy source:
protected void registerPickingListeners(){
  addTypePickingListener(new APickingListener(){
    @Override public void mouseOver(    Pick pick){
      if (detailLevel == EDetailLevel.VERY_LOW) {
        return;
      }
      handlePathwayElementSelection(SelectionType.MOUSE_OVER,pick.getObjectID());
    }
    @Override public void clicked(    Pick pick){
      if (detailLevel == EDetailLevel.VERY_LOW) {
        return;
      }
      if (glRemoteRenderingView != null && glRemoteRenderingView.getViewType().equals("String_Node_Str"))       return;
      handlePathwayElementSelection(SelectionType.SELECTION,pick.getObjectID());
    }
    @Override public void doubleClicked(    Pick pick){
      if (detailLevel == EDetailLevel.VERY_LOW) {
        return;
      }
      PathwayVertexRep vertexRep=pathwayItemManager.getPathwayVertexRep(pick.getObjectID());
      if (vertexRep.getType() == EPathwayVertexType.map) {
        PathwayGraph pathway=PathwayManager.get().getPathwayByTitle(vertexRep.getName(),EPathwayDatabaseType.KEGG);
        if (pathway != null) {
          LoadPathwayEvent event=new LoadPathwayEvent();
          event.setSender(this);
          event.setPathwayID(pathway.getID());
          event.setEventSpace(dataDomain.getDataDomainID());
          GeneralManager.get().getEventPublisher().triggerEvent(event);
        }
      }
 else {
      }
      handlePathwayElementSelection(SelectionType.SELECTION,pick.getObjectID());
    }
    @Override public void rightClicked(    Pick pick){
      if (detailLevel == EDetailLevel.VERY_LOW) {
        return;
      }
      PathwayVertexRep vertexRep=pathwayItemManager.getPathwayVertexRep(pick.getObjectID());
      if (vertexRep.getType() == EPathwayVertexType.map) {
        LoadPathwaysByPathwayItem menuItem=new LoadPathwaysByPathwayItem(PathwayManager.get().getPathwayByTitle(vertexRep.getName(),EPathwayDatabaseType.KEGG),dataDomain.getDataDomainID());
        contextMenuCreator.addContextMenuItem(menuItem);
      }
 else       if (vertexRep.getType() == EPathwayVertexType.gene) {
        for (        PathwayVertex pathwayVertex : vertexRep.getPathwayVertices()) {
          for (          Integer davidID : pathwayItemManager.getDavidIdByPathwayVertex(pathwayVertex)) {
            GeneMenuItemContainer contexMenuItemContainer=new GeneMenuItemContainer();
            contexMenuItemContainer.setDataDomain(dataDomain);
            contexMenuItemContainer.setData(pathwayDataDomain.getDavidIDType(),davidID);
            contextMenuCreator.addContextMenuItemContainer(contexMenuItemContainer);
          }
        }
        for (        VertexRepBasedContextMenuItem item : addedContextMenuItems) {
          item.setVertexRep(vertexRep);
          contextMenuCreator.addContextMenuItem(item);
        }
      }
    }
  }
,EPickingType.PATHWAY_ELEMENT_SELECTION.name());
  addTypePickingListener(new APickingListener(){
    @Override public void clicked(    Pick pick){
      if (allPaths == null || allPaths.size() <= pick.getObjectID())       return;
      if (allPaths.size() <= selectedPathID)       selectedPathID=0;
      selectedPath=allPaths.get(selectedPathID);
      setDisplayListDirty();
      triggerPathUpdate();
    }
  }
,EPickingType.PATHWAY_PATH_SELECTION.name());
  addTypePickingListener(new APickingListener(){
    @Override public void clicked(    Pick pick){
      handlePathwayTextureSelection(SelectionType.SELECTION);
      int pickX=(int)pick.getPickedPoint().getX();
      int pickY=(int)pick.getPickedPoint().getY();
      float pathwayTextureScaling=1;
      int iImageWidth=pathway.getWidth();
      int iImageHeight=pathway.getHeight();
      if (iImageWidth == -1 || iImageHeight == -1) {
        Logger.log(new Status(IStatus.ERROR,this.toString(),"String_Node_Str"));
      }
      pathwayTextureScaling=pathway.getHeight() / (float)pixelGLConverter.getPixelHeightForGLHeight(viewFrustum.getHeight());
      pickX=(int)((pickX - pixelGLConverter.getPixelWidthForGLWidth(vecTranslation.x())) * pathwayTextureScaling);
      pickY=(int)((pickY - pixelGLConverter.getPixelHeightForGLHeight(vecTranslation.y())) * pathwayTextureScaling);
      int[] pixels=bubbleSet.getBubbleSetGLRenderer().getPxl(pickX,pickX);
      int alpha=(pixels[0] >> 24) & 0xff;
      int red=(pixels[0] >> 16) & 0xff;
      int green=(pixels[0] >> 8) & 0xff;
      int blue=(pixels[0]) & 0xff;
      List<org.caleydo.core.util.color.Color> colorTable=(ColorManager.get()).getColorList("String_Node_Str");
      float[] cComponents=new float[4];
      for (int i=0; i < colorTable.size() - 2; i++) {
        org.caleydo.core.util.color.Color c=colorTable.get(i);
        int threshold=10;
        cComponents=c.getRGB();
        if (red > (int)(cComponents[0] * 255f) - threshold && red < (int)(cComponents[0] * 255f) + threshold) {
          System.out.println("String_Node_Str" + i);
          selectedPathID=i;
          if (selectedPathID > allPaths.size() - 1)           selectedPathID=allPaths.size() - 1;
          selectedPath=allPaths.get(selectedPathID);
          isBubbleTextureDirty=true;
          setDisplayListDirty();
          triggerPathUpdate();
          i=colorTable.size();
        }
      }
    }
  }
,EPickingType.PATHWAY_TEXTURE_SELECTION.name());
}

Fixed version (ground truth):
protected void registerPickingListeners(){
  addTypePickingListener(new APickingListener(){
    @Override public void mouseOver(    Pick pick){
      if (detailLevel == EDetailLevel.VERY_LOW) {
        return;
      }
      handlePathwayElementSelection(SelectionType.MOUSE_OVER,pick.getObjectID());
    }
    @Override public void clicked(    Pick pick){
      if (detailLevel == EDetailLevel.VERY_LOW) {
        return;
      }
      if (glRemoteRenderingView != null && glRemoteRenderingView.getViewType().equals("String_Node_Str"))       return;
      handlePathwayElementSelection(SelectionType.SELECTION,pick.getObjectID());
    }
    @Override public void doubleClicked(    Pick pick){
      if (detailLevel == EDetailLevel.VERY_LOW) {
        return;
      }
      PathwayVertexRep vertexRep=pathwayItemManager.getPathwayVertexRep(pick.getObjectID());
      if (vertexRep.getType() == EPathwayVertexType.map) {
        PathwayGraph pathway=PathwayManager.get().getPathwayByTitle(vertexRep.getName(),EPathwayDatabaseType.KEGG);
        if (pathway != null) {
          LoadPathwayEvent event=new LoadPathwayEvent();
          event.setSender(this);
          event.setPathwayID(pathway.getID());
          event.setEventSpace(dataDomain.getDataDomainID());
          GeneralManager.get().getEventPublisher().triggerEvent(event);
        }
      }
 else {
      }
      handlePathwayElementSelection(SelectionType.SELECTION,pick.getObjectID());
    }
    @Override public void rightClicked(    Pick pick){
      if (detailLevel == EDetailLevel.VERY_LOW) {
        return;
      }
      PathwayVertexRep vertexRep=pathwayItemManager.getPathwayVertexRep(pick.getObjectID());
      if (vertexRep.getType() == EPathwayVertexType.map) {
        LoadPathwaysByPathwayItem menuItem=new LoadPathwaysByPathwayItem(PathwayManager.get().getPathwayByTitle(vertexRep.getName(),EPathwayDatabaseType.KEGG),dataDomain.getDataDomainID());
        contextMenuCreator.addContextMenuItem(menuItem);
      }
 else       if (vertexRep.getType() == EPathwayVertexType.gene) {
        if (!isRenderedRemote()) {
          for (          PathwayVertex pathwayVertex : vertexRep.getPathwayVertices()) {
            for (            Integer davidID : pathwayItemManager.getDavidIdByPathwayVertex(pathwayVertex)) {
              GeneMenuItemContainer contexMenuItemContainer=new GeneMenuItemContainer();
              contexMenuItemContainer.setDataDomain(dataDomain);
              contexMenuItemContainer.setData(pathwayDataDomain.getDavidIDType(),davidID);
              contextMenuCreator.addContextMenuItemContainer(contexMenuItemContainer);
            }
          }
        }
        for (        VertexRepBasedContextMenuItem item : addedContextMenuItems) {
          item.setVertexRep(vertexRep);
          contextMenuCreator.addContextMenuItem(item);
        }
      }
    }
  }
,EPickingType.PATHWAY_ELEMENT_SELECTION.name());
  addTypePickingListener(new APickingListener(){
    @Override public void clicked(    Pick pick){
      if (allPaths == null || allPaths.size() <= pick.getObjectID())       return;
      if (allPaths.size() <= selectedPathID)       selectedPathID=0;
      selectedPath=allPaths.get(selectedPathID);
      setDisplayListDirty();
      triggerPathUpdate();
    }
  }
,EPickingType.PATHWAY_PATH_SELECTION.name());
  addTypePickingListener(new APickingListener(){
    @Override public void clicked(    Pick pick){
      handlePathwayTextureSelection(SelectionType.SELECTION);
      int pickX=(int)pick.getPickedPoint().getX();
      int pickY=(int)pick.getPickedPoint().getY();
      float pathwayTextureScaling=1;
      int iImageWidth=pathway.getWidth();
      int iImageHeight=pathway.getHeight();
      if (iImageWidth == -1 || iImageHeight == -1) {
        Logger.log(new Status(IStatus.ERROR,this.toString(),"String_Node_Str"));
      }
      pathwayTextureScaling=pathway.getHeight() / (float)pixelGLConverter.getPixelHeightForGLHeight(viewFrustum.getHeight());
      pickX=(int)((pickX - pixelGLConverter.getPixelWidthForGLWidth(vecTranslation.x())) * pathwayTextureScaling);
      pickY=(int)((pickY - pixelGLConverter.getPixelHeightForGLHeight(vecTranslation.y())) * pathwayTextureScaling);
      int[] pixels=bubbleSet.getBubbleSetGLRenderer().getPxl(pickX,pickX);
      int alpha=(pixels[0] >> 24) & 0xff;
      int red=(pixels[0] >> 16) & 0xff;
      int green=(pixels[0] >> 8) & 0xff;
      int blue=(pixels[0]) & 0xff;
      List<org.caleydo.core.util.color.Color> colorTable=(ColorManager.get()).getColorList("String_Node_Str");
      float[] cComponents=new float[4];
      for (int i=0; i < colorTable.size() - 2; i++) {
        org.caleydo.core.util.color.Color c=colorTable.get(i);
        int threshold=10;
        cComponents=c.getRGB();
        if (red > (int)(cComponents[0] * 255f) - threshold && red < (int)(cComponents[0] * 255f) + threshold) {
          System.out.println("String_Node_Str" + i);
          selectedPathID=i;
          if (selectedPathID > allPaths.size() - 1)           selectedPathID=allPaths.size() - 1;
          selectedPath=allPaths.get(selectedPathID);
          isBubbleTextureDirty=true;
          setDisplayListDirty();
          triggerPathUpdate();
          i=colorTable.size();
        }
      }
    }
  }
,EPickingType.PATHWAY_TEXTURE_SELECTION.name());
}