Program: 190263
Project: 190263
Buggy source:
private void initEvents(){
  ProjectController pc=Lookup.getDefault().lookup(ProjectController.class);
  final GraphController gc=Lookup.getDefault().lookup(GraphController.class);
  final AttributeController ac=Lookup.getDefault().lookup(AttributeController.class);
  pc.addWorkspaceListener(new WorkspaceListener(){
    public void initialize(    Workspace workspace){
      workspace.add(new DataTablesModel());
    }
    public void select(    Workspace workspace){
      elementGroup.clearSelection();
      tableScrollPane.setViewportView(null);
      nodesButton.setEnabled(true);
      edgesButton.setEnabled(true);
      filterTextField.setEnabled(true);
      labelFilter.setEnabled(true);
      visibleGraphCheckbox.setEnabled(true);
      bannerPanel.setVisible(false);
      graphModel=gc.getModel();
      graphModel.addGraphListener(DataTableTopComponent.this);
      dataTablesModel=workspace.getLookup().lookup(DataTablesModel.class);
      AttributeModel attributeModel=workspace.getLookup().lookup(AttributeModel.class);
      attributeModel.getNodeTable().addAttributeListener(DataTableTopComponent.this);
      attributeModel.getEdgeTable().addAttributeListener(DataTableTopComponent.this);
    }
    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;
    }
    public void close(    Workspace workspace){
    }
    public void disable(){
      elementGroup.clearSelection();
      nodesButton.setEnabled(false);
      edgesButton.setEnabled(false);
      filterTextField.setEnabled(false);
      labelFilter.setEnabled(false);
      bannerPanel.setVisible(false);
      visibleGraphCheckbox.setEnabled(false);
    }
  }
);
  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);
  final AttributeController ac=Lookup.getDefault().lookup(AttributeController.class);
  pc.addWorkspaceListener(new WorkspaceListener(){
    public void initialize(    Workspace workspace){
      workspace.add(new DataTablesModel());
      refresh();
    }
    public void select(    Workspace workspace){
      elementGroup.clearSelection();
      tableScrollPane.setViewportView(null);
      nodesButton.setEnabled(true);
      edgesButton.setEnabled(true);
      filterTextField.setEnabled(true);
      labelFilter.setEnabled(true);
      visibleGraphCheckbox.setEnabled(true);
      bannerPanel.setVisible(false);
      graphModel=gc.getModel();
      graphModel.addGraphListener(DataTableTopComponent.this);
      dataTablesModel=workspace.getLookup().lookup(DataTablesModel.class);
      AttributeModel attributeModel=workspace.getLookup().lookup(AttributeModel.class);
      attributeModel.getNodeTable().addAttributeListener(DataTableTopComponent.this);
      attributeModel.getEdgeTable().addAttributeListener(DataTableTopComponent.this);
      refresh();
    }
    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;
      clear();
    }
    public void close(    Workspace workspace){
      clear();
    }
    public void disable(){
      elementGroup.clearSelection();
      nodesButton.setEnabled(false);
      edgesButton.setEnabled(false);
      filterTextField.setEnabled(false);
      labelFilter.setEnabled(false);
      bannerPanel.setVisible(false);
      visibleGraphCheckbox.setEnabled(false);
      clear();
    }
  }
);
  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();
      }
    }
  }
);
}