Program: 142899
Project: 142899
Buggy source:
private void initEvents(){
  ProjectController pc=Lookup.getDefault().lookup(ProjectController.class);
  final GraphController gc=Lookup.getDefault().lookup(GraphController.class);
  pc.addWorkspaceListener(new WorkspaceListener(){
    public void initialize(    Workspace workspace){
      workspace.add(new DataTablesModel());
      Lookup.getDefault().lookup(DataTablesController.class).setDataTablesEventListener(DataTableTopComponent.this);
    }
    public void select(    Workspace workspace){
      hideTable();
      enableTableControls();
      bannerPanel.setVisible(false);
      AttributeModel attributeModel=Lookup.getDefault().lookup(AttributeController.class).getModel();
      attributeModel.getNodeTable().addAttributeListener(DataTableTopComponent.this);
      attributeModel.getEdgeTable().addAttributeListener(DataTableTopComponent.this);
      graphModel=gc.getModel();
      graphModel.addGraphListener(DataTableTopComponent.this);
      dataTablesModel=workspace.getLookup().lookup(DataTablesModel.class);
      refreshAll();
    }
    public void unselect(    Workspace workspace){
      graphModel.removeGraphListener(DataTableTopComponent.this);
      AttributeModel attributeModel=workspace.getLookup().lookup(AttributeModel.class);
      attributeModel.getNodeTable().removeAttributeListener(DataTableTopComponent.this);
      attributeModel.getEdgeTable().removeAttributeListener(DataTableTopComponent.this);
      graphModel=null;
      dataTablesModel=null;
      clearAll();
    }
    public void close(    Workspace workspace){
      clearAll();
    }
    public void disable(){
      clearAll();
      Lookup.getDefault().lookup(DataTablesController.class).setDataTablesEventListener(null);
    }
  }
);
  if (pc.getCurrentWorkspace() != null) {
    dataTablesModel=pc.getCurrentWorkspace().getLookup().lookup(DataTablesModel.class);
    graphModel=gc.getModel();
    graphModel.addGraphListener(DataTableTopComponent.this);
    AttributeModel attributeModel=pc.getCurrentWorkspace().getLookup().lookup(AttributeModel.class);
    attributeModel.getNodeTable().addAttributeListener(DataTableTopComponent.this);
    attributeModel.getEdgeTable().addAttributeListener(DataTableTopComponent.this);
  }
  if (dynamicFiltering) {
    filterTextField.getDocument().addDocumentListener(new DocumentListener(){
      public void insertUpdate(      DocumentEvent e){
        refreshFilter();
      }
      public void removeUpdate(      DocumentEvent e){
        refreshFilter();
      }
      public void changedUpdate(      DocumentEvent e){
      }
    }
);
  }
 else {
    filterTextField.addActionListener(new ActionListener(){
      public void actionPerformed(      ActionEvent e){
        refreshFilter();
      }
    }
);
  }
  visibleGraphCheckbox.setSelected(visibleOnly);
  visibleGraphCheckbox.addItemListener(new ItemListener(){
    public void itemStateChanged(    ItemEvent e){
      visibleOnly=visibleGraphCheckbox.isSelected();
      if (classDisplayed.equals(ClassDisplayed.NODE)) {
        initNodesView();
      }
 else       if (classDisplayed.equals(ClassDisplayed.EDGE)) {
        initEdgesView();
      }
    }
  }
);
}

Fixed version (ground truth):
private void initEvents(){
  ProjectController pc=Lookup.getDefault().lookup(ProjectController.class);
  final GraphController gc=Lookup.getDefault().lookup(GraphController.class);
  pc.addWorkspaceListener(new WorkspaceListener(){
    public void initialize(    Workspace workspace){
      workspace.add(new DataTablesModel());
      Lookup.getDefault().lookup(DataTablesController.class).setDataTablesEventListener(DataTableTopComponent.this);
    }
    public void select(    Workspace workspace){
      Lookup.getDefault().lookup(DataTablesController.class).setDataTablesEventListener(DataTableTopComponent.this);
      hideTable();
      enableTableControls();
      bannerPanel.setVisible(false);
      AttributeModel attributeModel=Lookup.getDefault().lookup(AttributeController.class).getModel();
      attributeModel.getNodeTable().addAttributeListener(DataTableTopComponent.this);
      attributeModel.getEdgeTable().addAttributeListener(DataTableTopComponent.this);
      graphModel=gc.getModel();
      graphModel.addGraphListener(DataTableTopComponent.this);
      dataTablesModel=workspace.getLookup().lookup(DataTablesModel.class);
      refreshAll();
    }
    public void unselect(    Workspace workspace){
      graphModel.removeGraphListener(DataTableTopComponent.this);
      AttributeModel attributeModel=workspace.getLookup().lookup(AttributeModel.class);
      attributeModel.getNodeTable().removeAttributeListener(DataTableTopComponent.this);
      attributeModel.getEdgeTable().removeAttributeListener(DataTableTopComponent.this);
      graphModel=null;
      dataTablesModel=null;
      clearAll();
    }
    public void close(    Workspace workspace){
      clearAll();
    }
    public void disable(){
      clearAll();
      Lookup.getDefault().lookup(DataTablesController.class).setDataTablesEventListener(null);
    }
  }
);
  if (pc.getCurrentWorkspace() != null) {
    dataTablesModel=pc.getCurrentWorkspace().getLookup().lookup(DataTablesModel.class);
    graphModel=gc.getModel();
    graphModel.addGraphListener(DataTableTopComponent.this);
    AttributeModel attributeModel=pc.getCurrentWorkspace().getLookup().lookup(AttributeModel.class);
    attributeModel.getNodeTable().addAttributeListener(DataTableTopComponent.this);
    attributeModel.getEdgeTable().addAttributeListener(DataTableTopComponent.this);
  }
  if (dynamicFiltering) {
    filterTextField.getDocument().addDocumentListener(new DocumentListener(){
      public void insertUpdate(      DocumentEvent e){
        refreshFilter();
      }
      public void removeUpdate(      DocumentEvent e){
        refreshFilter();
      }
      public void changedUpdate(      DocumentEvent e){
      }
    }
);
  }
 else {
    filterTextField.addActionListener(new ActionListener(){
      public void actionPerformed(      ActionEvent e){
        refreshFilter();
      }
    }
);
  }
  visibleGraphCheckbox.setSelected(visibleOnly);
  visibleGraphCheckbox.addItemListener(new ItemListener(){
    public void itemStateChanged(    ItemEvent e){
      visibleOnly=visibleGraphCheckbox.isSelected();
      if (classDisplayed.equals(ClassDisplayed.NODE)) {
        initNodesView();
      }
 else       if (classDisplayed.equals(ClassDisplayed.EDGE)) {
        initEdgesView();
      }
    }
  }
);
}