Skip to content
This repository has been archived by the owner on Jul 13, 2022. It is now read-only.

Commit

Permalink
Ensure valid URL syntax for Template Project URL after editing
Browse files Browse the repository at this point in the history
  • Loading branch information
katesherwood committed Jun 25, 2012
1 parent c631fab commit 4506867
Showing 1 changed file with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,21 +249,27 @@ public void widgetSelected(SelectionEvent e) {
if (dialog.open() == Dialog.OK) {
String urlString = dialog.getUrlString();
String name = dialog.getName();
if (!validateUrl(urlString)) {
String title = NLS.bind("Invalid URL", null);
MessageDialog.openError(null, title, validationErrorMessage(urlString));
}
else {

if (name.length() > 0 && urlString.length() > 0) {
try {
if (oldNameUrl != null) {
model.removeNameUrlPairInEncodedString(oldNameUrl);
if (name.length() > 0 && urlString.length() > 0) {
try {
if (oldNameUrl != null) {
model.removeNameUrlPairInEncodedString(oldNameUrl);
}
model.addNameUrlPairInEncodedString(new NameUrlPair(name, urlString));
tableViewer.refresh();
// the tableViewer refresh deselects the line,
// so disable the buttons
editButton.setEnabled(false);
removeButton.setEnabled(false);
}
catch (URISyntaxException e1) {
errorText.setText("Error! The URL " + urlString + " was malformed. Ignoring.");
}
model.addNameUrlPairInEncodedString(new NameUrlPair(name, urlString));
tableViewer.refresh();
// the tableViewer refresh deselects the line, so
// disable the buttons
editButton.setEnabled(false);
removeButton.setEnabled(false);
}
catch (URISyntaxException e1) {
errorText.setText("Error! The URL " + urlString + " was malformed. Ignoring.");
}
}
}
Expand Down

0 comments on commit 4506867

Please sign in to comment.