public static EventSounds getEventSounds( EventSounds initialValue, Options options, Component parent, MediaBagEditor mbe) { EventSounds result = null; Messages msg = options.getMessages(); EventSoundsEditorPanel evsed = dlgPanels.get(options); if (evsed == null) { // mbep=(MediaBagMultiEditorPanel)mbe.createEditorPanel(options); evsed = new EventSoundsEditorPanel(options, mbe); // evsed.setPreferredSize(new java.awt.Dimension(500, 500)); dlgPanels.put(options, evsed); } evsed.setEventSounds((EventSounds) initialValue.clone()); boolean b = msg.showInputDlg(parent, evsed, "edit_evsounds_dlg_title"); if (b) { result = evsed.getEventSounds(); } return result; }
public static String[] prompt( ResourceBridge rb, Component parent, String inputPath, String exportBasePath, String scormBasePath) { String[] result = null; ExportToJSDlg exportDlg = new ExportToJSDlg(rb); Messages msg = rb.getOptions().getMessages(); String inputBase = (new File(inputPath)).getName(); exportDlg.outputFolder = (new File(new File(exportBasePath), inputBase)).getPath(); exportDlg.scormFile = (new File(new File(scormBasePath), inputBase + ".scorm.zip")).getPath(); exportDlg.fillData(); while (result == null) { if (!msg.showInputDlg(parent, exportDlg, "export_project_title")) { break; } exportDlg.getData(); if (exportDlg.outputFolder == null) { msg.showErrorWarning(parent, "export_project_err_empty", null); } else { try { boolean folderOk = true; boolean scormOk = true; File outputFolderFile = new File(exportDlg.outputFolder); if (exportDlg.outputFolder.equals(inputPath)) { msg.showErrorWarning(parent, "export_project_err_sameFolder", null); folderOk = false; } else if (exportDlg.outputFolder.startsWith(inputPath)) { msg.showErrorWarning(parent, "export_project_err_nestedFolders", null); folderOk = false; } else if (outputFolderFile.exists() && outputFolderFile.isDirectory()) { if (outputFolderFile.list().length > 0) { folderOk = msg.showQuestionDlg(parent, "export_project_warning_noEmptyFolder", null, "yn") == Messages.YES; } } else if (!outputFolderFile.mkdirs()) { msg.showErrorWarning(parent, "edit_new_project_err_folderCreation", null); folderOk = false; } if (folderOk && exportDlg.exportScorm) { if (exportDlg.scormFile == null) { msg.showErrorWarning(parent, "export_project_scorm_file_err_empty", null); scormOk = false; } else { File scormFile = new File(exportDlg.scormFile); if (scormFile.exists()) { scormOk = msg.showQuestionDlg(parent, "export_project_scorm_file_exists", null, "yn") == Messages.YES; } else if (!scormFile.getParentFile().exists() && !scormFile.getParentFile().mkdirs()) { msg.showErrorWarning(parent, "edit_new_project_err_folderCreation", null); scormOk = false; } } } if (folderOk && scormOk) { result = new String[] { exportDlg.outputFolder, inputPath, exportDlg.exportAll ? "true" : "false", exportDlg.exportScorm ? exportDlg.scormFile : null }; } } catch (Exception ex) { msg.showErrorWarning(parent, "ERROR", ex); } } } return result; }