Program: 77900
Project: 77900
Buggy source:
protected void selectElement(final Object element,final boolean edit){
  Display.getCurrent().asyncExec(new Runnable(){
    public void run(){
      if (element instanceof ReportItemHandle) {
        IWorkbenchPart part=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().getActivePart();
        if (part instanceof AbstractMultiPageEditor) {
          IEditorPart epart=((AbstractMultiPageEditor)part).getActivePageInstance();
          if (epart instanceof GraphicalEditorWithFlyoutPalette) {
            GraphicalViewer viewer=((GraphicalEditorWithFlyoutPalette)epart).getGraphicalViewer();
            Object cpart=viewer.getEditPartRegistry().get(element);
            if (cpart instanceof EditPart) {
              viewer.flush();
              viewer.select((EditPart)cpart);
            }
            if (edit && cpart instanceof LabelEditPart) {
              ((LabelEditPart)cpart).performDirectEdit();
            }
          }
        }
 else         if (part instanceof IReportEditor) {
          IEditorPart activeEditor=((IReportEditor)part).getEditorPart();
          if (activeEditor instanceof AbstractMultiPageEditor) {
            IEditorPart epart=((AbstractMultiPageEditor)activeEditor).getActivePageInstance();
            if (epart instanceof GraphicalEditorWithFlyoutPalette) {
              GraphicalViewer viewer=((GraphicalEditorWithFlyoutPalette)epart).getGraphicalViewer();
              Object cpart=viewer.getEditPartRegistry().get(element);
              if (cpart instanceof EditPart) {
                viewer.flush();
                viewer.select((EditPart)cpart);
              }
              if (edit && cpart instanceof LabelEditPart) {
                ((LabelEditPart)cpart).performDirectEdit();
              }
 else               if (edit && cpart instanceof ImageEditPart) {
                ((ImageEditPart)cpart).performDirectEdit();
              }
            }
          }
        }
      }
    }
  }
);
}

Fixed version (ground truth):
protected void selectElement(final Object element,final boolean edit){
  Display.getCurrent().asyncExec(new Runnable(){
    public void run(){
      if (element instanceof ReportItemHandle) {
        IWorkbenchPart part=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().getActivePart();
        if (part instanceof AbstractMultiPageEditor) {
          IEditorPart epart=((AbstractMultiPageEditor)part).getActivePageInstance();
          if (epart instanceof GraphicalEditorWithFlyoutPalette) {
            GraphicalViewer viewer=((GraphicalEditorWithFlyoutPalette)epart).getGraphicalViewer();
            Object cpart=viewer.getEditPartRegistry().get(element);
            if (cpart instanceof EditPart) {
              viewer.flush();
              viewer.select((EditPart)cpart);
            }
            if (edit && cpart instanceof LabelEditPart) {
              ((LabelEditPart)cpart).performDirectEdit();
            }
          }
        }
 else         if (part instanceof IReportEditor) {
          IEditorPart activeEditor=((IReportEditor)part).getEditorPart();
          if (activeEditor instanceof AbstractMultiPageEditor) {
            IEditorPart epart=((AbstractMultiPageEditor)activeEditor).getActivePageInstance();
            if (epart instanceof GraphicalEditorWithFlyoutPalette) {
              GraphicalViewer viewer=((GraphicalEditorWithFlyoutPalette)epart).getGraphicalViewer();
              Object cpart=viewer.getEditPartRegistry().get(element);
              if (cpart instanceof EditPart) {
                viewer.flush();
                viewer.select((EditPart)cpart);
              }
              if (edit && cpart instanceof LabelEditPart) {
                ((LabelEditPart)cpart).performDirectEdit();
              }
 else               if (edit && cpart instanceof ImageEditPart) {
                ((ImageEditPart)cpart).performDirectEdit();
              }
 else               if (edit && cpart instanceof ExtendedEditPart) {
                ((ExtendedEditPart)cpart).performDirectEdit();
              }
            }
          }
        }
      }
    }
  }
);
}