Program: 119641
Project: 119641
Buggy source:
private void createTosActionArea(Composite parent){
  tosActionComposite=toolkit.createComposite(parent);
  tosActionComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  tosActionComposite.setLayout(new FormLayout());
  tosActionComposite.setBackgroundMode(SWT.INHERIT_DEFAULT);
  repositoryComposite.setBackground(parent.getBackground());
  FormData data;
  manageProjectsButton=toolkit.createButton(tosActionComposite,null,SWT.PUSH);
  manageProjectsButton.setBackground(tosActionComposite.getBackground());
  manageProjectsButton.setText(Messages.getString("String_Node_Str"));
  manageProjectsButton.setVisible(false);
  manageViewer=new ComboViewer(tosActionComposite,SWT.BORDER | SWT.READ_ONLY);
  manageViewer.setContentProvider(new ArrayContentProvider());
  manageViewer.setInput(getManageElements());
  manageViewer.getCombo().setVisible(false);
  data=new FormData();
  data.top=new FormAttachment(0,HORIZONTAL_THREE_SPACE);
  data.right=new FormAttachment(100,-HORIZONTAL_TWO_SPACE);
  data.bottom=new FormAttachment(100,-HORIZONTAL_FOUR_SPACE);
  manageProjectsButton.setLayoutData(data);
  manageProjectLabel1=toolkit.createLabel(tosActionComposite,Messages.getString("String_Node_Str"));
  manageProjectLabel1.setBackground(tosActionComposite.getBackground());
  data=new FormData();
  data.left=new FormAttachment(0,HORIZONTAL_TWO_SPACE);
  data.right=new FormAttachment(0,LEFTSPACE);
  data.bottom=new FormAttachment(manageProjectsButton,HORIZONTAL_FOUR_SPACE,SWT.CENTER);
  manageProjectLabel1.setLayoutData(data);
  manageProjectLabel1.setVisible(false);
  data=new FormData();
  data.left=new FormAttachment(manageProjectLabel1,HORIZONTAL_SPACE);
  data.bottom=new FormAttachment(manageProjectLabel1,HORIZONTAL_FOUR_SPACE,SWT.CENTER);
  Point pbtnPoint=manageProjectsButton.computeSize(SWT.DEFAULT,SWT.DEFAULT);
  data.right=new FormAttachment(100,-HORIZONTAL_THREE_SPACE - pbtnPoint.x);
  manageViewer.getControl().setLayoutData(data);
  manageProjectsButtonTemp=toolkit.createButton(tosActionComposite,null,SWT.PUSH);
  manageProjectsButtonTemp.setBackground(tosActionComposite.getBackground());
  manageProjectsButtonTemp.setText(Messages.getString("String_Node_Str"));
  data=new FormData();
  data.top=new FormAttachment(0,HORIZONTAL_THREE_SPACE);
  data.right=new FormAttachment(90,-HORIZONTAL_TWO_SPACE);
  data.bottom=new FormAttachment(100,-HORIZONTAL_FOUR_SPACE);
  manageProjectsButtonTemp.setLayoutData(data);
  manageProjectLabel1=toolkit.createLabel(tosActionComposite,Messages.getString("String_Node_Str"));
  manageProjectLabel1.setBackground(tosActionComposite.getBackground());
  GC gc=new GC(manageProjectLabel1);
  Point labelSize=gc.stringExtent(Messages.getString("String_Node_Str"));
  gc.dispose();
  data=new FormData();
  data.left=new FormAttachment(10,HORIZONTAL_SPACE);
  data.right=new FormAttachment(10,HORIZONTAL_TWO_SPACE + labelSize.x);
  data.bottom=new FormAttachment(manageProjectsButtonTemp,HORIZONTAL_FOUR_SPACE,SWT.CENTER);
  manageProjectLabel1.setLayoutData(data);
  importCombo=new ComboViewer(tosActionComposite,SWT.BORDER | SWT.READ_ONLY);
  data=new FormData();
  data.left=new FormAttachment(manageProjectLabel1,10,SWT.RIGHT);
  data.bottom=new FormAttachment(manageProjectLabel1,HORIZONTAL_FOUR_SPACE,SWT.CENTER);
  Point btPoint=manageProjectsButtonTemp.computeSize(SWT.DEFAULT,SWT.DEFAULT);
  data.right=new FormAttachment(100,-HORIZONTAL_THREE_SPACE - btPoint.x - 50);
  importCombo.getCombo().setLayoutData(data);
  importCombo.setContentProvider(new ArrayContentProvider());
  List<DemoProjectBean> demoProjectList=ImportProjectsUtilities.getAllDemoProjects();
  for (int i=0; i < demoProjectList.size(); i++) {
    DemoProjectBean bean=demoProjectList.get(i);
    importCombo.add(bean.getProjectName());
  }
  importCombo.setSelection(new StructuredSelection(new Object[]{importCombo.getElementAt(0)}));
  manageProjectsButtonTemp.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      NewImportProjectWizard newPrjWiz=new NewImportProjectWizard();
      WizardDialog newProjectDialog=new WizardDialog(getShell(),newPrjWiz);
      newProjectDialog.setTitle(Messages.getString("String_Node_Str"));
      if (newProjectDialog.open() == Window.OK) {
        final String projectName=newPrjWiz.getName().trim().replace(' ','_');
        final String demoProjName=importCombo.getCombo().getItem(importCombo.getCombo().getSelectionIndex());
        ProgressDialog progressDialog=new ProgressDialog(getShell()){
          private IProgressMonitor monitorWrap;
          @Override public void run(          IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            monitorWrap=new EventLoopProgressMonitor(monitor);
            try {
              final List<DemoProjectBean> demoProjectsList=ImportProjectsUtilities.getAllDemoProjects();
              DemoProjectBean demoProjectBean=null;
              for (              DemoProjectBean demoBean : demoProjectsList) {
                if (demoBean.getProjectName().equals(demoProjName)) {
                  demoProjectBean=demoBean;
                  break;
                }
              }
              if (null == demoProjectBean) {
                throw new IOException("String_Node_Str");
              }
              ImportProjectsUtilities.importDemoProject(getShell(),projectName,demoProjectBean,monitor);
            }
 catch (            Exception e1) {
              throw new InvocationTargetException(e1);
            }
            monitorWrap.done();
          }
        }
;
        try {
          progressDialog.executeProcess();
        }
 catch (        InvocationTargetException e1) {
          MessageBoxExceptionHandler.process(e1.getTargetException(),getShell());
        }
catch (        InterruptedException e1) {
        }
        dialog.advanced();
      }
    }
  }
);
}

Fixed version (ground truth):
private void createTosActionArea(Composite parent){
  tosActionComposite=toolkit.createComposite(parent);
  tosActionComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  tosActionComposite.setLayout(new FormLayout());
  tosActionComposite.setBackgroundMode(SWT.INHERIT_DEFAULT);
  repositoryComposite.setBackground(parent.getBackground());
  FormData data;
  manageProjectsButton=toolkit.createButton(tosActionComposite,null,SWT.PUSH);
  manageProjectsButton.setBackground(tosActionComposite.getBackground());
  manageProjectsButton.setText(Messages.getString("String_Node_Str"));
  manageProjectsButton.setVisible(false);
  manageViewer=new ComboViewer(tosActionComposite,SWT.BORDER | SWT.READ_ONLY);
  manageViewer.setContentProvider(new ArrayContentProvider());
  manageViewer.setInput(getManageElements());
  manageViewer.getCombo().setVisible(false);
  data=new FormData();
  data.top=new FormAttachment(0,HORIZONTAL_THREE_SPACE);
  data.right=new FormAttachment(100,-HORIZONTAL_TWO_SPACE);
  data.bottom=new FormAttachment(100,-HORIZONTAL_FOUR_SPACE);
  manageProjectsButton.setLayoutData(data);
  manageProjectLabel1=toolkit.createLabel(tosActionComposite,Messages.getString("String_Node_Str"));
  manageProjectLabel1.setBackground(tosActionComposite.getBackground());
  data=new FormData();
  comfortColumnWidth(manageProjectLabel1,data);
  data.left=new FormAttachment(0,HORIZONTAL_TWO_SPACE);
  data.bottom=new FormAttachment(manageProjectsButton,HORIZONTAL_FOUR_SPACE,SWT.CENTER);
  manageProjectLabel1.setLayoutData(data);
  manageProjectLabel1.setVisible(false);
  data=new FormData();
  data.left=new FormAttachment(manageProjectLabel1,HORIZONTAL_SPACE);
  data.bottom=new FormAttachment(manageProjectLabel1,HORIZONTAL_FOUR_SPACE,SWT.CENTER);
  Point pbtnPoint=manageProjectsButton.computeSize(SWT.DEFAULT,SWT.DEFAULT);
  data.right=new FormAttachment(100,-HORIZONTAL_THREE_SPACE - pbtnPoint.x);
  manageViewer.getControl().setLayoutData(data);
  manageProjectsButtonTemp=toolkit.createButton(tosActionComposite,null,SWT.PUSH);
  manageProjectsButtonTemp.setBackground(tosActionComposite.getBackground());
  manageProjectsButtonTemp.setText(Messages.getString("String_Node_Str"));
  data=new FormData();
  data.top=new FormAttachment(0,HORIZONTAL_THREE_SPACE);
  data.right=new FormAttachment(90,-HORIZONTAL_TWO_SPACE);
  data.bottom=new FormAttachment(100,-HORIZONTAL_FOUR_SPACE);
  manageProjectsButtonTemp.setLayoutData(data);
  manageProjectLabel1=toolkit.createLabel(tosActionComposite,Messages.getString("String_Node_Str"));
  manageProjectLabel1.setBackground(tosActionComposite.getBackground());
  GC gc=new GC(manageProjectLabel1);
  Point labelSize=gc.stringExtent(Messages.getString("String_Node_Str"));
  gc.dispose();
  data=new FormData();
  data.left=new FormAttachment(10,HORIZONTAL_SPACE);
  data.right=new FormAttachment(10,HORIZONTAL_TWO_SPACE + labelSize.x);
  data.bottom=new FormAttachment(manageProjectsButtonTemp,HORIZONTAL_FOUR_SPACE,SWT.CENTER);
  manageProjectLabel1.setLayoutData(data);
  importCombo=new ComboViewer(tosActionComposite,SWT.BORDER | SWT.READ_ONLY);
  data=new FormData();
  data.left=new FormAttachment(manageProjectLabel1,10,SWT.RIGHT);
  data.bottom=new FormAttachment(manageProjectLabel1,HORIZONTAL_FOUR_SPACE,SWT.CENTER);
  Point btPoint=manageProjectsButtonTemp.computeSize(SWT.DEFAULT,SWT.DEFAULT);
  data.right=new FormAttachment(100,-HORIZONTAL_THREE_SPACE - btPoint.x - 50);
  importCombo.getCombo().setLayoutData(data);
  importCombo.setContentProvider(new ArrayContentProvider());
  List<DemoProjectBean> demoProjectList=ImportProjectsUtilities.getAllDemoProjects();
  for (int i=0; i < demoProjectList.size(); i++) {
    DemoProjectBean bean=demoProjectList.get(i);
    importCombo.add(bean.getProjectName());
  }
  importCombo.setSelection(new StructuredSelection(new Object[]{importCombo.getElementAt(0)}));
  manageProjectsButtonTemp.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      NewImportProjectWizard newPrjWiz=new NewImportProjectWizard();
      WizardDialog newProjectDialog=new WizardDialog(getShell(),newPrjWiz);
      newProjectDialog.setTitle(Messages.getString("String_Node_Str"));
      if (newProjectDialog.open() == Window.OK) {
        final String projectName=newPrjWiz.getName().trim().replace(' ','_');
        final String demoProjName=importCombo.getCombo().getItem(importCombo.getCombo().getSelectionIndex());
        ProgressDialog progressDialog=new ProgressDialog(getShell()){
          private IProgressMonitor monitorWrap;
          @Override public void run(          IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            monitorWrap=new EventLoopProgressMonitor(monitor);
            try {
              final List<DemoProjectBean> demoProjectsList=ImportProjectsUtilities.getAllDemoProjects();
              DemoProjectBean demoProjectBean=null;
              for (              DemoProjectBean demoBean : demoProjectsList) {
                if (demoBean.getProjectName().equals(demoProjName)) {
                  demoProjectBean=demoBean;
                  break;
                }
              }
              if (null == demoProjectBean) {
                throw new IOException("String_Node_Str");
              }
              ImportProjectsUtilities.importDemoProject(getShell(),projectName,demoProjectBean,monitor);
            }
 catch (            Exception e1) {
              throw new InvocationTargetException(e1);
            }
            monitorWrap.done();
          }
        }
;
        try {
          progressDialog.executeProcess();
        }
 catch (        InvocationTargetException e1) {
          MessageBoxExceptionHandler.process(e1.getTargetException(),getShell());
        }
catch (        InterruptedException e1) {
        }
        dialog.advanced();
      }
    }
  }
);
}