Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Also check the license the each time 'Custom' is selected
  • Loading branch information
egonw committed Oct 4, 2011
1 parent c332f2d commit d1e67a0
Showing 1 changed file with 20 additions and 17 deletions.
Expand Up @@ -163,6 +163,7 @@ else if (cbo.getSelectionIndex()==4){
}
else if (cbo.getSelectionIndex()==5){
customLicense.setEnabled(true);
checkCustomLicense(customLicense.getText());
}
else{
System.out.println("license combo OUT OF BOUNDS");
Expand All @@ -181,23 +182,7 @@ else if (cbo.getSelectionIndex()==5){
customLicense.setEnabled(false); // by default license is CC0, not 'Custom'
customLicense.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
String customURL = customLicense.getText();
if (customURL.length() > 0) {
try {
URL url = new URL(customURL);
if (url.getHost().length() > 0) {
setErrorMessage(null);
setPageComplete(true);
((CreateDatasetWizard)getWizard()).setLicense(
customLicense.getText()
);
return;
}
} catch (Exception e1) {}
}
setErrorMessage("Custom license must be a valid URL.");
setPageComplete(false);
((CreateDatasetWizard)getWizard()).setLicense(null);
checkCustomLicense(customLicense.getText());
}
});
customLicense.setText("");
Expand All @@ -207,6 +192,24 @@ public void modifyText(ModifyEvent e) {
dialogChanged();
}

private void checkCustomLicense(String customURL) {
if (customURL.length() > 0) {
try {
URL url = new URL(customURL);
if (url.getHost().length() > 0) {
setErrorMessage(null);
setPageComplete(true);
((CreateDatasetWizard)getWizard()).setLicense(
customLicense.getText()
);
return;
}
} catch (Exception e1) {}
}
setErrorMessage("Custom license must be a valid URL.");
setPageComplete(false);
((CreateDatasetWizard)getWizard()).setLicense(null);
}

private void dialogChanged() {
if (txtTitle.getText().isEmpty()){
Expand Down

0 comments on commit d1e67a0

Please sign in to comment.