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);
}
});
ExpandableComposite pushUriArea = new ExpandableComposite(main,
ExpandableComposite.TREE_NODE
| ExpandableComposite.CLIENT_INDENT);
GridDataFactory.fillDefaults().grab(true, false).applyTo(pushUriArea);
pushUriArea.setExpanded(!config.getPushURIs().isEmpty());
pushUriArea.addExpansionListener(new ExpansionAdapter() {
public void expansionStateChanged(ExpansionEvent e) {
main.layout(true, true);
main.getShell().pack();
}
});
pushUriArea.setText(UIText.SimpleConfigurePushDialog_PushUrisLabel);
final Composite pushUriDetails = new Composite(pushUriArea, SWT.NONE);
pushUriArea.setClient(pushUriDetails);
pushUriDetails.setLayout(new GridLayout(2, false));
GridDataFactory.fillDefaults().grab(true, true).applyTo(pushUriDetails);
uriViewer = new TableViewer(pushUriDetails, SWT.BORDER | SWT.MULTI);
GridDataFactory.fillDefaults().grab(true, true)
.minSize(SWT.DEFAULT, 30).applyTo(uriViewer.getTable());
uriViewer.setContentProvider(ArrayContentProvider.getInstance());
final Composite uriButtonArea = new Composite(pushUriDetails, SWT.NONE);
GridLayoutFactory.fillDefaults().applyTo(uriButtonArea);
GridDataFactory.fillDefaults().grab(false, true).applyTo(uriButtonArea);
Button addUri = new Button(uriButtonArea, SWT.PUSH);
addUri.setText(UIText.SimpleConfigurePushDialog_AddPushUriButton);
GridDataFactory.fillDefaults().applyTo(addUri);
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(uriButtonArea, SWT.PUSH);
changeUri.setText(UIText.SimpleConfigurePushDialog_ChangePushUriButton);
GridDataFactory.fillDefaults().applyTo(changeUri);
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(uriButtonArea, SWT.PUSH);