}
/** {@inheritDoc} */
public Collection<String> getMenuCategories() {
List<String> menuCategories = new LinkedList<String>();
BeanDescriptor bd = beanInfo.getBeanDescriptor();
// We don't want to show expert beans in the menus unless we're
// in expert mode:
if (bd.isExpert() && !JMeterUtils.isExpertMode()) {
return null;
}
int matches = 0; // How many classes can we assign from?
// TODO: there must be a nicer way...
if (Assertion.class.isAssignableFrom(testBeanClass)) {
menuCategories.add(MenuFactory.ASSERTIONS);
bd.setValue(TestElement.GUI_CLASS, AbstractAssertionGui.class.getName());
matches++;
}
if (ConfigElement.class.isAssignableFrom(testBeanClass)) {
menuCategories.add(MenuFactory.CONFIG_ELEMENTS);
bd.setValue(TestElement.GUI_CLASS, AbstractConfigGui.class.getName());
matches++;
}
if (Controller.class.isAssignableFrom(testBeanClass)) {
menuCategories.add(MenuFactory.CONTROLLERS);
bd.setValue(TestElement.GUI_CLASS, AbstractControllerGui.class.getName());
matches++;
}
if (Visualizer.class.isAssignableFrom(testBeanClass)) {
menuCategories.add(MenuFactory.LISTENERS);
bd.setValue(TestElement.GUI_CLASS, AbstractVisualizer.class.getName());
matches++;
}
if (PostProcessor.class.isAssignableFrom(testBeanClass)) {
menuCategories.add(MenuFactory.POST_PROCESSORS);
bd.setValue(TestElement.GUI_CLASS, AbstractPostProcessorGui.class.getName());
matches++;
}
if (PreProcessor.class.isAssignableFrom(testBeanClass)) {
matches++;
menuCategories.add(MenuFactory.PRE_PROCESSORS);
bd.setValue(TestElement.GUI_CLASS, AbstractPreProcessorGui.class.getName());
}
if (Sampler.class.isAssignableFrom(testBeanClass)) {
matches++;
menuCategories.add(MenuFactory.SAMPLERS);
bd.setValue(TestElement.GUI_CLASS, AbstractSamplerGui.class.getName());
}
if (Timer.class.isAssignableFrom(testBeanClass)) {
matches++;
menuCategories.add(MenuFactory.TIMERS);
bd.setValue(TestElement.GUI_CLASS, AbstractTimerGui.class.getName());
}
if (matches == 0) {
log.error("Could not assign GUI class to " + testBeanClass.getName());
} else if (matches > 1) {// may be impossible, but no harm in
// checking ...