1 | JPopupMenu getDefaultSamplerMenu() {↵ | | 1 | JPopupMenu getDefaultControllerMenu() {↵
|
2 | JPopupMenu pop = new JPopupMenu();↵ | | 2 | JPopupMenu pop = new JPopupMenu();↵
|
3 | pop.add(MenuFactory.makeMenus(MENU_ADD_SAMPLER, ↵ | | 3 | pop.add(MenuFactory.makeMenus(MENU_ADD_CONTROLLER,↵
|
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_SAMPLER, ↵ | | 6 | pop.add(makeMenus(MENU_PARENT_CONTROLLER, ↵
|
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 | /**↵ | | 43 | ↵
|
44 | * Create a menu from a menu category.↵ | | |
|
45 | * ↵ | | |
|
46 | * @param category - predefined string (used as key for menuMap HashMap and messages.properties lookup)↵ | | |
|
47 | * @param actionCommand - predefined string, e.g. ActionNames.ADD↵ | | |
|
48 | * @see org.apache.jmeter.gui.action.ActionNames↵ | | |
|
49 | * @return the menu↵ | | |
|
50 | */↵ | | |
|
51 | public static JMenu makeMenu(String category, String actionCommand) {↵ | | |
|
52 | return makeMenu((Collection) menuMap.get(category), actionCommand, JMeterUtils.getResString(category));↵ | | |
|
53 | }↵ | | |
|
|
54 | /**↵ | | |
|
55 | * Create a menu from a collection of items.↵ | | |
|
56 | * ↵ | | |
|
57 | * @param menuInfo - collection of MenuInfo items↵ | | |
|
58 | * @param actionCommand - predefined string, e.g. ActionNames.ADD↵ | | |
|
59 | * @see org.apache.jmeter.gui.action.ActionNames↵ | | |
|
60 | * @param menuName↵ | | |
|
61 | * @return the menu↵ | | |
|
62 | */↵ | | 44 | public static JMenu makeMenu(String category, String actionCommand) {↵
|
| | | 45 | return makeMenu((Collection) menuMap.get(category), actionCommand, JMeterUtils.getResString(category));↵
|
| | | 46 | }↵
|
|
63 | public static JMenu makeMenu(Collection menuInfo, String actionCommand, String menuName) {↵ | | 47 | public static JMenu makeMenu(Collection menuInfo, String actionCommand, String menuName) {↵
|
64 | Iterator iter = menuInfo.iterator();↵ | | 48 | Iterator iter = menuInfo.iterator();↵
|
65 | JMenu menu = new JMenu(menuName);↵ | | 49 | JMenu menu = new JMenu(menuName);↵
|
66 | while (iter.hasNext()) {↵ | | 50 | while (iter.hasNext()) {↵
|
67 | MenuInfo info = (MenuInfo) iter.next();↵ | | 51 | MenuInfo info = (MenuInfo) iter.next();↵
|
68 | menu.add(makeMenuItem(info.label, info.className, actionCommand));↵ | | 52 | menu.add(makeMenuItem(info.label, info.className, actionCommand));↵
|
69 | }↵ | | 53 | }↵
|
70 | return menu;↵ | | 54 | return menu;↵
|
71 | }↵ | | 55 | }↵
|
|
72 | public static void setEnabled(JMenu menu) {↵ | | 56 | public static void setEnabled(JMenu menu) {↵
|
73 | if (menu.getSubElements().length == 0) {↵ | | 57 | if (menu.getSubElements().length == 0) {↵
|
74 | menu.setEnabled(false);↵ | | 58 | menu.setEnabled(false);↵
|
75 | }↵ | | 59 | }↵
|
76 | }↵ | | 60 | }↵
|
|
77 | /**↵ | | |
|
78 | * Create a single menu item↵ | | |
|
79 | * ↵ | | |
|
80 | * @param label for the MenuItem↵ | | |
|
81 | * @param name for the MenuItem↵ | | |
|
82 | * @param actionCommand - predefined string, e.g. ActionNames.ADD↵ | | |
|
83 | * @see org.apache.jmeter.gui.action.ActionNames↵ | | |
|
84 | * @return the menu item↵ | | |
|
85 | */↵ | | |
|
86 | public static JMenuItem makeMenuItem(String label, String name, String actionCommand) {↵ | | 61 | public static JMenuItem makeMenuItem(String label, String name, String actionCommand) {↵
|
87 | JMenuItem newMenuChoice = new JMenuItem(label);↵ | | 62 | JMenuItem newMenuChoice = new JMenuItem(label);↵
|
88 | newMenuChoice.setName(name);↵ | | 63 | newMenuChoice.setName(name);↵
|
89 | newMenuChoice.addActionListener(ActionRouter.getInstance());↵ | | 64 | newMenuChoice.addActionListener(ReportActionRouter.getInstance());↵
|
90 | if (actionCommand != null) {↵ | | 65 | if (actionCommand != null) {↵
|
91 | newMenuChoice.setActionCommand(actionCommand);↵ | | 66 | newMenuChoice.setActionCommand(actionCommand);↵
|
92 | }↵ | | 67 | }↵
|
|
93 | return newMenuChoice;↵ | | 68 | return newMenuChoice;↵
|
94 | }↵ | | 69 | }↵
|
|
95 | public static JMenuItem makeMenuItem(String label, String name, String actionCommand, KeyStroke accel) {↵ | | 70 | public static JMenuItem makeMenuItem(String label, String name, String actionCommand, KeyStroke accel) {↵
|
96 | JMenuItem item = makeMenuItem(label, name, actionCommand);↵ | | 71 | JMenuItem item = makeMenuItem(label, name, actionCommand);↵
|
97 | item.setAccelerator(accel);↵ | | 72 | item.setAccelerator(accel);↵
|
98 | return item;↵ | | 73 | return item;↵
|
99 | }↵ | | 74 | }↵
|
|
100 | private static void initializeMenus() {↵ | | 75 | private static void initializeMenus() {↵
|
101 | try {↵ | | 76 | try {↵
|
102 | List guiClasses = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(), new Class[] {↵ | | 77 | List guiClasses = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(), new Class[] {↵
|
103 | JMeterGUIComponent.class, TestBean.class });↵ | | 78 | JMeterGUIComponent.class, TestBean.class });↵
|
104 | timers = new LinkedList();↵ | | 79 | controllers = new LinkedList();↵
|
105 | controllers = new LinkedList();↵ | | 80 | configElements = new LinkedList();↵
|
106 | samplers = new LinkedList();↵ | | 81 | listeners = new LinkedList();↵
|
107 | configElements = new LinkedList();↵ | | 82 | postProcessors = new LinkedList();↵
|
108 | assertions = new LinkedList();↵ | | 83 | preProcessors = new LinkedList();↵
|
109 | listeners = new LinkedList();↵ | | 84 | tables = new LinkedList();↵
|
110 | postProcessors = new LinkedList();↵ | | 85 | reportPage = new LinkedList();↵
|
111 | preProcessors = new LinkedList(); | | 86 | nonTestElements = new LinkedList();
|