Search in sources :

Example 31 with JPopupMenu

use of javax.swing.JPopupMenu in project jmeter by apache.

the class WorkBenchGui method createPopupMenu.

/**
     * When a user right-clicks on the component in the test tree, or selects
     * the edit menu when the component is selected, the component will be asked
     * to return a JPopupMenu that provides all the options available to the
     * user from this component.
     * <p>
     * The WorkBench returns a popup menu allowing you to add anything.
     *
     * @return a JPopupMenu appropriate for the component.
     */
@Override
public JPopupMenu createPopupMenu() {
    JPopupMenu menu = new JPopupMenu();
    JMenu addMenu = MenuFactory.makeMenus(new String[] { MenuFactory.NON_TEST_ELEMENTS, MenuFactory.CONTROLLERS, MenuFactory.CONFIG_ELEMENTS, MenuFactory.TIMERS, MenuFactory.PRE_PROCESSORS, MenuFactory.SAMPLERS, MenuFactory.POST_PROCESSORS, MenuFactory.ASSERTIONS, MenuFactory.LISTENERS }, // $NON-NLS-1$
    JMeterUtils.getResString("add"), ActionNames.ADD);
    menu.add(addMenu);
    MenuFactory.addPasteResetMenu(menu);
    MenuFactory.addFileMenu(menu);
    return menu;
}
Also used : JPopupMenu(javax.swing.JPopupMenu) JMenu(javax.swing.JMenu)

Example 32 with JPopupMenu

use of javax.swing.JPopupMenu in project jmeter by apache.

the class TestPlanGui method createPopupMenu.

/**
     * When a user right-clicks on the component in the test tree, or selects
     * the edit menu when the component is selected, the component will be asked
     * to return a JPopupMenu that provides all the options available to the
     * user from this component.
     * <p>
     * The TestPlan will return a popup menu allowing you to add ThreadGroups,
     * Listeners, Configuration Elements, Assertions, PreProcessors,
     * PostProcessors, and Timers.
     *
     * @return a JPopupMenu appropriate for the component.
     */
@Override
public JPopupMenu createPopupMenu() {
    JPopupMenu pop = new JPopupMenu();
    // $NON-NLS-1$
    JMenu addMenu = new JMenu(JMeterUtils.getResString("add"));
    addMenu.add(MenuFactory.makeMenu(MenuFactory.THREADS, ActionNames.ADD));
    addMenu.add(MenuFactory.makeMenu(MenuFactory.FRAGMENTS, ActionNames.ADD));
    addMenu.add(MenuFactory.makeMenu(MenuFactory.CONFIG_ELEMENTS, ActionNames.ADD));
    addMenu.add(MenuFactory.makeMenu(MenuFactory.TIMERS, ActionNames.ADD));
    addMenu.add(MenuFactory.makeMenu(MenuFactory.PRE_PROCESSORS, ActionNames.ADD));
    addMenu.add(MenuFactory.makeMenu(MenuFactory.POST_PROCESSORS, ActionNames.ADD));
    addMenu.add(MenuFactory.makeMenu(MenuFactory.ASSERTIONS, ActionNames.ADD));
    addMenu.add(MenuFactory.makeMenu(MenuFactory.LISTENERS, ActionNames.ADD));
    pop.add(addMenu);
    MenuFactory.addPasteResetMenu(pop);
    MenuFactory.addFileMenu(pop, false);
    return pop;
}
Also used : JPopupMenu(javax.swing.JPopupMenu) JMenu(javax.swing.JMenu)

Example 33 with JPopupMenu

use of javax.swing.JPopupMenu in project jmeter by apache.

the class AbstractThreadGroupGui method createPopupMenu.

@Override
public JPopupMenu createPopupMenu() {
    JPopupMenu pop = new JPopupMenu();
    pop.add(MenuFactory.makeMenus(new String[] { MenuFactory.CONTROLLERS, MenuFactory.CONFIG_ELEMENTS, MenuFactory.TIMERS, MenuFactory.PRE_PROCESSORS, MenuFactory.SAMPLERS, MenuFactory.POST_PROCESSORS, MenuFactory.ASSERTIONS, MenuFactory.LISTENERS }, // $NON-NLS-1$
    JMeterUtils.getResString("add"), ActionNames.ADD));
    if (this.isEnabled() && // Check test is not started already
    !JMeterUtils.isTestRunning()) {
        pop.addSeparator();
        JMenuItem addThinkTimesToChildren = new JMenuItem(JMeterUtils.getResString("add_think_times"));
        addThinkTimesToChildren.setName("add_think_times");
        addThinkTimesToChildren.addActionListener(ActionRouter.getInstance());
        addThinkTimesToChildren.setActionCommand(ActionNames.ADD_THINK_TIME_BETWEEN_EACH_STEP);
        pop.add(addThinkTimesToChildren);
        JMenuItem runTg = new JMenuItem(JMeterUtils.getResString("run_threadgroup"));
        runTg.setName("run_threadgroup");
        runTg.addActionListener(ActionRouter.getInstance());
        runTg.setActionCommand(ActionNames.RUN_TG);
        pop.add(runTg);
        JMenuItem runTgNotimers = new JMenuItem(JMeterUtils.getResString("run_threadgroup_no_timers"));
        runTgNotimers.setName("run_threadgroup_no_timers");
        runTgNotimers.addActionListener(ActionRouter.getInstance());
        runTgNotimers.setActionCommand(ActionNames.RUN_TG_NO_TIMERS);
        pop.add(runTgNotimers);
        JMenuItem validateTg = new JMenuItem(JMeterUtils.getResString("validate_threadgroup"));
        validateTg.setName("validate_threadgroup");
        validateTg.addActionListener(ActionRouter.getInstance());
        validateTg.setActionCommand(ActionNames.VALIDATE_TG);
        pop.add(validateTg);
    }
    MenuFactory.addEditMenu(pop, true);
    MenuFactory.addFileMenu(pop, false);
    return pop;
}
Also used : JMenuItem(javax.swing.JMenuItem) JPopupMenu(javax.swing.JPopupMenu)

Example 34 with JPopupMenu

use of javax.swing.JPopupMenu in project jmeter by apache.

the class MenuFactory method getDefaultSamplerMenu.

public static JPopupMenu getDefaultSamplerMenu() {
    JPopupMenu pop = new JPopupMenu();
    pop.add(MenuFactory.makeMenus(MENU_ADD_SAMPLER, // $NON-NLS-1$
    JMeterUtils.getResString("add"), ActionNames.ADD));
    pop.add(makeMenus(MENU_PARENT_SAMPLER, // $NON-NLS-1$
    JMeterUtils.getResString("insert_parent"), ActionNames.ADD_PARENT));
    MenuFactory.addEditMenu(pop, true);
    MenuFactory.addFileMenu(pop);
    return pop;
}
Also used : JPopupMenu(javax.swing.JPopupMenu)

Example 35 with JPopupMenu

use of javax.swing.JPopupMenu in project jmeter by apache.

the class MenuFactory method getDefaultExtractorMenu.

public static JPopupMenu getDefaultExtractorMenu() {
    JPopupMenu pop = new JPopupMenu();
    MenuFactory.addEditMenu(pop, true);
    MenuFactory.addFileMenu(pop);
    return pop;
}
Also used : JPopupMenu(javax.swing.JPopupMenu)

Aggregations

JPopupMenu (javax.swing.JPopupMenu)203 JMenuItem (javax.swing.JMenuItem)105 ActionEvent (java.awt.event.ActionEvent)61 ActionListener (java.awt.event.ActionListener)46 JMenu (javax.swing.JMenu)28 Point (java.awt.Point)24 Component (java.awt.Component)20 JLabel (javax.swing.JLabel)20 JSeparator (javax.swing.JSeparator)19 JScrollPane (javax.swing.JScrollPane)18 MouseEvent (java.awt.event.MouseEvent)17 JButton (javax.swing.JButton)16 AbstractAction (javax.swing.AbstractAction)15 BorderLayout (java.awt.BorderLayout)13 JPanel (javax.swing.JPanel)13 JTable (javax.swing.JTable)13 JCheckBoxMenuItem (javax.swing.JCheckBoxMenuItem)12 MouseAdapter (java.awt.event.MouseAdapter)11 ArrayList (java.util.ArrayList)11 Icon (javax.swing.Icon)11