Program: 7705
Project: 7705
Buggy source:
@Override protected Control createDialogArea(Composite parent){
  boolean advancedMode=Activator.getDefault().getPreferenceStore().getBoolean(ADVANCED_MODE_PREFERENCE);
  final Composite main=new Composite(parent,SWT.NONE);
  main.setLayout(new GridLayout(1,false));
  GridDataFactory.fillDefaults().grab(true,true).applyTo(main);
  Composite repositoryGroup=new Composite(main,SWT.SHADOW_ETCHED_IN);
  repositoryGroup.setLayout(new GridLayout(2,false));
  GridDataFactory.fillDefaults().grab(true,true).applyTo(repositoryGroup);
  Label repositoryLabel=new Label(repositoryGroup,SWT.NONE);
  repositoryLabel.setText(UIText.SimpleConfigurePushDialog_RepositoryLabel);
  Text repositoryText=new Text(repositoryGroup,SWT.BORDER | SWT.READ_ONLY);
  GridDataFactory.fillDefaults().grab(true,false).applyTo(repositoryText);
  repositoryText.setText(Activator.getDefault().getRepositoryUtil().getRepositoryName(repository));
  Label branchLabel=new Label(repositoryGroup,SWT.NONE);
  branchLabel.setText(UIText.SimpleConfigurePushDialog_BranchLabel);
  String branch;
  try {
    branch=repository.getBranch();
  }
 catch (  IOException e2) {
    branch=null;
  }
  if (branch == null || ObjectId.isId(branch)) {
    branch=UIText.SimpleConfigurePushDialog_DetachedHeadMessage;
  }
  Text branchText=new Text(repositoryGroup,SWT.BORDER | SWT.READ_ONLY);
  GridDataFactory.fillDefaults().grab(true,false).applyTo(branchText);
  branchText.setText(branch);
  Group remoteGroup=new Group(main,SWT.SHADOW_ETCHED_IN);
  remoteGroup.setLayout(new GridLayout());
  GridDataFactory.fillDefaults().grab(true,true).applyTo(remoteGroup);
  remoteGroup.setText(NLS.bind(UIText.SimpleConfigurePushDialog_RemoteGroupTitle,config.getName()));
  addDefaultOriginWarningIfNeeded(remoteGroup);
  Group uriGroup=new Group(remoteGroup,SWT.SHADOW_ETCHED_IN);
  uriGroup.setLayout(new GridLayout(1,false));
  GridDataFactory.fillDefaults().grab(true,true).applyTo(uriGroup);
  uriGroup.setText(UIText.SimpleConfigurePushDialog_UriGroup);
  final Composite sameUriDetails=new Composite(uriGroup,SWT.NONE);
  sameUriDetails.setLayout(new GridLayout(4,false));
  GridDataFactory.fillDefaults().grab(true,false).applyTo(sameUriDetails);
  Label commonUriLabel=new Label(sameUriDetails,SWT.NONE);
  commonUriLabel.setText(UIText.SimpleConfigurePushDialog_URILabel);
  commonUriText=new Text(sameUriDetails,SWT.BORDER | SWT.READ_ONLY);
  GridDataFactory.fillDefaults().grab(true,false).applyTo(commonUriText);
  changeCommonUri=new Button(sameUriDetails,SWT.PUSH);
  changeCommonUri.setText(UIText.SimpleConfigurePushDialog_ChangeUriButton);
  changeCommonUri.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      SelectUriWizard wiz;
      if (commonUriText.getText().length() > 0)       wiz=new SelectUriWizard(false,commonUriText.getText());
 else       wiz=new SelectUriWizard(false);
      if (new WizardDialog(getShell(),wiz).open() == Window.OK) {
        if (commonUriText.getText().length() > 0)         try {
          config.removeURI(new URIish(commonUriText.getText()));
        }
 catch (        URISyntaxException ex) {
          Activator.handleError(ex.getMessage(),ex,true);
        }
        config.addURI(wiz.getUri());
        updateControls();
      }
    }
  }
);
  deleteCommonUri=new Button(sameUriDetails,SWT.PUSH);
  deleteCommonUri.setText(UIText.SimpleConfigurePushDialog_DeleteUriButton);
  deleteCommonUri.setEnabled(false);
  deleteCommonUri.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      config.removeURI(config.getURIs().get(0));
      updateControls();
    }
  }
);
  commonUriText.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      deleteCommonUri.setEnabled(commonUriText.getText().length() > 0);
    }
  }
);
  final Composite pushUriDetails=new Composite(uriGroup,SWT.NONE);
  pushUriDetails.setLayout(new GridLayout(3,false));
  GridDataFactory.fillDefaults().grab(true,true).applyTo(pushUriDetails);
  Label urisLabel=new Label(pushUriDetails,SWT.NONE);
  urisLabel.setText(UIText.SimpleConfigurePushDialog_PushUrisLabel);
  GridDataFactory.fillDefaults().span(3,1).applyTo(urisLabel);
  uriViewer=new TableViewer(pushUriDetails,SWT.BORDER | SWT.MULTI);
  GridDataFactory.fillDefaults().grab(true,true).span(3,1).applyTo(uriViewer.getTable());
  uriViewer.setContentProvider(ArrayContentProvider.getInstance());
  Button addUri=new Button(pushUriDetails,SWT.PUSH);
  addUri.setText(UIText.SimpleConfigurePushDialog_AddPushUriButton);
  addUri.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      SelectUriWizard wiz=new SelectUriWizard(false);
      if (new WizardDialog(getShell(),wiz).open() == Window.OK) {
        config.addPushURI(wiz.getUri());
        updateControls();
      }
    }
  }
);
  final Button changeUri=new Button(pushUriDetails,SWT.PUSH);
  changeUri.setText(UIText.SimpleConfigurePushDialog_ChangePushUriButton);
  changeUri.setEnabled(false);
  changeUri.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      URIish uri=(URIish)((IStructuredSelection)uriViewer.getSelection()).getFirstElement();
      SelectUriWizard wiz=new SelectUriWizard(false,uri.toPrivateString());
      if (new WizardDialog(getShell(),wiz).open() == Window.OK) {
        config.removePushURI(uri);
        config.addPushURI(wiz.getUri());
        updateControls();
      }
    }
  }
);
  final Button deleteUri=new Button(pushUriDetails,SWT.PUSH);
  deleteUri.setText(UIText.SimpleConfigurePushDialog_DeletePushUriButton);
  deleteUri.setEnabled(false);
  deleteUri.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      URIish uri=(URIish)((IStructuredSelection)uriViewer.getSelection()).getFirstElement();
      config.removePushURI(uri);
      updateControls();
    }
  }
);
  uriViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      deleteUri.setEnabled(!uriViewer.getSelection().isEmpty());
      changeUri.setEnabled(((IStructuredSelection)uriViewer.getSelection()).size() == 1);
    }
  }
);
  final Group refSpecGroup=new Group(remoteGroup,SWT.SHADOW_ETCHED_IN);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(refSpecGroup);
  refSpecGroup.setText(UIText.SimpleConfigurePushDialog_RefMappingGroup);
  refSpecGroup.setLayout(new GridLayout(5,false));
  ExpandableComposite advanced=new ExpandableComposite(refSpecGroup,ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
  if (advancedMode)   advanced.setExpanded(true);
  advanced.setText(UIText.SimpleConfigurePushDialog_AdvancedButton);
  GridDataFactory.fillDefaults().align(SWT.BEGINNING,SWT.FILL).span(5,1).grab(true,false).applyTo(advanced);
  advanced.addExpansionListener(new ExpansionAdapter(){
    @Override public void expansionStateChanged(    ExpansionEvent e){
      Activator.getDefault().getPreferenceStore().setValue(ADVANCED_MODE_PREFERENCE,e.getState());
      GridData data=(GridData)changeRefSpec.getLayoutData();
      data.exclude=!e.getState();
      changeRefSpec.setVisible(!data.exclude);
      refSpecGroup.layout(true);
    }
  }
);
  Label refSpecLabel=new Label(refSpecGroup,SWT.NONE);
  refSpecLabel.setText(UIText.SimpleConfigurePushDialog_RefSpecLabel);
  GridDataFactory.fillDefaults().span(5,1).applyTo(refSpecLabel);
  specViewer=new TableViewer(refSpecGroup,SWT.BORDER | SWT.MULTI);
  specViewer.setContentProvider(ArrayContentProvider.getInstance());
  GridDataFactory.fillDefaults().span(5,1).grab(true,true).applyTo(specViewer.getTable());
  specViewer.getTable().addKeyListener(new KeyAdapter(){
    @Override public void keyPressed(    KeyEvent e){
      if (e.stateMask == SWT.MOD1 && e.keyCode == 'v') {
        doPaste();
      }
    }
  }
);
  addRefSpec=new Button(refSpecGroup,SWT.PUSH);
  addRefSpec.setText(UIText.SimpleConfigurePushDialog_AddRefSpecButton);
  addRefSpec.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      RefSpecDialog dlg=new RefSpecDialog(getShell(),repository,config,true);
      if (dlg.open() == Window.OK) {
        config.addPushRefSpec(dlg.getSpec());
      }
      updateControls();
    }
  }
);
  changeRefSpec=new Button(refSpecGroup,SWT.PUSH);
  changeRefSpec.setText(UIText.SimpleConfigurePushDialog_ChangeRefSpecButton);
  changeRefSpec.setEnabled(false);
  GridDataFactory.fillDefaults().exclude(!advancedMode).applyTo(changeRefSpec);
  changeRefSpec.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      RefSpec oldSpec=(RefSpec)((IStructuredSelection)specViewer.getSelection()).getFirstElement();
      RefSpecDialog dlg=new RefSpecDialog(getShell(),repository,config,oldSpec,true);
      if (dlg.open() == Window.OK) {
        config.removePushRefSpec(oldSpec);
        config.addPushRefSpec(dlg.getSpec());
      }
      updateControls();
    }
  }
);
  final Button deleteRefSpec=new Button(refSpecGroup,SWT.PUSH);
  deleteRefSpec.setText(UIText.SimpleConfigurePushDialog_DeleteRefSpecButton);
  deleteRefSpec.setEnabled(false);
  deleteRefSpec.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      for (      Object spec : ((IStructuredSelection)specViewer.getSelection()).toArray()) {
        config.removePushRefSpec((RefSpec)spec);
      }
      updateControls();
    }
  }
);
  final Button copySpec=new Button(refSpecGroup,SWT.PUSH);
  copySpec.setText(UIText.SimpleConfigurePushDialog_CopyRefSpecButton);
  copySpec.setEnabled(false);
  copySpec.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      String toCopy=((IStructuredSelection)specViewer.getSelection()).getFirstElement().toString();
      Clipboard clipboard=new Clipboard(getShell().getDisplay());
      try {
        clipboard.setContents(new String[]{toCopy},new TextTransfer[]{TextTransfer.getInstance()});
      }
  finally {
        clipboard.dispose();
      }
    }
  }
);
  final Button pasteSpec=new Button(refSpecGroup,SWT.PUSH);
  pasteSpec.setText(UIText.SimpleConfigurePushDialog_PasteRefSpecButton);
  pasteSpec.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      doPaste();
    }
  }
);
  addRefSpecAdvanced=new Button(advanced,SWT.PUSH);
  advanced.setClient(addRefSpecAdvanced);
  GridDataFactory.fillDefaults().align(SWT.BEGINNING,SWT.FILL).span(3,1).applyTo(addRefSpecAdvanced);
  addRefSpecAdvanced.setText(UIText.SimpleConfigurePushDialog_EditAdvancedButton);
  addRefSpecAdvanced.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (new WizardDialog(getShell(),new RefSpecWizard(repository,config,true)).open() == Window.OK)       updateControls();
    }
  }
);
  specViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      IStructuredSelection sel=(IStructuredSelection)specViewer.getSelection();
      copySpec.setEnabled(sel.size() == 1);
      changeRefSpec.setEnabled(sel.size() == 1);
      deleteRefSpec.setEnabled(!sel.isEmpty());
    }
  }
);
  applyDialogFont(main);
  return main;
}

Fixed version (ground truth):
@Override protected Control createDialogArea(Composite parent){
  boolean advancedMode=Activator.getDefault().getPreferenceStore().getBoolean(ADVANCED_MODE_PREFERENCE);
  final Composite main=new Composite(parent,SWT.NONE);
  main.setLayout(new GridLayout(1,false));
  GridDataFactory.fillDefaults().grab(true,true).applyTo(main);
  Composite repositoryGroup=new Composite(main,SWT.SHADOW_ETCHED_IN);
  repositoryGroup.setLayout(new GridLayout(2,false));
  GridDataFactory.fillDefaults().grab(true,true).applyTo(repositoryGroup);
  Label repositoryLabel=new Label(repositoryGroup,SWT.NONE);
  repositoryLabel.setText(UIText.SimpleConfigurePushDialog_RepositoryLabel);
  Text repositoryText=new Text(repositoryGroup,SWT.BORDER | SWT.READ_ONLY);
  GridDataFactory.fillDefaults().grab(true,false).applyTo(repositoryText);
  repositoryText.setText(Activator.getDefault().getRepositoryUtil().getRepositoryName(repository));
  Label branchLabel=new Label(repositoryGroup,SWT.NONE);
  branchLabel.setText(UIText.SimpleConfigurePushDialog_BranchLabel);
  String branch;
  try {
    branch=repository.getBranch();
  }
 catch (  IOException e2) {
    branch=null;
  }
  if (branch == null || ObjectId.isId(branch)) {
    branch=UIText.SimpleConfigurePushDialog_DetachedHeadMessage;
  }
  Text branchText=new Text(repositoryGroup,SWT.BORDER | SWT.READ_ONLY);
  GridDataFactory.fillDefaults().grab(true,false).applyTo(branchText);
  branchText.setText(branch);
  Group remoteGroup=new Group(main,SWT.SHADOW_ETCHED_IN);
  remoteGroup.setLayout(new GridLayout());
  GridDataFactory.fillDefaults().grab(true,true).applyTo(remoteGroup);
  remoteGroup.setText(NLS.bind(UIText.SimpleConfigurePushDialog_RemoteGroupTitle,config.getName()));
  addDefaultOriginWarningIfNeeded(remoteGroup);
  Group uriGroup=new Group(remoteGroup,SWT.SHADOW_ETCHED_IN);
  uriGroup.setLayout(new GridLayout(1,false));
  GridDataFactory.fillDefaults().grab(true,true).applyTo(uriGroup);
  uriGroup.setText(UIText.SimpleConfigurePushDialog_UriGroup);
  final Composite sameUriDetails=new Composite(uriGroup,SWT.NONE);
  sameUriDetails.setLayout(new GridLayout(4,false));
  GridDataFactory.fillDefaults().grab(true,false).applyTo(sameUriDetails);
  Label commonUriLabel=new Label(sameUriDetails,SWT.NONE);
  commonUriLabel.setText(UIText.SimpleConfigurePushDialog_URILabel);
  commonUriText=new Text(sameUriDetails,SWT.BORDER | SWT.READ_ONLY);
  GridDataFactory.fillDefaults().grab(true,false).applyTo(commonUriText);
  changeCommonUri=new Button(sameUriDetails,SWT.PUSH);
  changeCommonUri.setText(UIText.SimpleConfigurePushDialog_ChangeUriButton);
  changeCommonUri.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      SelectUriWizard wiz;
      if (commonUriText.getText().length() > 0)       wiz=new SelectUriWizard(false,commonUriText.getText());
 else       wiz=new SelectUriWizard(false);
      if (new WizardDialog(getShell(),wiz).open() == Window.OK) {
        if (commonUriText.getText().length() > 0)         try {
          config.removeURI(new URIish(commonUriText.getText()));
        }
 catch (        URISyntaxException ex) {
          Activator.handleError(ex.getMessage(),ex,true);
        }
        config.addURI(wiz.getUri());
        updateControls();
      }
    }
  }
);
  deleteCommonUri=new Button(sameUriDetails,SWT.PUSH);
  deleteCommonUri.setText(UIText.SimpleConfigurePushDialog_DeleteUriButton);
  deleteCommonUri.setEnabled(false);
  deleteCommonUri.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      config.removeURI(config.getURIs().get(0));
      updateControls();
    }
  }
);
  commonUriText.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      deleteCommonUri.setEnabled(commonUriText.getText().length() > 0);
    }
  }
);
  final Composite pushUriDetails=new Composite(uriGroup,SWT.NONE);
  pushUriDetails.setLayout(new GridLayout(3,false));
  GridDataFactory.fillDefaults().grab(true,true).applyTo(pushUriDetails);
  Label urisLabel=new Label(pushUriDetails,SWT.NONE);
  urisLabel.setText(UIText.SimpleConfigurePushDialog_PushUrisLabel);
  GridDataFactory.fillDefaults().span(3,1).applyTo(urisLabel);
  uriViewer=new TableViewer(pushUriDetails,SWT.BORDER | SWT.MULTI);
  GridDataFactory.fillDefaults().grab(true,true).span(3,1).minSize(SWT.DEFAULT,30).applyTo(uriViewer.getTable());
  uriViewer.setContentProvider(ArrayContentProvider.getInstance());
  Button addUri=new Button(pushUriDetails,SWT.PUSH);
  addUri.setText(UIText.SimpleConfigurePushDialog_AddPushUriButton);
  addUri.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      SelectUriWizard wiz=new SelectUriWizard(false);
      if (new WizardDialog(getShell(),wiz).open() == Window.OK) {
        config.addPushURI(wiz.getUri());
        updateControls();
      }
    }
  }
);
  final Button changeUri=new Button(pushUriDetails,SWT.PUSH);
  changeUri.setText(UIText.SimpleConfigurePushDialog_ChangePushUriButton);
  changeUri.setEnabled(false);
  changeUri.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      URIish uri=(URIish)((IStructuredSelection)uriViewer.getSelection()).getFirstElement();
      SelectUriWizard wiz=new SelectUriWizard(false,uri.toPrivateString());
      if (new WizardDialog(getShell(),wiz).open() == Window.OK) {
        config.removePushURI(uri);
        config.addPushURI(wiz.getUri());
        updateControls();
      }
    }
  }
);
  final Button deleteUri=new Button(pushUriDetails,SWT.PUSH);
  deleteUri.setText(UIText.SimpleConfigurePushDialog_DeletePushUriButton);
  deleteUri.setEnabled(false);
  deleteUri.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      URIish uri=(URIish)((IStructuredSelection)uriViewer.getSelection()).getFirstElement();
      config.removePushURI(uri);
      updateControls();
    }
  }
);
  uriViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      deleteUri.setEnabled(!uriViewer.getSelection().isEmpty());
      changeUri.setEnabled(((IStructuredSelection)uriViewer.getSelection()).size() == 1);
    }
  }
);
  final Group refSpecGroup=new Group(remoteGroup,SWT.SHADOW_ETCHED_IN);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(refSpecGroup);
  refSpecGroup.setText(UIText.SimpleConfigurePushDialog_RefMappingGroup);
  refSpecGroup.setLayout(new GridLayout(5,false));
  ExpandableComposite advanced=new ExpandableComposite(refSpecGroup,ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
  if (advancedMode)   advanced.setExpanded(true);
  advanced.setText(UIText.SimpleConfigurePushDialog_AdvancedButton);
  GridDataFactory.fillDefaults().align(SWT.BEGINNING,SWT.FILL).span(5,1).grab(true,false).applyTo(advanced);
  advanced.addExpansionListener(new ExpansionAdapter(){
    @Override public void expansionStateChanged(    ExpansionEvent e){
      Activator.getDefault().getPreferenceStore().setValue(ADVANCED_MODE_PREFERENCE,e.getState());
      GridData data=(GridData)changeRefSpec.getLayoutData();
      data.exclude=!e.getState();
      changeRefSpec.setVisible(!data.exclude);
      refSpecGroup.layout(true);
    }
  }
);
  Label refSpecLabel=new Label(refSpecGroup,SWT.NONE);
  refSpecLabel.setText(UIText.SimpleConfigurePushDialog_RefSpecLabel);
  GridDataFactory.fillDefaults().span(5,1).applyTo(refSpecLabel);
  specViewer=new TableViewer(refSpecGroup,SWT.BORDER | SWT.MULTI);
  specViewer.setContentProvider(ArrayContentProvider.getInstance());
  GridDataFactory.fillDefaults().span(5,1).grab(true,true).minSize(SWT.DEFAULT,30).applyTo(specViewer.getTable());
  specViewer.getTable().addKeyListener(new KeyAdapter(){
    @Override public void keyPressed(    KeyEvent e){
      if (e.stateMask == SWT.MOD1 && e.keyCode == 'v') {
        doPaste();
      }
    }
  }
);
  addRefSpec=new Button(refSpecGroup,SWT.PUSH);
  addRefSpec.setText(UIText.SimpleConfigurePushDialog_AddRefSpecButton);
  addRefSpec.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      RefSpecDialog dlg=new RefSpecDialog(getShell(),repository,config,true);
      if (dlg.open() == Window.OK) {
        config.addPushRefSpec(dlg.getSpec());
      }
      updateControls();
    }
  }
);
  changeRefSpec=new Button(refSpecGroup,SWT.PUSH);
  changeRefSpec.setText(UIText.SimpleConfigurePushDialog_ChangeRefSpecButton);
  changeRefSpec.setEnabled(false);
  GridDataFactory.fillDefaults().exclude(!advancedMode).applyTo(changeRefSpec);
  changeRefSpec.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      RefSpec oldSpec=(RefSpec)((IStructuredSelection)specViewer.getSelection()).getFirstElement();
      RefSpecDialog dlg=new RefSpecDialog(getShell(),repository,config,oldSpec,true);
      if (dlg.open() == Window.OK) {
        config.removePushRefSpec(oldSpec);
        config.addPushRefSpec(dlg.getSpec());
      }
      updateControls();
    }
  }
);
  final Button deleteRefSpec=new Button(refSpecGroup,SWT.PUSH);
  deleteRefSpec.setText(UIText.SimpleConfigurePushDialog_DeleteRefSpecButton);
  deleteRefSpec.setEnabled(false);
  deleteRefSpec.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      for (      Object spec : ((IStructuredSelection)specViewer.getSelection()).toArray()) {
        config.removePushRefSpec((RefSpec)spec);
      }
      updateControls();
    }
  }
);
  final Button copySpec=new Button(refSpecGroup,SWT.PUSH);
  copySpec.setText(UIText.SimpleConfigurePushDialog_CopyRefSpecButton);
  copySpec.setEnabled(false);
  copySpec.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      String toCopy=((IStructuredSelection)specViewer.getSelection()).getFirstElement().toString();
      Clipboard clipboard=new Clipboard(getShell().getDisplay());
      try {
        clipboard.setContents(new String[]{toCopy},new TextTransfer[]{TextTransfer.getInstance()});
      }
  finally {
        clipboard.dispose();
      }
    }
  }
);
  final Button pasteSpec=new Button(refSpecGroup,SWT.PUSH);
  pasteSpec.setText(UIText.SimpleConfigurePushDialog_PasteRefSpecButton);
  pasteSpec.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      doPaste();
    }
  }
);
  addRefSpecAdvanced=new Button(advanced,SWT.PUSH);
  advanced.setClient(addRefSpecAdvanced);
  GridDataFactory.fillDefaults().align(SWT.BEGINNING,SWT.FILL).span(3,1).applyTo(addRefSpecAdvanced);
  addRefSpecAdvanced.setText(UIText.SimpleConfigurePushDialog_EditAdvancedButton);
  addRefSpecAdvanced.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (new WizardDialog(getShell(),new RefSpecWizard(repository,config,true)).open() == Window.OK)       updateControls();
    }
  }
);
  specViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      IStructuredSelection sel=(IStructuredSelection)specViewer.getSelection();
      copySpec.setEnabled(sel.size() == 1);
      changeRefSpec.setEnabled(sel.size() == 1);
      deleteRefSpec.setEnabled(!sel.isEmpty());
    }
  }
);
  applyDialogFont(main);
  return main;
}