converter = new IFormValueConverter()
{
public String getLabel(Object value)
{
IRequiredBundle b = (IRequiredBundle) value;
return b == null ? null : b.getSymbolicName() + " " + b.getVersions();
}
public Object getValue(String label)
{
return null;
}
};
fragmentHostEntry = new SigilFormEntry(body, toolkit, "Fragment Host",
"Browse...", converter);
fragmentHostEntry.setFormEntryListener(new SigilFormEntryAdapter()
{
@Override
public void textValueChanged(SigilFormEntry form)
{
fragmentHost = (IRequiredBundle) form.getValue();
checkDirty();
}
@Override
public void browseButtonSelected(SigilFormEntry form)
{
NewResourceSelectionDialog<IBundleModelElement> dialog = ResourcesDialogHelper.createRequiredBundleDialog(
getSection().getShell(), "Add Required Bundle", getProjectModel(),
null, getBundle().getBundleInfo().getRequiredBundles());
if (dialog.open() == Window.OK)
{
IRequiredBundle required = ModelElementFactory.getInstance().newModelElement(
IRequiredBundle.class);
required.setSymbolicName(dialog.getSelectedName());
required.setVersions(dialog.getSelectedVersions());
form.setValue(required);
}
}
});
fragmentHostEntry.setFreeText(false);