Program: 123583
Project: 123583
Buggy source:
private void addListener(){
  createButton.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      Project project=null;
      ProxyRepositoryFactory repositoryFactory=ProxyRepositoryFactory.getInstance();
      NewProjectWizard newPrjWiz=new NewProjectWizard(null);
      WizardDialog newProjectDialog=new WizardDialog(getShell(),newPrjWiz);
      newProjectDialog.setTitle(Messages.getString("String_Node_Str"));
      if (newProjectDialog.open() == Window.OK) {
        project=newPrjWiz.getProject();
      }
      refresh();
    }
  }
);
  deleteButton.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      refresh();
      Shell activeShell=Display.getCurrent().getActiveShell();
      SelectDeleteProjectDialog dialog=new SelectDeleteProjectDialog(activeShell,true);
      if (dialog.open() == Dialog.OK) {
        CorePlugin.getDefault().getRepositoryLocalProviderService().resetXmiResourceSet();
        java.util.List<Object> delList=dialog.getDelList();
        if (delList.size() != 0) {
          for (          Object obj : delList) {
            if (obj instanceof IProject) {
              IProject p=(IProject)obj;
              if (projectsMap.containsKey(p.getName())) {
                projectsMap.remove(p.getName());
                String name=convertorMapper.get(p.getName());
                if (name != null) {
                  convertorMapper.remove(p.getName());
                  TOSLoginComposite.this.projectListViewer.getList().remove(name);
                }
                if (TOSLoginComposite.this.projectListViewer.getList().getItemCount() == 0) {
                  enableOpenAndDelete(false);
                }
 else                 if (TOSLoginComposite.this.projectListViewer.getSelection().isEmpty()) {
                  TOSLoginComposite.this.projectListViewer.getList().select(0);
                }
                try {
                  setStatusArea();
                }
 catch (                PersistenceException e1) {
                  ExceptionHandler.process(e1);
                }
              }
            }
          }
        }
      }
    }
  }
);
  importButton.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      ImportDemoProjectAction.getInstance().setShell(getShell());
      ImportProjectAsAction.getInstance().run();
      String newProject=ImportProjectAsAction.getInstance().getProjectName();
      if (newProject != null) {
        ProxyRepositoryFactory repositoryFactory=ProxyRepositoryFactory.getInstance();
        Project[] projects=null;
        try {
          projects=repositoryFactory.readProject();
        }
 catch (        PersistenceException e1) {
          e1.printStackTrace();
        }
catch (        BusinessException e1) {
          e1.printStackTrace();
        }
        if (!projectsMap.containsKey(newProject.toUpperCase())) {
          for (int i=0; i < projects.length; i++) {
            if (projects[i].getLabel().toUpperCase().equals(newProject.toUpperCase())) {
              projectsMap.put(newProject.toUpperCase(),projects[i]);
              convertorMapper.put(newProject.toUpperCase(),newProject);
              enableOpenAndDelete(true);
              try {
                setStatusArea();
              }
 catch (              PersistenceException e1) {
                ExceptionHandler.process(e1);
              }
            }
          }
          TOSLoginComposite.this.projectListViewer.setInput(new ArrayList(convertorMapper.values()));
        }
      }
      try {
        IRunnableWithProgress op=new IRunnableWithProgress(){
          public void run(          IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            try {
              ProxyRepositoryFactory.getInstance().initialize();
            }
 catch (            PersistenceException e) {
              throw new InvocationTargetException(e);
            }
          }
        }
;
        new ProgressMonitorDialog(getShell()).run(true,false,op);
        refresh();
      }
 catch (      InvocationTargetException e1) {
        e1.getTargetException();
      }
catch (      InterruptedException e1) {
        e1.printStackTrace();
      }
    }
  }
);
  changeButton.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      DirectoryDialog dirDialog=new DirectoryDialog(dialog.getShell());
      String path=dirDialog.open();
      if (path == null || "String_Node_Str".equals(path)) {
        workspaceText.setText(getRecentWorkSpace());
        loginComposite.getConnection().setWorkSpace(getRecentWorkSpace());
      }
 else {
        workspaceText.setText(path);
        loginComposite.getConnection().setWorkSpace(path);
        if (!path.equals(oldPath)) {
          oldPath=path;
          restartBut.setVisible(true);
          openButton.setEnabled(false);
          deleteButton.setEnabled(false);
          createButton.setEnabled(false);
          importButton.setEnabled(false);
          demoProjectButton.setEnabled(false);
          changeButton.setEnabled(false);
        }
      }
      PreferenceManipulator prefManipulator=new PreferenceManipulator(CorePlugin.getDefault().getPreferenceStore());
      java.util.List<ConnectionBean> list=new ArrayList<ConnectionBean>();
      list.add(loginComposite.getConnection());
      prefManipulator.saveConnections(list);
      loginComposite.storedConnections=list;
      perReader.saveConnections(loginComposite.storedConnections);
      if (!loginComposite.isWorkSpaceSame()) {
        try {
          setStatusArea();
        }
 catch (        PersistenceException e1) {
          ExceptionHandler.process(e1);
        }
      }
    }
  }
);
  restartBut.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      LoginComposite.isRestart=true;
      perReader.saveLastConnectionBean(loginComposite.getConnection());
      dialog.okPressed();
    }
  }
);
  openButton.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      Context ctx=CorePlugin.getContext();
      ctx.putProperty(Context.REPOSITORY_CONTEXT_KEY,loginComposite.getRepositoryContext());
      if (!TOSLoginComposite.this.projectListViewer.getSelection().isEmpty()) {
        String selection=TOSLoginComposite.this.projectListViewer.getList().getSelection()[0];
        if (selection != null && !selection.equals("String_Node_Str")) {
          Project project=(Project)projectsMap.get(selection.toUpperCase());
          boolean flag=dialog.logIn(project);
          if (flag) {
            dialog.okPressed();
          }
        }
      }
    }
  }
);
  demoProjectButton.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      ImportDemoProjectAction action=ImportDemoProjectAction.getInstance();
      action.setShell(getShell());
      action.run();
      refresh();
    }
  }
);
}

Fixed version (ground truth):
private void addListener(){
  createButton.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      Project project=null;
      ProxyRepositoryFactory repositoryFactory=ProxyRepositoryFactory.getInstance();
      NewProjectWizard newPrjWiz=new NewProjectWizard(null);
      WizardDialog newProjectDialog=new WizardDialog(getShell(),newPrjWiz);
      newProjectDialog.setTitle(Messages.getString("String_Node_Str"));
      if (newProjectDialog.open() == Window.OK) {
        project=newPrjWiz.getProject();
      }
      refresh();
    }
  }
);
  deleteButton.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      Shell activeShell=Display.getCurrent().getActiveShell();
      SelectDeleteProjectDialog dialog=new SelectDeleteProjectDialog(activeShell,true);
      if (dialog.open() == Dialog.OK) {
        CorePlugin.getDefault().getRepositoryLocalProviderService().resetXmiResourceSet();
        java.util.List<Object> delList=dialog.getDelList();
        if (delList.size() != 0) {
          for (          Object obj : delList) {
            if (obj instanceof IProject) {
              IProject p=(IProject)obj;
              if (projectsMap.containsKey(p.getName())) {
                projectsMap.remove(p.getName());
                String name=convertorMapper.get(p.getName());
                if (name != null) {
                  convertorMapper.remove(p.getName());
                  TOSLoginComposite.this.projectListViewer.getList().remove(name);
                }
                if (TOSLoginComposite.this.projectListViewer.getList().getItemCount() == 0) {
                  enableOpenAndDelete(false);
                }
 else                 if (TOSLoginComposite.this.projectListViewer.getSelection().isEmpty()) {
                  TOSLoginComposite.this.projectListViewer.getList().select(0);
                }
                try {
                  setStatusArea();
                }
 catch (                PersistenceException e1) {
                  ExceptionHandler.process(e1);
                }
              }
            }
          }
        }
      }
      refresh();
    }
  }
);
  importButton.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      ImportDemoProjectAction.getInstance().setShell(getShell());
      ImportProjectAsAction.getInstance().run();
      String newProject=ImportProjectAsAction.getInstance().getProjectName();
      if (newProject != null) {
        ProxyRepositoryFactory repositoryFactory=ProxyRepositoryFactory.getInstance();
        Project[] projects=null;
        try {
          projects=repositoryFactory.readProject();
        }
 catch (        PersistenceException e1) {
          e1.printStackTrace();
        }
catch (        BusinessException e1) {
          e1.printStackTrace();
        }
        if (!projectsMap.containsKey(newProject.toUpperCase())) {
          for (int i=0; i < projects.length; i++) {
            if (projects[i].getLabel().toUpperCase().equals(newProject.toUpperCase())) {
              projectsMap.put(newProject.toUpperCase(),projects[i]);
              convertorMapper.put(newProject.toUpperCase(),newProject);
              enableOpenAndDelete(true);
              try {
                setStatusArea();
              }
 catch (              PersistenceException e1) {
                ExceptionHandler.process(e1);
              }
            }
          }
          TOSLoginComposite.this.projectListViewer.setInput(new ArrayList(convertorMapper.values()));
        }
      }
      try {
        IRunnableWithProgress op=new IRunnableWithProgress(){
          public void run(          IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            try {
              ProxyRepositoryFactory.getInstance().initialize();
            }
 catch (            PersistenceException e) {
              throw new InvocationTargetException(e);
            }
          }
        }
;
        new ProgressMonitorDialog(getShell()).run(true,false,op);
        refresh();
      }
 catch (      InvocationTargetException e1) {
        e1.getTargetException();
      }
catch (      InterruptedException e1) {
        e1.printStackTrace();
      }
    }
  }
);
  changeButton.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      DirectoryDialog dirDialog=new DirectoryDialog(dialog.getShell());
      String path=dirDialog.open();
      if (path == null || "String_Node_Str".equals(path)) {
        workspaceText.setText(getRecentWorkSpace());
        loginComposite.getConnection().setWorkSpace(getRecentWorkSpace());
      }
 else {
        workspaceText.setText(path);
        loginComposite.getConnection().setWorkSpace(path);
        if (!path.equals(oldPath)) {
          oldPath=path;
          restartBut.setVisible(true);
          openButton.setEnabled(false);
          deleteButton.setEnabled(false);
          createButton.setEnabled(false);
          importButton.setEnabled(false);
          demoProjectButton.setEnabled(false);
          changeButton.setEnabled(false);
        }
      }
      PreferenceManipulator prefManipulator=new PreferenceManipulator(CorePlugin.getDefault().getPreferenceStore());
      java.util.List<ConnectionBean> list=new ArrayList<ConnectionBean>();
      list.add(loginComposite.getConnection());
      prefManipulator.saveConnections(list);
      loginComposite.storedConnections=list;
      perReader.saveConnections(loginComposite.storedConnections);
      if (!loginComposite.isWorkSpaceSame()) {
        try {
          setStatusArea();
        }
 catch (        PersistenceException e1) {
          ExceptionHandler.process(e1);
        }
      }
    }
  }
);
  restartBut.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      LoginComposite.isRestart=true;
      perReader.saveLastConnectionBean(loginComposite.getConnection());
      dialog.okPressed();
    }
  }
);
  openButton.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      Context ctx=CorePlugin.getContext();
      ctx.putProperty(Context.REPOSITORY_CONTEXT_KEY,loginComposite.getRepositoryContext());
      if (!TOSLoginComposite.this.projectListViewer.getSelection().isEmpty()) {
        String selection=TOSLoginComposite.this.projectListViewer.getList().getSelection()[0];
        if (selection != null && !selection.equals("String_Node_Str")) {
          Project project=(Project)projectsMap.get(selection.toUpperCase());
          boolean flag=dialog.logIn(project);
          if (flag) {
            dialog.okPressed();
          }
        }
      }
    }
  }
);
  demoProjectButton.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      ImportDemoProjectAction action=ImportDemoProjectAction.getInstance();
      action.setShell(getShell());
      action.run();
      refresh();
    }
  }
);
}