/** * Loads or merges a file into the current GUI, reporting any errors to the user. * If the file is a complete test plan, sets the GUI test plan file name * * @param e the event that triggered the action * @param f the file to load * @param merging if true, then try to merge the file into the current GUI. */ static void loadProjectFile(final ActionEvent e, final File f, final boolean merging) { loadProjectFile(e, f, merging, true); }
/** * Loads dragged file asking before for save if current open file is dirty. * @param e {@link ActionEvent} * @param file File to Load */ public static void loadProject(ActionEvent e, File file) { if(!Close.performAction(e)) { return; } Load.loadProjectFile(e, file, false); } }
@Override public void doActionAfterCheck(final ActionEvent e) { final JFileChooser chooser = FileDialoger.promptToOpenFile(new String[] { ".jmx" }); //$NON-NLS-1$ if (chooser == null) { return; } final File selectedFile = chooser.getSelectedFile(); if (selectedFile != null) { final boolean merging = e.getActionCommand().equals(ActionNames.MERGE); // We must ask the user if it is ok to close current project if (!merging) { // i.e. it is OPEN if (!Close.performAction(e)) { return; } } loadProjectFile(e, selectedFile, merging); } }
@Override public void doActionAfterCheck(ActionEvent e) { // Get the file name of the current project String projectFile = GuiPackage.getInstance().getTestPlanFile(); // Check if the user has loaded any file if (projectFile == null) { return; } // Check if the user wants to drop any changes ActionRouter.getInstance().doActionNow(new ActionEvent(e.getSource(), e.getID(), ActionNames.CHECK_DIRTY)); GuiPackage guiPackage = GuiPackage.getInstance(); if (guiPackage.isDirty()) { // Check if the user wants to revert int response = JOptionPane.showConfirmDialog(GuiPackage.getInstance().getMainFrame(), JMeterUtils.getResString("cancel_revert_project"), // $NON-NLS-1$ JMeterUtils.getResString("revert_project?"), // $NON-NLS-1$ JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.YES_OPTION) { // Close the current project Close.closeProject(e); // Reload the project Load.loadProjectFile(e, new File(projectFile), false); } } } }
? new File(parent, template.getFileName()) : new File(JMeterUtils.getJMeterHome(), template.getFileName()); Load.loadProjectFile(actionEvent, fileToCopy, !isTestPlan, false); this.setVisible(false);