Program: 147893
Project: 147893
Buggy source:
protected Control createDialogArea(Composite parent){
  parent.getShell().setText(this.title);
  Composite composite=(Composite)super.createDialogArea(parent);
  GridLayout layout=(GridLayout)composite.getLayout();
  layout.numColumns=2;
  Label label=new Label(composite,SWT.NONE);
  label.setLayoutData(new GridData(SWT.BEGINNING,SWT.CENTER,false,false,2,1));
  label.setText("String_Node_Str");
  tableViewer=new TableViewer(composite,SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL| SWT.BORDER);
  GridData data=new GridData(GridData.FILL,GridData.FILL,true,true,1,1);
  tableViewer.getControl().setLayoutData(data);
  ((GridData)tableViewer.getControl().getLayoutData()).heightHint=250;
  ((GridData)tableViewer.getControl().getLayoutData()).widthHint=300;
  XSDSchemaLabelProvider labelProvider=new XSDSchemaLabelProvider();
  XSDSchemaContentProvider contentProvider=new XSDSchemaContentProvider();
  tableViewer.setContentProvider(contentProvider);
  tableViewer.setLabelProvider(labelProvider);
  tableViewer.setInput(new Object());
  tableViewer.setSorter(new ViewerSorter(){
    public int category(    Object element){
      if (element instanceof XSDDesc) {
        return ((XSDDesc)element).getType();
      }
      return -1;
    }
    public int compare(    Viewer theViewer,    Object e1,    Object e2){
      int cat1=category(e1);
      int cat2=category(e2);
      return cat1 - cat2;
    }
  }
);
  tableViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      IStructuredSelection selection=(IStructuredSelection)event.getSelection();
      delLabelButton.setEnabled(!selection.isEmpty());
    }
  }
);
  Composite compositeBtn=new Composite(composite,SWT.FILL);
  compositeBtn.setLayoutData(new GridData(SWT.FILL,SWT.NONE,false,false,1,1));
  compositeBtn.setLayout(new GridLayout(1,false));
  Button addXSDFromLocal=new Button(compositeBtn,SWT.PUSH | SWT.FILL);
  addXSDFromLocal.setLayoutData(new GridData(SWT.FILL,SWT.NONE,false,false,1,1));
  addXSDFromLocal.setText("String_Node_Str");
  addXSDFromLocal.setToolTipText("String_Node_Str");
  addXSDFromLocal.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    org.eclipse.swt.events.SelectionEvent e){
    }
    public void widgetSelected(    org.eclipse.swt.events.SelectionEvent e){
      FileDialog fd=new FileDialog(shell.getShell(),SWT.SAVE);
      fd.setFilterExtensions(new String[]{"String_Node_Str"});
      fd.setText("String_Node_Str");
      String filename=fd.open();
      if (filename == null)       return;
      File file=new File(filename);
      try {
        log.info(file.toURL());
      }
 catch (      MalformedURLException e1) {
        log.error(e1.getMessage(),e1);
      }
      XSDDesc xsdDesc=buildUp(filename,LOCAL,0);
      include(xsdDesc);
      getButton(IDialogConstants.OK_ID).setEnabled(true);
      tableViewer.refresh();
    }
  }
);
  if (Util.IsEnterPrise()) {
    Button addXSDFromWebSite=new Button(compositeBtn,SWT.PUSH | SWT.FILL);
    addXSDFromWebSite.setLayoutData(new GridData(SWT.FILL,SWT.NONE,false,false,1,1));
    addXSDFromWebSite.setText("String_Node_Str");
    addXSDFromWebSite.setToolTipText("String_Node_Str");
    addXSDFromWebSite.addSelectionListener(new SelectionListener(){
      public void widgetDefaultSelected(      org.eclipse.swt.events.SelectionEvent e){
      }
      public void widgetSelected(      org.eclipse.swt.events.SelectionEvent e){
        MDMXSDSchemaEntryDialog dlg=new MDMXSDSchemaEntryDialog(shell.getShell(),"String_Node_Str");
        try {
          ArrayList<String> schemaList=new ArrayList<String>();
          XtentisPort port=Util.getPort(treeObject);
          WSDataModelPK[] xdmPKs=port.getDataModelPKs(new WSRegexDataModelPKs("String_Node_Str")).getWsDataModelPKs();
          if (xdmPKs != null) {
            for (int i=0; i < xdmPKs.length; i++) {
              String name=xdmPKs[i].getPk();
              if (!name.startsWith("String_Node_Str")) {
                schemaList.add(name);
              }
            }
            dlg.create();
            dlg.retrieveDataModels(schemaList,false);
          }
        }
 catch (        Exception es) {
          log.error(es.getMessage(),es);
          return;
        }
        dlg.setBlockOnOpen(true);
        dlg.open();
        if (dlg.getReturnCode() == Window.OK) {
          List<String> urls=dlg.getMDMDataModelUrls();
          for (          String url : urls) {
            XSDDesc xsdDesc=buildUp(LOCAL_MDM_URL + url + "String_Node_Str",MDM_WEB,1);
            include(xsdDesc);
          }
          getButton(IDialogConstants.OK_ID).setEnabled(true);
          tableViewer.refresh();
        }
      }
    }
);
  }
  Button impXSDFromExchange=new Button(compositeBtn,SWT.PUSH | SWT.FILL);
  impXSDFromExchange.setLayoutData(new GridData(SWT.FILL,SWT.NONE,false,false,1,1));
  impXSDFromExchange.setText("String_Node_Str");
  impXSDFromExchange.setToolTipText("String_Node_Str");
  impXSDFromExchange.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    SelectionEvent e){
    }
    public void widgetSelected(    SelectionEvent e){
      HttpClient client=new HttpClient();
      String importFolder=System.getProperty("String_Node_Str");
      StringBuffer repository=new StringBuffer();
      ImportExchangeOptionsDialog dlg=new ImportExchangeOptionsDialog(shell.getShell(),null,false,repository);
      dlg.setBlockOnOpen(true);
      int ret=dlg.open();
      if (ret == Window.OK) {
        File dir=new File(repository.toString());
        for (        File file : dir.listFiles()) {
          if (file.getName().endsWith("String_Node_Str")) {
            XSDDesc xsdDesc=buildUp(file.getAbsolutePath(),MDM_WEB,1);
            include(xsdDesc);
          }
        }
        getButton(IDialogConstants.OK_ID).setEnabled(true);
        tableViewer.refresh();
      }
    }
  }
);
  Button addXSDFromInputDlg=new Button(compositeBtn,SWT.PUSH | SWT.FILL);
  addXSDFromInputDlg.setLayoutData(new GridData(SWT.FILL,SWT.NONE,false,false,1,1));
  addXSDFromInputDlg.setText("String_Node_Str");
  addXSDFromInputDlg.setToolTipText("String_Node_Str");
  addXSDFromInputDlg.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    org.eclipse.swt.events.SelectionEvent e){
    }
    public void widgetSelected(    org.eclipse.swt.events.SelectionEvent e){
      InputDialog id=new InputDialog(shell.getShell(),"String_Node_Str","String_Node_Str","String_Node_Str",new IInputValidator(){
        public String isValid(        String newText){
          if ((newText == null) || "String_Node_Str".equals(newText))           return "String_Node_Str";
          return null;
        }
      }
);
      id.setBlockOnOpen(true);
      int ret=id.open();
      if (ret == Window.CANCEL) {
        return;
      }
      XSDDesc xsdDesc=buildUp(id.getValue(),OTHER_WEB,2);
      include(xsdDesc);
      getButton(IDialogConstants.OK_ID).setEnabled(true);
      tableViewer.refresh();
    }
  }
);
  delLabelButton=new Button(compositeBtn,SWT.PUSH);
  delLabelButton.setLayoutData(new GridData(SWT.FILL,SWT.NONE,false,false,1,1));
  delLabelButton.setText("String_Node_Str");
  delLabelButton.setToolTipText("String_Node_Str");
  delLabelButton.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    org.eclipse.swt.events.SelectionEvent e){
    }
    public void widgetSelected(    org.eclipse.swt.events.SelectionEvent e){
      IStructuredSelection selection=(IStructuredSelection)tableViewer.getSelection();
      for (Iterator<XSDDesc> iter=selection.iterator(); iter.hasNext(); ) {
        XSDDesc desc=(XSDDesc)iter.next();
        xsdDescList.remove(desc);
        toDelList.add(desc.getURL());
      }
      getButton(IDialogConstants.OK_ID).setEnabled(true);
      tableViewer.refresh();
    }
  }
);
  countImportListInSchema();
  tableViewer.setInput(xsdDescList);
  return composite;
}

Fixed version (ground truth):
protected Control createDialogArea(Composite parent){
  parent.getShell().setText(this.title);
  Composite composite=(Composite)super.createDialogArea(parent);
  GridLayout layout=(GridLayout)composite.getLayout();
  layout.numColumns=2;
  Label label=new Label(composite,SWT.NONE);
  label.setLayoutData(new GridData(SWT.BEGINNING,SWT.CENTER,false,false,2,1));
  label.setText("String_Node_Str");
  tableViewer=new TableViewer(composite,SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL| SWT.BORDER);
  GridData data=new GridData(GridData.FILL,GridData.FILL,true,true,1,1);
  tableViewer.getControl().setLayoutData(data);
  ((GridData)tableViewer.getControl().getLayoutData()).heightHint=250;
  ((GridData)tableViewer.getControl().getLayoutData()).widthHint=300;
  XSDSchemaLabelProvider labelProvider=new XSDSchemaLabelProvider();
  XSDSchemaContentProvider contentProvider=new XSDSchemaContentProvider();
  tableViewer.setContentProvider(contentProvider);
  tableViewer.setLabelProvider(labelProvider);
  tableViewer.setInput(new Object());
  tableViewer.setSorter(new ViewerSorter(){
    public int category(    Object element){
      if (element instanceof XSDDesc) {
        return ((XSDDesc)element).getType();
      }
      return -1;
    }
    public int compare(    Viewer theViewer,    Object e1,    Object e2){
      int cat1=category(e1);
      int cat2=category(e2);
      return cat1 - cat2;
    }
  }
);
  tableViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      IStructuredSelection selection=(IStructuredSelection)event.getSelection();
      delLabelButton.setEnabled(!selection.isEmpty());
    }
  }
);
  Composite compositeBtn=new Composite(composite,SWT.FILL);
  compositeBtn.setLayoutData(new GridData(SWT.FILL,SWT.NONE,false,false,1,1));
  compositeBtn.setLayout(new GridLayout(1,false));
  Button addXSDFromLocal=new Button(compositeBtn,SWT.PUSH | SWT.FILL);
  addXSDFromLocal.setLayoutData(new GridData(SWT.FILL,SWT.NONE,false,false,1,1));
  addXSDFromLocal.setText("String_Node_Str");
  addXSDFromLocal.setToolTipText("String_Node_Str");
  addXSDFromLocal.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    org.eclipse.swt.events.SelectionEvent e){
    }
    public void widgetSelected(    org.eclipse.swt.events.SelectionEvent e){
      FileDialog fd=new FileDialog(shell.getShell(),SWT.SAVE);
      fd.setFilterExtensions(new String[]{"String_Node_Str"});
      fd.setText("String_Node_Str");
      String filename=fd.open();
      if (filename == null)       return;
      File file=new File(filename);
      try {
        log.info(file.toURL());
      }
 catch (      MalformedURLException e1) {
        log.error(e1.getMessage(),e1);
      }
      XSDDesc xsdDesc=buildUp(filename,LOCAL,0);
      include(xsdDesc);
      getButton(IDialogConstants.OK_ID).setEnabled(true);
      tableViewer.refresh();
    }
  }
);
  if (Util.IsEnterPrise()) {
    Button addXSDFromWebSite=new Button(compositeBtn,SWT.PUSH | SWT.FILL);
    addXSDFromWebSite.setLayoutData(new GridData(SWT.FILL,SWT.NONE,false,false,1,1));
    addXSDFromWebSite.setText("String_Node_Str");
    addXSDFromWebSite.setToolTipText("String_Node_Str");
    addXSDFromWebSite.addSelectionListener(new SelectionListener(){
      public void widgetDefaultSelected(      org.eclipse.swt.events.SelectionEvent e){
      }
      public void widgetSelected(      org.eclipse.swt.events.SelectionEvent e){
        MDMXSDSchemaEntryDialog dlg=new MDMXSDSchemaEntryDialog(shell.getShell(),"String_Node_Str");
        try {
          ArrayList<String> schemaList=new ArrayList<String>();
          XtentisPort port=getPort();
          WSDataModelPK[] xdmPKs=port.getDataModelPKs(new WSRegexDataModelPKs("String_Node_Str")).getWsDataModelPKs();
          if (xdmPKs != null) {
            for (int i=0; i < xdmPKs.length; i++) {
              String name=xdmPKs[i].getPk();
              if (!name.startsWith("String_Node_Str")) {
                schemaList.add(name);
              }
            }
            dlg.create();
            dlg.retrieveDataModels(schemaList,false);
          }
        }
 catch (        Exception es) {
          log.error(es.getMessage(),es);
          return;
        }
        dlg.setBlockOnOpen(true);
        dlg.open();
        if (dlg.getReturnCode() == Window.OK) {
          List<String> urls=dlg.getMDMDataModelUrls();
          for (          String url : urls) {
            XSDDesc xsdDesc=buildUp(getLocal_mdm_url() + url + "String_Node_Str",MDM_WEB,1);
            include(xsdDesc);
          }
          getButton(IDialogConstants.OK_ID).setEnabled(true);
          tableViewer.refresh();
        }
      }
    }
);
  }
  Button impXSDFromExchange=new Button(compositeBtn,SWT.PUSH | SWT.FILL);
  impXSDFromExchange.setLayoutData(new GridData(SWT.FILL,SWT.NONE,false,false,1,1));
  impXSDFromExchange.setText("String_Node_Str");
  impXSDFromExchange.setToolTipText("String_Node_Str");
  impXSDFromExchange.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    SelectionEvent e){
    }
    public void widgetSelected(    SelectionEvent e){
      HttpClient client=new HttpClient();
      String importFolder=System.getProperty("String_Node_Str");
      StringBuffer repository=new StringBuffer();
      ImportExchangeOptionsDialog dlg=new ImportExchangeOptionsDialog(shell.getShell(),null,false,repository);
      dlg.setBlockOnOpen(true);
      int ret=dlg.open();
      if (ret == Window.OK) {
        File dir=new File(repository.toString());
        for (        File file : dir.listFiles()) {
          if (file.getName().endsWith("String_Node_Str")) {
            XSDDesc xsdDesc=buildUp(file.getAbsolutePath(),MDM_WEB,1);
            include(xsdDesc);
          }
        }
        getButton(IDialogConstants.OK_ID).setEnabled(true);
        tableViewer.refresh();
      }
    }
  }
);
  Button addXSDFromInputDlg=new Button(compositeBtn,SWT.PUSH | SWT.FILL);
  addXSDFromInputDlg.setLayoutData(new GridData(SWT.FILL,SWT.NONE,false,false,1,1));
  addXSDFromInputDlg.setText("String_Node_Str");
  addXSDFromInputDlg.setToolTipText("String_Node_Str");
  addXSDFromInputDlg.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    org.eclipse.swt.events.SelectionEvent e){
    }
    public void widgetSelected(    org.eclipse.swt.events.SelectionEvent e){
      InputDialog id=new InputDialog(shell.getShell(),"String_Node_Str","String_Node_Str","String_Node_Str",new IInputValidator(){
        public String isValid(        String newText){
          if ((newText == null) || "String_Node_Str".equals(newText))           return "String_Node_Str";
          return null;
        }
      }
);
      id.setBlockOnOpen(true);
      int ret=id.open();
      if (ret == Window.CANCEL) {
        return;
      }
      XSDDesc xsdDesc=buildUp(id.getValue(),OTHER_WEB,2);
      include(xsdDesc);
      getButton(IDialogConstants.OK_ID).setEnabled(true);
      tableViewer.refresh();
    }
  }
);
  delLabelButton=new Button(compositeBtn,SWT.PUSH);
  delLabelButton.setLayoutData(new GridData(SWT.FILL,SWT.NONE,false,false,1,1));
  delLabelButton.setText("String_Node_Str");
  delLabelButton.setToolTipText("String_Node_Str");
  delLabelButton.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    org.eclipse.swt.events.SelectionEvent e){
    }
    public void widgetSelected(    org.eclipse.swt.events.SelectionEvent e){
      IStructuredSelection selection=(IStructuredSelection)tableViewer.getSelection();
      for (Iterator<XSDDesc> iter=selection.iterator(); iter.hasNext(); ) {
        XSDDesc desc=(XSDDesc)iter.next();
        xsdDescList.remove(desc);
        toDelList.add(desc.getURL());
      }
      getButton(IDialogConstants.OK_ID).setEnabled(true);
      tableViewer.refresh();
    }
  }
);
  countImportListInSchema();
  tableViewer.setInput(xsdDescList);
  return composite;
}