// create a menu-entry in the sub-menu for each custom feature
IFeatureProvider fp = getFeatureProvider();
ICustomFeature[] customFeatures = fp.getCustomFeatures(context);
for (int i = 0; i < customFeatures.length; i++) {
ICustomFeature customFeature = customFeatures[i];
if (customFeature.isAvailable(context)) {
ContextMenuEntry menuEntry = new ContextMenuEntry(customFeature, context);
entries.add(menuEntry);
}
}