Program: 92335
Project: 92335
Buggy source:
public TmfEventsTable(final Composite parent,int cacheSize,final ColumnData[] columnData){
  super("String_Node_Str");
  fComposite=new Composite(parent,SWT.NONE);
  final GridLayout gl=new GridLayout(1,false);
  gl.marginHeight=0;
  gl.marginWidth=0;
  gl.verticalSpacing=0;
  fComposite.setLayout(gl);
  fSashForm=new SashForm(fComposite,SWT.HORIZONTAL);
  fSashForm.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
  final int style=SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE| SWT.FULL_SELECTION;
  fTable=new TmfVirtualTable(fSashForm,style);
  final GridData layoutData=new GridData(SWT.FILL,SWT.FILL,true,true);
  fTable.setLayoutData(layoutData);
  fTable.setHeaderVisible(true);
  fTable.setLinesVisible(true);
  setColumnHeaders(columnData);
  if (Arrays.equals(columnData,COLUMN_DATA)) {
    fTable.getColumns()[0].setData(Key.FIELD_ID,ITmfEvent.EVENT_FIELD_TIMESTAMP);
    fTable.getColumns()[1].setData(Key.FIELD_ID,ITmfEvent.EVENT_FIELD_SOURCE);
    fTable.getColumns()[2].setData(Key.FIELD_ID,ITmfEvent.EVENT_FIELD_TYPE);
    fTable.getColumns()[3].setData(Key.FIELD_ID,ITmfEvent.EVENT_FIELD_REFERENCE);
    fTable.getColumns()[4].setData(Key.FIELD_ID,ITmfEvent.EVENT_FIELD_CONTENT);
  }
  fTable.setFrozenRowCount(1);
  createHeaderEditor();
  fTable.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    final SelectionEvent e){
      final TableItem[] selection=fTable.getSelection();
      if (selection.length > 0) {
        final TableItem selectedTableItem=selection[0];
        if (selectedTableItem != null) {
          if (selectedTableItem.getData(Key.RANK) instanceof Long) {
            fSelectedRank=(Long)selectedTableItem.getData(Key.RANK);
            fRawViewer.selectAndReveal((Long)selectedTableItem.getData(Key.RANK));
          }
          if (selectedTableItem.getData(Key.TIMESTAMP) instanceof TmfTimestamp) {
            final TmfTimestamp ts=(TmfTimestamp)selectedTableItem.getData(Key.TIMESTAMP);
            broadcast(new TmfTimeSynchSignal(TmfEventsTable.this,ts));
          }
        }
      }
    }
  }
);
  cacheSize=Math.max(cacheSize,Display.getDefault().getBounds().height / fTable.getItemHeight());
  cacheSize=Math.min(cacheSize,MAX_CACHE_SIZE);
  fCache=new TmfEventsCache(cacheSize,this);
  fTable.addListener(SWT.SetData,new Listener(){
    @Override public void handleEvent(    final Event event){
      final TableItem item=(TableItem)event.item;
      int index=event.index - 1;
      if (event.index == 0) {
        setHeaderRowItemData(item);
        return;
      }
      if (fTable.getData(Key.FILTER_OBJ) != null) {
        if ((event.index == 1) || (event.index == (fTable.getItemCount() - 1))) {
          setFilterStatusRowItemData(item);
          return;
        }
        index=index - 1;
      }
      final CachedEvent cachedEvent=fCache.getEvent(index);
      if (cachedEvent != null) {
        setItemData(item,cachedEvent.event,cachedEvent.rank);
        return;
      }
      event.doit=false;
    }
  }
);
  fTable.addMouseListener(new MouseAdapter(){
    @Override public void mouseDoubleClick(    final MouseEvent event){
      if (event.button != 1) {
        return;
      }
      final Point point=new Point(event.x,event.y);
      final TableItem item=fTable.getItem(point);
      if (item != null) {
        final Rectangle imageBounds=item.getImageBounds(0);
        imageBounds.width=BOOKMARK_IMAGE.getBounds().width;
        if (imageBounds.contains(point)) {
          final Long rank=(Long)item.getData(Key.RANK);
          if (rank != null) {
            toggleBookmark(rank);
          }
        }
      }
    }
  }
);
  final Listener tooltipListener=new Listener(){
    Shell tooltipShell=null;
    @Override public void handleEvent(    final Event event){
switch (event.type) {
case SWT.MouseHover:
        final TableItem item=fTable.getItem(new Point(event.x,event.y));
      if (item == null) {
        return;
      }
    final Long rank=(Long)item.getData(Key.RANK);
  if (rank == null) {
    return;
  }
final String tooltipText=(String)item.getData(Key.BOOKMARK);
final Rectangle bounds=item.getImageBounds(0);
bounds.width=BOOKMARK_IMAGE.getBounds().width;
if (!bounds.contains(event.x,event.y)) {
return;
}
if ((tooltipShell != null) && !tooltipShell.isDisposed()) {
tooltipShell.dispose();
}
tooltipShell=new Shell(fTable.getShell(),SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
tooltipShell.setBackground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
final FillLayout layout=new FillLayout();
layout.marginWidth=2;
tooltipShell.setLayout(layout);
final Label label=new Label(tooltipShell,SWT.WRAP);
String text=rank.toString() + (tooltipText != null ? "String_Node_Str" + tooltipText : "String_Node_Str");
label.setForeground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
label.setBackground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
label.setText(text);
label.addListener(SWT.MouseExit,this);
label.addListener(SWT.MouseDown,this);
label.addListener(SWT.MouseWheel,this);
final Point size=tooltipShell.computeSize(SWT.DEFAULT,SWT.DEFAULT);
Point pt=fTable.toDisplay(event.x,event.y);
pt.x+=BOOKMARK_IMAGE.getBounds().width;
pt.y+=size.y;
tooltipShell.setBounds(pt.x,pt.y,size.x,size.y);
tooltipShell.setVisible(true);
break;
case SWT.Dispose:
case SWT.KeyDown:
case SWT.MouseMove:
case SWT.MouseExit:
case SWT.MouseDown:
case SWT.MouseWheel:
if (tooltipShell != null) {
tooltipShell.dispose();
tooltipShell=null;
}
break;
}
}
}
;
fTable.addListener(SWT.MouseHover,tooltipListener);
fTable.addListener(SWT.Dispose,tooltipListener);
fTable.addListener(SWT.KeyDown,tooltipListener);
fTable.addListener(SWT.MouseMove,tooltipListener);
fTable.addListener(SWT.MouseExit,tooltipListener);
fTable.addListener(SWT.MouseDown,tooltipListener);
fTable.addListener(SWT.MouseWheel,tooltipListener);
createResources();
ColorSettingsManager.addColorSettingsListener(this);
fTable.setItemCount(1);
fRawViewer=new TmfRawEventViewer(fSashForm,SWT.H_SCROLL | SWT.V_SCROLL);
fRawViewer.addSelectionListener(new Listener(){
@Override public void handleEvent(final Event e){
if (e.data instanceof Long) {
final long rank=(Long)e.data;
int index=(int)rank;
if (fTable.getData(Key.FILTER_OBJ) != null) {
index=fCache.getFilteredEventIndex(rank) + 1;
}
fTable.setSelection(index + 1);
fSelectedRank=rank;
}
 else if (e.data instanceof ITmfLocation<?>) {
return;
}
 else {
return;
}
final TableItem[] selection=fTable.getSelection();
if ((selection != null) && (selection.length > 0)) {
final TmfTimestamp ts=(TmfTimestamp)fTable.getSelection()[0].getData(Key.TIMESTAMP);
if (ts != null) {
broadcast(new TmfTimeSynchSignal(TmfEventsTable.this,ts));
}
}
}
}
);
fSashForm.setWeights(new int[]{1,1});
fRawViewer.setVisible(false);
createPopupMenu();
}

Fixed version (ground truth):
public TmfEventsTable(final Composite parent,int cacheSize,final ColumnData[] columnData){
  super("String_Node_Str");
  fComposite=new Composite(parent,SWT.NONE);
  final GridLayout gl=new GridLayout(1,false);
  gl.marginHeight=0;
  gl.marginWidth=0;
  gl.verticalSpacing=0;
  fComposite.setLayout(gl);
  fSashForm=new SashForm(fComposite,SWT.HORIZONTAL);
  fSashForm.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
  final int style=SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE| SWT.FULL_SELECTION;
  fTable=new TmfVirtualTable(fSashForm,style);
  final GridData layoutData=new GridData(SWT.FILL,SWT.FILL,true,true);
  fTable.setLayoutData(layoutData);
  fTable.setHeaderVisible(true);
  fTable.setLinesVisible(true);
  setColumnHeaders(columnData);
  if (Arrays.equals(columnData,COLUMN_DATA)) {
    fTable.getColumns()[0].setData(Key.FIELD_ID,ITmfEvent.EVENT_FIELD_TIMESTAMP);
    fTable.getColumns()[1].setData(Key.FIELD_ID,ITmfEvent.EVENT_FIELD_SOURCE);
    fTable.getColumns()[2].setData(Key.FIELD_ID,ITmfEvent.EVENT_FIELD_TYPE);
    fTable.getColumns()[3].setData(Key.FIELD_ID,ITmfEvent.EVENT_FIELD_REFERENCE);
    fTable.getColumns()[4].setData(Key.FIELD_ID,ITmfEvent.EVENT_FIELD_CONTENT);
  }
  fTable.setFrozenRowCount(1);
  createHeaderEditor();
  fTable.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    final SelectionEvent e){
      final TableItem[] selection=fTable.getSelection();
      if (selection.length > 0) {
        final TableItem selectedTableItem=selection[0];
        if (selectedTableItem != null) {
          if (selectedTableItem.getData(Key.RANK) instanceof Long) {
            fSelectedRank=(Long)selectedTableItem.getData(Key.RANK);
            fRawViewer.selectAndReveal((Long)selectedTableItem.getData(Key.RANK));
          }
          if (selectedTableItem.getData(Key.TIMESTAMP) instanceof TmfTimestamp) {
            final TmfTimestamp ts=(TmfTimestamp)selectedTableItem.getData(Key.TIMESTAMP);
            broadcast(new TmfTimeSynchSignal(TmfEventsTable.this,ts));
          }
        }
      }
    }
  }
);
  cacheSize=Math.max(cacheSize,Display.getDefault().getBounds().height / fTable.getItemHeight());
  cacheSize=Math.min(cacheSize,MAX_CACHE_SIZE);
  fCache=new TmfEventsCache(cacheSize,this);
  fTable.addListener(SWT.SetData,new Listener(){
    @Override public void handleEvent(    final Event event){
      final TableItem item=(TableItem)event.item;
      int index=event.index - 1;
      if (event.index == 0) {
        setHeaderRowItemData(item);
        return;
      }
      if (fTable.getData(Key.FILTER_OBJ) != null) {
        if ((event.index == 1) || (event.index == (fTable.getItemCount() - 1))) {
          setFilterStatusRowItemData(item);
          return;
        }
        index=index - 1;
      }
      final CachedEvent cachedEvent=fCache.getEvent(index);
      if (cachedEvent != null) {
        setItemData(item,cachedEvent.event,cachedEvent.rank);
        return;
      }
      event.doit=false;
    }
  }
);
  fTable.addMouseListener(new MouseAdapter(){
    @Override public void mouseDoubleClick(    final MouseEvent event){
      if (event.button != 1) {
        return;
      }
      final Point point=new Point(event.x,event.y);
      final TableItem item=fTable.getItem(point);
      if (item != null) {
        final Rectangle imageBounds=item.getImageBounds(0);
        imageBounds.width=BOOKMARK_IMAGE.getBounds().width;
        if (imageBounds.contains(point)) {
          final Long rank=(Long)item.getData(Key.RANK);
          if (rank != null) {
            toggleBookmark(rank);
          }
        }
      }
    }
  }
);
  final Listener tooltipListener=new Listener(){
    Shell tooltipShell=null;
    @Override public void handleEvent(    final Event event){
switch (event.type) {
case SWT.MouseHover:
        final TableItem item=fTable.getItem(new Point(event.x,event.y));
      if (item == null) {
        return;
      }
    final Long rank=(Long)item.getData(Key.RANK);
  if (rank == null) {
    return;
  }
final String tooltipText=(String)item.getData(Key.BOOKMARK);
final Rectangle bounds=item.getImageBounds(0);
bounds.width=BOOKMARK_IMAGE.getBounds().width;
if (!bounds.contains(event.x,event.y)) {
return;
}
if ((tooltipShell != null) && !tooltipShell.isDisposed()) {
tooltipShell.dispose();
}
tooltipShell=new Shell(fTable.getShell(),SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
tooltipShell.setBackground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
final FillLayout layout=new FillLayout();
layout.marginWidth=2;
tooltipShell.setLayout(layout);
final Label label=new Label(tooltipShell,SWT.WRAP);
String text=rank.toString() + (tooltipText != null ? "String_Node_Str" + tooltipText : "String_Node_Str");
label.setForeground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
label.setBackground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
label.setText(text);
label.addListener(SWT.MouseExit,this);
label.addListener(SWT.MouseDown,this);
label.addListener(SWT.MouseWheel,this);
final Point size=tooltipShell.computeSize(SWT.DEFAULT,SWT.DEFAULT);
int y=event.y;
if (System.getProperty("String_Node_Str").contains("String_Node_Str")) {
y+=fTable.getHeaderHeight();
}
Point pt=fTable.toDisplay(event.x,y);
pt.x+=BOOKMARK_IMAGE.getBounds().width;
pt.y+=size.y;
tooltipShell.setBounds(pt.x,pt.y,size.x,size.y);
tooltipShell.setVisible(true);
break;
case SWT.Dispose:
case SWT.KeyDown:
case SWT.MouseMove:
case SWT.MouseExit:
case SWT.MouseDown:
case SWT.MouseWheel:
if (tooltipShell != null) {
tooltipShell.dispose();
tooltipShell=null;
}
break;
}
}
}
;
fTable.addListener(SWT.MouseHover,tooltipListener);
fTable.addListener(SWT.Dispose,tooltipListener);
fTable.addListener(SWT.KeyDown,tooltipListener);
fTable.addListener(SWT.MouseMove,tooltipListener);
fTable.addListener(SWT.MouseExit,tooltipListener);
fTable.addListener(SWT.MouseDown,tooltipListener);
fTable.addListener(SWT.MouseWheel,tooltipListener);
createResources();
ColorSettingsManager.addColorSettingsListener(this);
fTable.setItemCount(1);
fRawViewer=new TmfRawEventViewer(fSashForm,SWT.H_SCROLL | SWT.V_SCROLL);
fRawViewer.addSelectionListener(new Listener(){
@Override public void handleEvent(final Event e){
if (e.data instanceof Long) {
final long rank=(Long)e.data;
int index=(int)rank;
if (fTable.getData(Key.FILTER_OBJ) != null) {
index=fCache.getFilteredEventIndex(rank) + 1;
}
fTable.setSelection(index + 1);
fSelectedRank=rank;
}
 else if (e.data instanceof ITmfLocation<?>) {
return;
}
 else {
return;
}
final TableItem[] selection=fTable.getSelection();
if ((selection != null) && (selection.length > 0)) {
final TmfTimestamp ts=(TmfTimestamp)fTable.getSelection()[0].getData(Key.TIMESTAMP);
if (ts != null) {
broadcast(new TmfTimeSynchSignal(TmfEventsTable.this,ts));
}
}
}
}
);
fSashForm.setWeights(new int[]{1,1});
fRawViewer.setVisible(false);
createPopupMenu();
}