Program: 118191
Project: 118191
Buggy source:
@Override protected void addListeners(){
  super.addListeners();
  connectionsViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      try {
        resetProjectOperationSelectionWithBusyCursor(false);
        final ConnectionBean connection=getConnection();
        if (connection == null) {
          checkErrors();
          return;
        }
        if (connection == loginHelper.getCurrentSelectedConnBean()) {
          return;
        }
 else {
          loginHelper.setCurrentSelectedConnBean(connection);
        }
        errorManager.clearAllMessages();
        updateServerFields();
        if (validateFields()) {
          fillUIProjectListWithBusyCursor();
          validateProject();
        }
        checkErrors();
        validateUpdate();
      }
 catch (      PersistenceException e) {
        CommonExceptionHandler.process(e);
      }
catch (      JSONException e) {
        CommonExceptionHandler.process(e);
      }
    }
  }
);
  selectExistingProject.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (selectExistingProject.getSelection()) {
        finishButtonAction=FINISH_ACTION_OPEN_PROJECT;
        try {
          checkErrors();
        }
 catch (        PersistenceException e1) {
          CommonExceptionHandler.process(e1);
        }
      }
 else {
        refreshProjectListAreaEnable(false);
      }
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  createSandBoxProject.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (createSandBoxProject.getSelection()) {
        finishButtonAction=FINISH_ACTION_CREATE_SANDBOX;
        refreshUIFinishButtonEnable(false);
        executeCreateSandBoxProject.setVisible(true);
        executeCreateSandBoxProject.forceFocus();
      }
 else {
        executeCreateSandBoxProject.setVisible(false);
      }
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  importDemoProject.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (importDemoProject.getSelection()) {
        finishButtonAction=FINISH_ACTION_IMPORT_DEMO_PROJECT;
        refreshUIFinishButtonEnable(false);
        executeImportDemoProject.setVisible(true);
        executeImportDemoProject.forceFocus();
      }
 else {
        executeImportDemoProject.setVisible(false);
      }
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  importLocalProject.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (importLocalProject.getSelection()) {
        finishButtonAction=FINISH_ACTION_IMPORT_LOCAL_PROJECT;
        refreshUIFinishButtonEnable(false);
        executeImportLocalProject.setVisible(true);
        executeImportLocalProject.forceFocus();
      }
 else {
        executeImportLocalProject.setVisible(false);
      }
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  createNewProject.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (createNewProject.getSelection()) {
        createNewProject.setText(Messages.getString("String_Node_Str"));
        createNewProject.pack();
        FormData formData=(FormData)newProjectName.getLayoutData();
        formData.left=new FormAttachment(createNewProject,createNewProject.getSize().x + TAB_HORIZONTAL_PADDING_LEVEL_2,SWT.LEFT);
        newProjectName.setVisible(true);
        newProjectName.forceFocus();
        executeCreateNewProject.setVisible(true);
        finishButtonAction=FINISH_ACTION_CREATE_NEW_PROJECT;
        refreshUIFinishButtonEnable(false);
        validateNewProjectName();
      }
 else {
        createNewProject.setText(Messages.getString("String_Node_Str"));
        newProjectName.setVisible(false);
        executeCreateNewProject.setVisible(false);
        getErrorManager().clearCreateNewProjectError();
      }
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  projectViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      finishButton.setEnabled(false);
      Project project=getProject();
      if (project != null) {
        loginHelper.getPrefManipulator().setLastProject(project.getLabel());
        try {
          fillUIBranches(project,false);
        }
 catch (        JSONException e) {
          ExceptionHandler.process(e);
        }
        setRepositoryContextInContext();
      }
      finishButton.setEnabled(true);
    }
  }
);
  branchesViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      String branch=getBranch();
      if (branch == null) {
        branch=SVNConstant.EMPTY;
      }
      Project project=getProject();
      try {
        loginHelper.getPrefManipulator().setLastSVNBranch(new JSONObject(project.getEmfProject().getUrl()).getString("String_Node_Str"),project.getTechnicalLabel(),branch);
      }
 catch (      JSONException e) {
        ExceptionHandler.process(e);
      }
    }
  }
);
  manageButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      try {
        ConnectionsDialog connectionsDialog=new ConnectionsDialog(getShell());
        int open=connectionsDialog.open();
        if (open == Window.OK) {
          List<ConnectionBean> storedConnections=connectionsDialog.getConnections();
          loginHelper.setStoredConnections(storedConnections);
          loginHelper.saveConnections();
          fillUIContentsWithBusyCursor();
          final ConnectionBean connection=getConnection();
          if (connection == null) {
            checkErrors();
            return;
          }
          updateServerFields();
          if (validateFields()) {
            fillUIProjectListWithBusyCursor();
            validateProject();
          }
          checkErrors();
          validateUpdate();
        }
 else         if (!LoginHelper.isRemoteConnection(getConnection())) {
          fillUIProjectListWithBusyCursor();
          validateProject();
          checkErrors();
        }
      }
 catch (      PersistenceException e1) {
        CommonExceptionHandler.process(e1);
      }
catch (      JSONException e2) {
        CommonExceptionHandler.process(e2);
      }
    }
  }
);
  refreshProjectButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (validateFields()) {
        fillUIProjectListWithBusyCursor();
        validateProject();
      }
      try {
        checkErrors();
        validateUpdate();
      }
 catch (      PersistenceException e1) {
        CommonExceptionHandler.process(e1);
      }
catch (      JSONException e1) {
        CommonExceptionHandler.process(e1);
      }
      setRepositoryContextInContext();
    }
  }
);
  newProjectName.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      validateNewProjectName();
    }
  }
);
  executeCreateNewProject.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      createNewProjectWithBusyCursor();
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  executeCreateSandBoxProject.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      createSandboxProject();
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  executeImportDemoProject.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      importDemoProject();
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  executeImportLocalProject.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      importProjects();
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  finishButton.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (FINISH_ACTION_OPEN_PROJECT.equals(finishButtonAction)) {
        setRepositoryContextInContext();
        finishPressed();
      }
 else       if (FINISH_ACTION_RESTART.equals(finishButtonAction)) {
        restartStudio();
      }
 else       if (FINISH_ACTION_UPDATE.equals(finishButtonAction) || FINISH_ACTION_UPDATE_DETAILS.equals(finishButtonAction)) {
        updateStudio();
      }
 else       if (FINISH_ACTION_CREATE_SANDBOX.equals(finishButtonAction)) {
        createSandboxProject();
      }
 else       if (FINISH_ACTION_IMPORT_DEMO_PROJECT.equals(finishButtonAction)) {
        importDemoProject();
      }
 else       if (FINISH_ACTION_IMPORT_LOCAL_PROJECT.equals(finishButtonAction)) {
        importProjects();
      }
 else       if (FINISH_ACTION_CREATE_NEW_PROJECT.equals(finishButtonAction)) {
        createNewProjectWithBusyCursor();
      }
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
}

Fixed version (ground truth):
@Override protected void addListeners(){
  super.addListeners();
  connectionsViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      try {
        resetProjectOperationSelectionWithBusyCursor(false);
        final ConnectionBean connection=getConnection();
        if (connection == null) {
          checkErrors();
          return;
        }
        if (connection == loginHelper.getCurrentSelectedConnBean()) {
          return;
        }
 else {
          loginHelper.setCurrentSelectedConnBean(connection);
        }
        errorManager.clearAllMessages();
        updateServerFields();
        if (validateFields()) {
          fillUIProjectListWithBusyCursor();
          validateProject();
        }
        checkErrors();
        validateUpdate();
      }
 catch (      PersistenceException e) {
        CommonExceptionHandler.process(e);
      }
catch (      JSONException e) {
        CommonExceptionHandler.process(e);
      }
    }
  }
);
  selectExistingProject.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (selectExistingProject.getSelection()) {
        finishButtonAction=FINISH_ACTION_OPEN_PROJECT;
        try {
          checkErrors();
        }
 catch (        PersistenceException e1) {
          CommonExceptionHandler.process(e1);
        }
      }
 else {
        refreshProjectListAreaEnable(false);
      }
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  createSandBoxProject.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (createSandBoxProject.getSelection()) {
        finishButtonAction=FINISH_ACTION_CREATE_SANDBOX;
        refreshUIFinishButtonEnable(false);
        executeCreateSandBoxProject.setVisible(true);
        executeCreateSandBoxProject.forceFocus();
      }
 else {
        executeCreateSandBoxProject.setVisible(false);
      }
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  importDemoProject.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (importDemoProject.getSelection()) {
        finishButtonAction=FINISH_ACTION_IMPORT_DEMO_PROJECT;
        refreshUIFinishButtonEnable(false);
        executeImportDemoProject.setVisible(true);
        executeImportDemoProject.forceFocus();
      }
 else {
        executeImportDemoProject.setVisible(false);
      }
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  importLocalProject.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (importLocalProject.getSelection()) {
        finishButtonAction=FINISH_ACTION_IMPORT_LOCAL_PROJECT;
        refreshUIFinishButtonEnable(false);
        executeImportLocalProject.setVisible(true);
        executeImportLocalProject.forceFocus();
      }
 else {
        executeImportLocalProject.setVisible(false);
      }
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  createNewProject.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (createNewProject.getSelection()) {
        createNewProject.setText(Messages.getString("String_Node_Str"));
        createNewProject.pack();
        FormData formData=(FormData)newProjectName.getLayoutData();
        formData.left=new FormAttachment(createNewProject,createNewProject.getSize().x + TAB_HORIZONTAL_PADDING_LEVEL_2,SWT.LEFT);
        newProjectName.setVisible(true);
        newProjectName.forceFocus();
        executeCreateNewProject.setVisible(true);
        finishButtonAction=FINISH_ACTION_CREATE_NEW_PROJECT;
        refreshUIFinishButtonEnable(false);
        validateNewProjectName();
      }
 else {
        createNewProject.setText(Messages.getString("String_Node_Str"));
        newProjectName.setVisible(false);
        executeCreateNewProject.setVisible(false);
        getErrorManager().clearCreateNewProjectError();
      }
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  projectViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      finishButton.setEnabled(false);
      Project project=getProject();
      if (project != null) {
        try {
          fillUIBranches(project,false);
        }
 catch (        JSONException e) {
          ExceptionHandler.process(e);
        }
        setRepositoryContextInContext();
      }
      finishButton.setEnabled(true);
    }
  }
);
  branchesViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
    }
  }
);
  manageButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      try {
        ConnectionsDialog connectionsDialog=new ConnectionsDialog(getShell());
        int open=connectionsDialog.open();
        if (open == Window.OK) {
          List<ConnectionBean> storedConnections=connectionsDialog.getConnections();
          loginHelper.setStoredConnections(storedConnections);
          loginHelper.saveConnections();
          fillUIContentsWithBusyCursor();
          final ConnectionBean connection=getConnection();
          if (connection == null) {
            checkErrors();
            return;
          }
          updateServerFields();
          if (validateFields()) {
            fillUIProjectListWithBusyCursor();
            validateProject();
          }
          checkErrors();
          validateUpdate();
        }
 else         if (!LoginHelper.isRemoteConnection(getConnection())) {
          fillUIProjectListWithBusyCursor();
          validateProject();
          checkErrors();
        }
      }
 catch (      PersistenceException e1) {
        CommonExceptionHandler.process(e1);
      }
catch (      JSONException e2) {
        CommonExceptionHandler.process(e2);
      }
    }
  }
);
  refreshProjectButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (validateFields()) {
        fillUIProjectListWithBusyCursor();
        validateProject();
      }
      try {
        checkErrors();
        validateUpdate();
      }
 catch (      PersistenceException e1) {
        CommonExceptionHandler.process(e1);
      }
catch (      JSONException e1) {
        CommonExceptionHandler.process(e1);
      }
      setRepositoryContextInContext();
    }
  }
);
  newProjectName.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      validateNewProjectName();
    }
  }
);
  executeCreateNewProject.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      createNewProjectWithBusyCursor();
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  executeCreateSandBoxProject.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      createSandboxProject();
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  executeImportDemoProject.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      importDemoProject();
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  executeImportLocalProject.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      importProjects();
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  finishButton.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (FINISH_ACTION_OPEN_PROJECT.equals(finishButtonAction)) {
        setRepositoryContextInContext();
        finishPressed();
      }
 else       if (FINISH_ACTION_RESTART.equals(finishButtonAction)) {
        restartStudio();
      }
 else       if (FINISH_ACTION_UPDATE.equals(finishButtonAction) || FINISH_ACTION_UPDATE_DETAILS.equals(finishButtonAction)) {
        updateStudio();
      }
 else       if (FINISH_ACTION_CREATE_SANDBOX.equals(finishButtonAction)) {
        createSandboxProject();
      }
 else       if (FINISH_ACTION_IMPORT_DEMO_PROJECT.equals(finishButtonAction)) {
        importDemoProject();
      }
 else       if (FINISH_ACTION_IMPORT_LOCAL_PROJECT.equals(finishButtonAction)) {
        importProjects();
      }
 else       if (FINISH_ACTION_CREATE_NEW_PROJECT.equals(finishButtonAction)) {
        createNewProjectWithBusyCursor();
      }
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
}