LicenseWizard wizard = new LicenseWizard(null);
if (wizard != null) {
WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
dialog.open();
if (dialog.getReturnCode() == Dialog.OK) {
LicenseType newLicense = wizard.getLicense();
pluginType.getLicense().add(newLicense);
loadMetadata(pluginType);
activateButtons();
}
}
}
});
editLicenseButton = createPushButton(licenseButtonComposite, CommonMessages.edit);
editLicenseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
LicenseType oldLicense = (LicenseType)licenseTable.getItem(licenseTable.getSelectionIndex()).getData();
LicenseWizard wizard = new LicenseWizard(oldLicense);
if (wizard != null) {
WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
dialog.open();
if (dialog.getReturnCode() == Dialog.OK) {
LicenseType newLicense = wizard.getLicense();
int index = pluginType.getLicense().indexOf(oldLicense);
pluginType.getLicense().remove(index);
pluginType.getLicense().add(index, newLicense);
loadMetadata(pluginType);
activateButtons();
}
}
}
});
removeLicenseButton = createPushButton(licenseButtonComposite, CommonMessages.remove);
removeLicenseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
LicenseType license;
license = (LicenseType)licenseTable.getItem(licenseTable.getSelectionIndex()).getData();
pluginType.getLicense().remove(license);
loadMetadata(pluginType);
activateButtons();
}