New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't display TestBeanGui items which are flagged as hidden #2641
Comments
Sebb (migrated from Bugzilla): That's the format generated by SVN and Eclipse (and various other tools). |
stef (migrated from Bugzilla): Stef Created attachment MenuFactory.diff: Patch in unified diff format MenuFactory.diff# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
--- C:\JMeter\old\src\org\apache\jmeter\gui\util\MenuFactory.java
+++ C:\JMeter\new\src\org\apache\jmeter\gui\util\MenuFactory.java
@@ -19,6 +19,8 @@
package org.apache.jmeter.gui.util;
import java.awt.Component;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
import java.io.IOException;
import java.io.Serializable;
import java.util.Collection;
@@ -436,11 +438,19 @@
continue;
}
+ //Handle BeanDescriptor hidden property
+ boolean isHiddenBean = false;
+
JMeterGUIComponent item;
try {
Class<?> c = Class.forName(name);
if (TestBean.class.isAssignableFrom(c)) {
item = new TestBeanGUI(c);
+ try {
+ isHiddenBean = Introspector.getBeanInfo(c).getBeanDescriptor().isHidden();
+ } catch (IntrospectionException e) {
+ log.warn("Cannot get bean info from class " + name + ". " + e);
+ }
} else {
item = (JMeterGUIComponent) c.newInstance();
}
@@ -457,7 +467,7 @@
}
continue;
}
- if (elementsToSkip.contains(item.getStaticLabel())) {
+ if (elementsToSkip.contains(item.getStaticLabel()) || isHiddenBean) {
log.info("Skipping " + name);
continue;
} else { |
Sebb (migrated from Bugzilla): However, the patch uses path names that don't exist in the JMeter project: --- C:\JMeter\old\src\org\apache\jmeter\gui\util\MenuFactory.java I would expect the patch to have a header such as: Index: src/core/org/apache/jmeter/gui/util/MenuFactory.java--- src/core/org/apache/jmeter/gui/util/MenuFactory.java (revision 1199781) Note that the file is under src/core/org/..., not src/org/... Luckily that is relatively easy to fix, but please ensure any future patches are generated relative to the JMeter root directory. == I applied a variation of the fix so that GUIs are treated the same as properties within the GUIs. URL: http://svn.apache.org/viewvc?rev=1199895&view=rev Modified: |
stef (migrated from Bugzilla): Great thanks! Stef |
stef (Bug 52160):
In order to hide programmatically a test bean from add menu, it would be nice if jmetter checks the BeanDescriptor hidden flag and not add the item to menu if true.
Find attached the patch to enable the feature, based on trunk r1199633.
Stef
Created attachment MenuFactory.zip: MenuFactory patch to enable the feature
OS: All
The text was updated successfully, but these errors were encountered: