Program: 124268
Project: 124268
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_TWO_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=(DemoProjectBean)demoProjectList.get(i);
    importCombo.add(bean.getProjectName());
  }
  importCombo.setSelection(new StructuredSelection(new Object[]{importCombo.getElementAt(0)}));
  manageProjectsButtonTemp.addSelectionListener(new SelectionAdapter(){
    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 newName=newPrjWiz.getName();
        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> demoProjectList=ImportProjectsUtilities.getAllDemoProjects();
              DemoProjectBean demoProjectBean=null;
              for (              DemoProjectBean bean : demoProjectList) {
                if (bean.getProjectName().equals(demoProjName)) {
                  demoProjectBean=bean;
                  break;
                }
              }
              if (null == demoProjectBean) {
                throw new IOException("String_Node_Str");
              }
              String techName=demoProjectBean.getProjectName();
              String demoFilePath=demoProjectBean.getDemoProjectFilePath();
              EDemoProjectFileType demoProjectFileType=demoProjectBean.getDemoProjectFileType();
              String pluginID=org.talend.resources.ResourcesPlugin.PLUGIN_ID;
              if (techName.equals("String_Node_Str")) {
                pluginID="String_Node_Str";
              }
 else               if (techName.equals("String_Node_Str")) {
                pluginID="String_Node_Str";
              }
              Bundle bundle=Platform.getBundle(pluginID);
              URL url=FileLocator.resolve(bundle.getEntry(demoFilePath));
              String filePath=new Path(url.getFile()).toOSString();
              if (demoProjectFileType.getName().equalsIgnoreCase("String_Node_Str")) {
                ImportProjectsUtilities.importProjectAs(getShell(),newName,newName,filePath,monitorWrap);
              }
 else {
                ImportProjectsUtilities.importArchiveProject(getShell(),newName,filePath,monitorWrap);
              }
            }
 catch (            IOException e) {
              throw new InvocationTargetException(e);
            }
catch (            TarException e) {
              throw new InvocationTargetException(e);
            }
            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();
  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_TWO_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=(DemoProjectBean)demoProjectList.get(i);
    importCombo.add(bean.getProjectName());
  }
  importCombo.setSelection(new StructuredSelection(new Object[]{importCombo.getElementAt(0)}));
  manageProjectsButtonTemp.addSelectionListener(new SelectionAdapter(){
    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 newName=newPrjWiz.getName();
        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> demoProjectList=ImportProjectsUtilities.getAllDemoProjects();
              DemoProjectBean demoProjectBean=null;
              for (              DemoProjectBean bean : demoProjectList) {
                if (bean.getProjectName().equals(demoProjName)) {
                  demoProjectBean=bean;
                  break;
                }
              }
              if (null == demoProjectBean) {
                throw new IOException("String_Node_Str");
              }
              String techName=demoProjectBean.getProjectName();
              String demoFilePath=demoProjectBean.getDemoProjectFilePath();
              EDemoProjectFileType demoProjectFileType=demoProjectBean.getDemoProjectFileType();
              String pluginID=org.talend.resources.ResourcesPlugin.PLUGIN_ID;
              if (techName.equals("String_Node_Str")) {
                pluginID="String_Node_Str";
              }
 else               if (techName.equals("String_Node_Str")) {
                pluginID="String_Node_Str";
              }
              Bundle bundle=Platform.getBundle(pluginID);
              URL url=FileLocator.resolve(bundle.getEntry(demoFilePath));
              String filePath=new Path(url.getFile()).toOSString();
              if (demoProjectFileType.getName().equalsIgnoreCase("String_Node_Str")) {
                ImportProjectsUtilities.importProjectAs(getShell(),newName,newName,filePath,monitorWrap);
              }
 else {
                ImportProjectsUtilities.importArchiveProjectAs(getShell(),newName,newName,filePath,monitorWrap);
              }
            }
 catch (            IOException e) {
              throw new InvocationTargetException(e);
            }
catch (            TarException e) {
              throw new InvocationTargetException(e);
            }
            monitorWrap.done();
          }
        }
;
        try {
          progressDialog.executeProcess();
        }
 catch (        InvocationTargetException e1) {
          MessageBoxExceptionHandler.process(e1.getTargetException(),getShell());
        }
catch (        InterruptedException e1) {
        }
        dialog.advanced();
      }
    }
  }
);
}