Program: 147855
Project: 147855
Buggy source:
@Override 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(Messages.getString("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(){
    @Override public int category(    Object element){
      if (element instanceof XSDDesc) {
        return ((XSDDesc)element).getType();
      }
      return -1;
    }
    @Override 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(Messages.getString("String_Node_Str"));
  addXSDFromLocal.setToolTipText(Messages.getString("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(Messages.getString("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(Messages.getString("String_Node_Str"));
    addXSDFromWebSite.setToolTipText(Messages.getString("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(),Messages.getString("String_Node_Str"));
        try {
          ArrayList<String> schemaList=new ArrayList<String>();
          XtentisPort port=getPort();
          if (port == null) {
            MessageDialog.openError(getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
            return;
          }
          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) {
          if (getUrl() == null) {
            MessageDialog.openError(getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
            return;
          }
          List<String> urls=dlg.getMDMDataModelUrls();
          for (          String url : urls) {
            XSDDesc xsdDesc=buildUp(getUrl() + 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(Messages.getString("String_Node_Str"));
  impXSDFromExchange.setToolTipText(Messages.getString("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(Messages.getString("String_Node_Str"));
  addXSDFromInputDlg.setToolTipText(Messages.getString("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(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),"String_Node_Str",new IInputValidator(){
        public String isValid(        String newText){
          if ((newText == null) || "String_Node_Str".equals(newText))           return Messages.getString("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(Messages.getString("String_Node_Str"));
  delLabelButton.setToolTipText(Messages.getString("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):
@Override 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(Messages.getString("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(){
    @Override public int category(    Object element){
      if (element instanceof XSDDesc) {
        return ((XSDDesc)element).getType();
      }
      return -1;
    }
    @Override 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(Messages.getString("String_Node_Str"));
  addXSDFromLocal.setToolTipText(Messages.getString("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(Messages.getString("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(Messages.getString("String_Node_Str"));
    addXSDFromWebSite.setToolTipText(Messages.getString("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(),Messages.getString("String_Node_Str"));
        try {
          ArrayList<String> schemaList=new ArrayList<String>();
          resolveSchemaList(schemaList,dlg);
        }
 catch (        Exception es) {
          log.error(es.getMessage(),es);
          return;
        }
        dlg.setBlockOnOpen(true);
        dlg.open();
        if (dlg.getReturnCode() == Window.OK) {
          if (getUrl() == null) {
            MessageDialog.openError(getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
            return;
          }
          List<String> urls=dlg.getMDMDataModelUrls();
          for (          String url : urls) {
            XSDDesc xsdDesc=buildUp(getUrl() + 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(Messages.getString("String_Node_Str"));
  impXSDFromExchange.setToolTipText(Messages.getString("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(Messages.getString("String_Node_Str"));
  addXSDFromInputDlg.setToolTipText(Messages.getString("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(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),"String_Node_Str",new IInputValidator(){
        public String isValid(        String newText){
          if ((newText == null) || "String_Node_Str".equals(newText))           return Messages.getString("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(Messages.getString("String_Node_Str"));
  delLabelButton.setToolTipText(Messages.getString("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;
}