@Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 0) { ActionRouter.getInstance().doActionNow( new ActionEvent(e.getSource(), e.getID(), ActionNames.LINK_RELEASE_NOTES)); } } });
/** * Called when the main JMeter frame is being closed. Sends a * notification so that JMeter can react appropriately. * * @param event * the WindowEvent to handle */ @Override public void windowClosing(WindowEvent event) { ActionRouter.getInstance().actionPerformed(new ActionEvent(this, event.getID(), ActionNames.EXIT)); } }
/** * Allows an ActionListener to receive notification of a command being * executed after the command has executed. * * @param action * the Class of the command for which the listener will * notifications for. Class must extend * org.apache.jmeter.gui.action.Command. * @param listener * The {@link ActionListener} to be registered */ public void addPostActionListener(Class<?> action, ActionListener listener) { addActionListener(action, listener, postActionListeners); }
public CheckDirty() { previousGuiItems = new HashMap<>(); ActionRouter.getInstance().addPreActionListener(ExitCommand.class, this); ActionRouter.getInstance().addPostActionListener(UndoCommand.class, this); }
/** * Make a menuItem using a fixed label which is also used as the item name. * This is used for items such as recent files and hostnames which are not resources * @param label (this is not used as a resource key) * @param actionCommand * @return the menu item */ private static JMenuItem makeMenuItemNoRes(String label, String actionCommand) { JMenuItem menuItem = new JMenuItem(label); menuItem.setName(label); menuItem.setActionCommand(actionCommand); menuItem.addActionListener(ActionRouter.getInstance()); return menuItem; }
saveGraphToFile = true; try { ActionRouter.getInstance().getAction( ActionNames.SAVE_GRAPHICS,SaveGraphics.class.getName()).doAction( new ActionEvent(this,event.getID(),ActionNames.SAVE_GRAPHICS));
splash.setProgress(30); JMeterTreeListener treeLis = new JMeterTreeListener(treeModel); final ActionRouter instance = ActionRouter.getInstance(); instance.populateCommandMap(); splash.setProgress(60); treeLis.setActionHandler(instance); main.setVisible(true); main.toFront(); instance.actionPerformed(new ActionEvent(main, 1, ActionNames.ADD_ALL)); if (testFile != null) { try {
List<String> listClasses = findClassesThatExtend("org.apache.jmeter.gui.action.Command", // $NON-NLS-1$ "org.apache.jmeter.report.gui", // $NON-NLS-1$ JMeterUtils.getSearchPaths()); Optional<String[]> codeSourceSearchPath = getCodeSourceSearchPath(); if (codeSourceSearchPath.isPresent()) { log.info("Using fallback search path"); listClasses = findClassesThatExtend("org.apache.jmeter.gui.action.Command", // $NON-NLS-1$ "org.apache.jmeter.report.gui", // $NON-NLS-1$ codeSourceSearchPath.get());
/** * @param action {@link Class} * @param e {@link ActionEvent} */ protected void preActionPerformed(Class<? extends Command> action, ActionEvent e) { actionPerformed(action, e, preActionListeners); }
/** * To execute an action immediately in the current thread. * * @param e * the action to execute */ public void doActionNow(ActionEvent e) { performAction(e); }
@Override public JMenuItem[] getMenuItemsAtLocation(MENU_LOCATION location) { if(location == MENU_LOCATION.HELP) { JMenuItem menuItemIC = new JMenuItem( JMeterUtils.getResString("export_transactions_menu"), KeyEvent.VK_UNDEFINED); menuItemIC.setName(ExportTransactionAndSamplerNames.EXPORT_NAMES); menuItemIC.setActionCommand(ExportTransactionAndSamplerNames.EXPORT_NAMES); menuItemIC.setAccelerator(null); menuItemIC.addActionListener(ActionRouter.getInstance()); return new JMenuItem[]{menuItemIC}; } return new JMenuItem[0]; }
saveGraphToFile = true; try { ActionRouter.getInstance().getAction( ActionNames.SAVE_GRAPHICS,SaveGraphics.class.getName()).doAction( new ActionEvent(this,event.getID(),ActionNames.SAVE_GRAPHICS));
/** * @param action {@link Class} * @param e {@link ActionEvent} */ protected void postActionPerformed(Class<? extends Command> action, ActionEvent e) { actionPerformed(action, e, postActionListeners); }
@Override public void actionPerformed(final ActionEvent e) { SwingUtilities.invokeLater(() -> performAction(e)); }
/** * Handles click on warnIndicator */ @Override public void actionPerformed(ActionEvent event) { if (event.getSource() == warnIndicator) { ActionRouter.getInstance().doActionNow( new ActionEvent(event.getSource(), event.getID(), ActionNames.LOGGER_PANEL_ENABLE_DISABLE)); } }
private static JMenuItem makeMenuItemRes(String resource, int mnemonic, String actionCommand, KeyStroke keyStroke){ JMenuItem menuItem = new JMenuItem(JMeterUtils.getResString(resource), mnemonic); menuItem.setName(resource); menuItem.setActionCommand(actionCommand); menuItem.setAccelerator(keyStroke); menuItem.addActionListener(ActionRouter.getInstance()); return menuItem; }
static void closeProject(ActionEvent e) { GuiPackage guiPackage = GuiPackage.getInstance(); guiPackage.clearTestPlan(); JTree tree = guiPackage.getTreeListener().getJTree(); tree.setSelectionRow(0); FocusRequester.requestFocus(tree); FileServer.getFileServer().setScriptName(null); ActionRouter.getInstance().actionPerformed(new ActionEvent(e.getSource(), e.getID(), ActionNames.ADD_ALL)); } }
/** * Allows an ActionListener to receive notification of a command being * executed prior to the actual execution of the command. * * @param action * the Class of the command for which the listener will * notifications for. Class must extend * org.apache.jmeter.gui.action.Command. * @param listener * the ActionListener to receive the notifications */ public void addPreActionListener(Class<?> action, ActionListener listener) { addActionListener(action, listener, preActionListeners); }
@Override public void actionPerformed(ActionEvent e) { String[] source = new String[] { Help.HELP_FUNCTIONS, functionList.getText() }; ActionRouter.getInstance().doActionNow( new ActionEvent(source, e.getID(), ActionNames.HELP)); } }
private JMenuItem createMenuItem(String name, String actionCommand) { JMenuItem addThinkTimesToChildren = new JMenuItem(JMeterUtils.getResString(name)); addThinkTimesToChildren.setName(name); addThinkTimesToChildren.addActionListener(ActionRouter.getInstance()); addThinkTimesToChildren.setActionCommand(actionCommand); return addThinkTimesToChildren; }