1 | JPopupMenu getDefaultControllerMenu() {↵ | | 1 | JPopupMenu getDefaultSamplerMenu() {↵
|
2 | JPopupMenu pop = new JPopupMenu();↵ | | 2 | JPopupMenu pop = new JPopupMenu();↵
|
3 | pop.add(MenuFactory.makeMenus(MENU_ADD_CONTROLLER,↵ | | 3 | pop.add(MenuFactory.makeMenus(MENU_ADD_SAMPLER, ↵
|
4 | JMeterUtils.getResString("add"),// $NON-NLS-1$↵ | | 4 | JMeterUtils.getResString("add"),// $NON-NLS-1$↵
|
5 | ActionNames.ADD));↵ | | 5 | ActionNames.ADD));↵
|
6 | pop.add(makeMenus(MENU_PARENT_CONTROLLER, ↵ | | 6 | pop.add(makeMenus(MENU_PARENT_SAMPLER, ↵
|
7 | JMeterUtils.getResString("insert_parent"),// $NON-NLS-1$↵ | | 7 | JMeterUtils.getResString("insert_parent"),// $NON-NLS-1$↵
|
8 | ActionNames.ADD_PARENT));↵ | | 8 | ActionNames.ADD_PARENT));↵
|
9 | MenuFactory.addEditMenu(pop, true);↵ | | 9 | MenuFactory.addEditMenu(pop, true);↵
|
10 | MenuFactory.addFileMenu(pop);↵ | | 10 | MenuFactory.addFileMenu(pop);↵
|
11 | return pop;↵ | | 11 | return pop;↵
|
12 | }↵ | | 12 | }↵
|
|
13 | public static JPopupMenu getDefaultConfigElementMenu() {↵ | | 13 | public static JPopupMenu getDefaultConfigElementMenu() {↵
|
14 | JPopupMenu pop = new JPopupMenu();↵ | | 14 | JPopupMenu pop = new JPopupMenu();↵
|
15 | MenuFactory.addEditMenu(pop, true);↵ | | 15 | MenuFactory.addEditMenu(pop, true);↵
|
16 | MenuFactory.addFileMenu(pop);↵ | | 16 | MenuFactory.addFileMenu(pop);↵
|
17 | return pop;↵ | | 17 | return pop;↵
|
18 | }↵ | | 18 | }↵
|
|
19 | public static JPopupMenu getDefaultVisualizerMenu() {↵ | | 19 | public static JPopupMenu getDefaultVisualizerMenu() {↵
|
20 | JPopupMenu pop = new JPopupMenu();↵ | | 20 | JPopupMenu pop = new JPopupMenu();↵
|
21 | MenuFactory.addEditMenu(pop, true);↵ | | 21 | MenuFactory.addEditMenu(pop, true);↵
|
22 | MenuFactory.addFileMenu(pop);↵ | | 22 | MenuFactory.addFileMenu(pop);↵
|
23 | return pop;↵ | | 23 | return pop;↵
|
24 | }↵ | | 24 | }↵
|
|
25 | public static JPopupMenu getDefaultTimerMenu() {↵ | | 25 | public static JPopupMenu getDefaultTimerMenu() {↵
|
26 | JPopupMenu pop = new JPopupMenu();↵ | | 26 | JPopupMenu pop = new JPopupMenu();↵
|
27 | MenuFactory.addEditMenu(pop, true);↵ | | 27 | MenuFactory.addEditMenu(pop, true);↵
|
28 | MenuFactory.addFileMenu(pop);↵ | | 28 | MenuFactory.addFileMenu(pop);↵
|
29 | return pop;↵ | | 29 | return pop;↵
|
30 | }↵ | | 30 | }↵
|
|
31 | public static JPopupMenu getDefaultAssertionMenu() {↵ | | 31 | public static JPopupMenu getDefaultAssertionMenu() {↵
|
32 | JPopupMenu pop = new JPopupMenu();↵ | | 32 | JPopupMenu pop = new JPopupMenu();↵
|
33 | MenuFactory.addEditMenu(pop, true);↵ | | 33 | MenuFactory.addEditMenu(pop, true);↵
|
34 | MenuFactory.addFileMenu(pop);↵ | | 34 | MenuFactory.addFileMenu(pop);↵
|
35 | return pop;↵ | | 35 | return pop;↵
|
36 | }↵ | | 36 | }↵
|
|
37 | public static JPopupMenu getDefaultExtractorMenu() {↵ | | 37 | public static JPopupMenu getDefaultExtractorMenu() {↵
|
38 | JPopupMenu pop = new JPopupMenu();↵ | | 38 | JPopupMenu pop = new JPopupMenu();↵
|
39 | MenuFactory.addEditMenu(pop, true);↵ | | 39 | MenuFactory.addEditMenu(pop, true);↵
|
40 | MenuFactory.addFileMenu(pop);↵ | | 40 | MenuFactory.addFileMenu(pop);↵
|
41 | return pop;↵ | | 41 | return pop;↵
|
42 | }↵ | | 42 | }↵
|
|
43 | public static JMenu makeMenu(String category, String actionCommand) {↵ | | 43 | ↵
|
44 | return makeMenu((Collection) menuMap.get(category), actionCommand, JMeterUtils.getResString(category));↵ | | |
|
45 | }↵ | | |
|
| | | 44 | /**↵
|
| | | 45 | * Create a menu from a menu category.↵
|
| | | 46 | * ↵
|
| | | 47 | * @param category - predefined string (used as key for menuMap HashMap and messages.properties lookup)↵
|
| | | 48 | * @param actionCommand - predefined string, e.g. ActionNames.ADD↵
|
| | | 49 | * @see org.apache.jmeter.gui.action.ActionNames↵
|
| | | 50 | * @return the menu↵
|
| | | 51 | */↵
|
| | | 52 | public static JMenu makeMenu(String category, String actionCommand) {↵
|
| | | 53 | return makeMenu((Collection) menuMap.get(category), actionCommand, JMeterUtils.getResString(category));↵
|
| | | 54 | }↵
|
|
| | | 55 | /**↵
|
| | | 56 | * Create a menu from a collection of items.↵
|
| | | 57 | * ↵
|
| | | 58 | * @param menuInfo - collection of MenuInfo items↵
|
| | | 59 | * @param actionCommand - predefined string, e.g. ActionNames.ADD↵
|
| | | 60 | * @see org.apache.jmeter.gui.action.ActionNames↵
|
| | | 61 | * @param menuName↵
|
| | | 62 | * @return the menu↵
|
| | | 63 | */↵
|
46 | public static JMenu makeMenu(Collection menuInfo, String actionCommand, String menuName) {↵ | | 64 | public static JMenu makeMenu(Collection menuInfo, String actionCommand, String menuName) {↵
|
47 | Iterator iter = menuInfo.iterator();↵ | | 65 | Iterator iter = menuInfo.iterator();↵
|
48 | JMenu menu = new JMenu(menuName);↵ | | 66 | JMenu menu = new JMenu(menuName);↵
|
49 | while (iter.hasNext()) {↵ | | 67 | while (iter.hasNext()) {↵
|
50 | MenuInfo info = (MenuInfo) iter.next();↵ | | 68 | MenuInfo info = (MenuInfo) iter.next();↵
|
51 | menu.add(makeMenuItem(info.label, info.className, actionCommand));↵ | | 69 | menu.add(makeMenuItem(info.label, info.className, actionCommand));↵
|
52 | }↵ | | 70 | }↵
|
53 | return menu;↵ | | 71 | return menu;↵
|
54 | }↵ | | 72 | }↵
|
|
55 | public static void setEnabled(JMenu menu) {↵ | | 73 | public static void setEnabled(JMenu menu) {↵
|
56 | if (menu.getSubElements().length == 0) {↵ | | 74 | if (menu.getSubElements().length == 0) {↵
|
57 | menu.setEnabled(false);↵ | | 75 | menu.setEnabled(false);↵
|
58 | }↵ | | 76 | }↵
|
59 | }↵ | | 77 | }↵
|
|
| | | 78 | /**↵
|
| | | 79 | * Create a single menu item↵
|
| | | 80 | * ↵
|
| | | 81 | * @param label for the MenuItem↵
|
| | | 82 | * @param name for the MenuItem↵
|
| | | 83 | * @param actionCommand - predefined string, e.g. ActionNames.ADD↵
|
| | | 84 | * @see org.apache.jmeter.gui.action.ActionNames↵
|
| | | 85 | * @return the menu item↵
|
| | | 86 | */↵
|
60 | public static JMenuItem makeMenuItem(String label, String name, String actionCommand) {↵ | | 87 | public static JMenuItem makeMenuItem(String label, String name, String actionCommand) {↵
|
61 | JMenuItem newMenuChoice = new JMenuItem(label);↵ | | 88 | JMenuItem newMenuChoice = new JMenuItem(label);↵
|
62 | newMenuChoice.setName(name);↵ | | 89 | newMenuChoice.setName(name);↵
|
63 | newMenuChoice.addActionListener(ReportActionRouter.getInstance());↵ | | 90 | newMenuChoice.addActionListener(ActionRouter.getInstance());↵
|
64 | if (actionCommand != null) {↵ | | 91 | if (actionCommand != null) {↵
|
65 | newMenuChoice.setActionCommand(actionCommand);↵ | | 92 | newMenuChoice.setActionCommand(actionCommand);↵
|
66 | }↵ | | 93 | }↵
|
|
67 | return newMenuChoice;↵ | | 94 | return newMenuChoice;↵
|
68 | }↵ | | 95 | }↵
|
|
69 | public static JMenuItem makeMenuItem(String label, String name, String actionCommand, KeyStroke accel) {↵ | | 96 | public static JMenuItem makeMenuItem(String label, String name, String actionCommand, KeyStroke accel) {↵
|
70 | JMenuItem item = makeMenuItem(label, name, actionCommand);↵ | | 97 | JMenuItem item = makeMenuItem(label, name, actionCommand);↵
|
71 | item.setAccelerator(accel);↵ | | 98 | item.setAccelerator(accel);↵
|
72 | return item;↵ | | 99 | return item;↵
|
73 | }↵ | | 100 | }↵
|
|
74 | private static void initializeMenus() {↵ | | 101 | private static void initializeMenus() {↵
|
75 | try {↵ | | 102 | try {↵
|
76 | List guiClasses = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(), new Class[] {↵ | | 103 | List guiClasses = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(), new Class[] {↵
|
77 | JMeterGUIComponent.class, TestBean.class });↵ | | 104 | JMeterGUIComponent.class, TestBean.class });↵
|
78 | controllers = new LinkedList();↵ | | 105 | timers = new LinkedList();↵
|
79 | configElements = new LinkedList();↵ | | 106 | controllers = new LinkedList();↵
|
80 | listeners = new LinkedList();↵ | | 107 | samplers = new LinkedList();↵
|
81 | postProcessors = new LinkedList();↵ | | 108 | configElements = new LinkedList();↵
|
82 | preProcessors = new LinkedList();↵ | | 109 | assertions = new LinkedList();↵
|
83 | tables = new LinkedList();↵ | | 110 | listeners = new LinkedList();↵
|
84 | reportPage = new LinkedList();↵ | | 111 | postProcessors = new LinkedList();↵
|
85 | nonTestElements = new LinkedList() | | 112 | preProcessors = new LinkedList()
|