List of usage examples for javax.swing JOptionPane NO_OPTION
int NO_OPTION
To view the source code for javax.swing JOptionPane NO_OPTION.
Click Source Link
From source file:de.tor.tribes.ui.views.DSWorkbenchSelectionFrame.java
private void copyBBToExternalClipboardEvent() { try {// ww w .j a va 2 s. com List<Village> selection = getSelectedElements(); if (selection.isEmpty()) { showInfo("Keine Elemente ausgewhlt"); return; } boolean extended = (JOptionPaneHelper.showQuestionConfirmBox(this, "Erweiterte BB-Codes verwenden (nur fr Forum und Notizen geeignet)?", "Erweiterter BB-Code", "Nein", "Ja") == JOptionPane.YES_OPTION); StringBuilder buffer = new StringBuilder(); if (extended) { buffer.append("[u][size=12]Dorfliste[/size][/u]\n\n"); } else { buffer.append("[u]Dorfliste[/u]\n\n"); } buffer.append(new VillageListFormatter().formatElements(selection, extended)); if (extended) { buffer.append("\n[size=8]Erstellt am "); buffer.append( new SimpleDateFormat("dd.MM.yy 'um' HH:mm:ss").format(Calendar.getInstance().getTime())); buffer.append(" mit DS Workbench "); buffer.append(Constants.VERSION).append(Constants.VERSION_ADDITION + "[/size]\n"); } else { buffer.append("\nErstellt am "); buffer.append( new SimpleDateFormat("dd.MM.yy 'um' HH:mm:ss").format(Calendar.getInstance().getTime())); buffer.append(" mit DS Workbench "); buffer.append(Constants.VERSION).append(Constants.VERSION_ADDITION + "\n"); } String b = buffer.toString(); StringTokenizer t = new StringTokenizer(b, "["); int cnt = t.countTokens(); if (cnt > 1000) { if (JOptionPaneHelper.showQuestionConfirmBox(this, "Die ausgewhlten Drfer bentigen mehr als 1000 BB-Codes\n" + "und knnen daher im Spiel (Forum/IGM/Notizen) nicht auf einmal dargestellt werden.\nTrotzdem exportieren?", "Zu viele BB-Codes", "Nein", "Ja") == JOptionPane.NO_OPTION) { return; } } Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(b), null); showSuccess("Daten in Zwischenablage kopiert"); } catch (Exception e) { logger.error("Failed to copy data to clipboard", e); showError("Fehler beim Kopieren in die Zwischenablage"); } }
From source file:musite.ui.MusiteResultPanel.java
private void exportComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportComboBoxActionPerformed String name = panelName.replaceAll("[\\\\/:\\*\\?\"<>\\|]+", "-"); String defaultFile = MusiteInit.defaultPath + File.separator + name; if (sliderTitleComboBox.getSelectedItem().equals(SPECIFICITY)) { defaultFile += String.format("-Sp_%.2f", specificity); } else {//from w w w .j a v a 2 s .c om defaultFile += String.format("-Score_%.3f", threshold); } defaultFile += ".result"; switch (exportComboBox.getSelectedIndex()) { case 1: // tab-delimited text file { JFileChooser fc = new JFileChooser(MusiteInit.defaultPath); fc.setSelectedFile(new File(defaultFile)); ArrayList<String> exts = new ArrayList<String>(1); String fasta = "txt"; exts.add(fasta); FileExtensionsFilter fastaFilter = new FileExtensionsFilter(exts, "Tab-delimited file (.txt)"); fc.addChoosableFileFilter(fastaFilter); //fc.setAcceptAllFileFilterUsed(true); fc.setDialogTitle("Save the the result to..."); int returnVal = fc.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); MusiteInit.defaultPath = file.getParent(); String filePath = MusiteInit.defaultPath + File.separator + file.getName(); String ext = FilePathParser.getExt(filePath); if (ext == null || !ext.equalsIgnoreCase("txt")) { filePath += ".txt"; } if (IOUtil.fileExist(filePath)) { int ret = JOptionPane.showConfirmDialog(this, "Are you sure to replace the existing file?", "Relace the existing file?", JOptionPane.YES_NO_OPTION); if (ret == JOptionPane.NO_OPTION) break; } Vector<Vector> data = formatData(proteinList, false, true); int n = data.size(); ArrayList<String> dataOut = new ArrayList(n + 1); dataOut.add(StringUtils.join(header.iterator(), '\t')); for (Vector vec : data) { dataOut.add(StringUtils.join(vec.iterator(), '\t')); } try { IOUtil.writeCollectionAscii(dataOut, filePath); } catch (IOException e) { e.printStackTrace(); JOptionPane.showMessageDialog(this, "Error: failed to write the file."); break; } JOptionPane.showMessageDialog(this, "Successfully exported."); } break; } // case 2: // fasta // { // JFileChooser fc = new JFileChooser(MusiteInit.defaultPath); // fc.setSelectedFile(new File(defaultFile)); // // ArrayList<String> exts = new ArrayList<String>(1); // String fasta = "fasta"; // exts.add(fasta); // FileExtensionsFilter fastaFilter = new FileExtensionsFilter(exts,"Fasta file (.fasta)"); // fc.addChoosableFileFilter(fastaFilter); // // //fc.setAcceptAllFileFilterUsed(true); // fc.setDialogTitle("Save the the result to..."); // int returnVal = fc.showSaveDialog(this); // if (returnVal == JFileChooser.APPROVE_OPTION) { // File file = fc.getSelectedFile(); // MusiteInit.defaultPath = file.getParent(); // // String filePath = MusiteInit.defaultPath + File.separator + file.getName(); // // String ext = FilePathParser.getExt(filePath); // if (ext==null||!ext.equalsIgnoreCase("fasta")) { // filePath += ".fasta"; // } // // if (IOUtil.fileExist(filePath)) { // int ret = JOptionPane.showConfirmDialog(this, "Are you sure to replace the existing file?", "Relace the existing file?", JOptionPane.YES_NO_OPTION); // if (ret==JOptionPane.NO_OPTION) // break; // } // // ProteinsWriter writer = new ModifiedProteinsFastaWriter(); // WriteTask writeTask = new WriteTask(resultDisplay, writer, filePath); // TaskUtil.execute(writeTask); // if (!writeTask.success()) { // JOptionPane.showMessageDialog(this, "Failed to export."); // break; // } // // JOptionPane.showMessageDialog(this, "Successfully exported."); // } // // break; // } // case 3: // xml // { // JFileChooser fc = new JFileChooser(MusiteInit.defaultPath); // fc.setSelectedFile(new File(defaultFile)); // // ArrayList<String> exts = new ArrayList<String>(1); // String xml = "xml"; // exts.add(xml); // FileExtensionsFilter xmlFilter = new FileExtensionsFilter(exts,"XML file (.xml)"); // fc.addChoosableFileFilter(xmlFilter); // // //fc.setAcceptAllFileFilterUsed(true); // fc.setDialogTitle("Save the the result to..."); // int returnVal = fc.showSaveDialog(this); // if (returnVal == JFileChooser.APPROVE_OPTION) { // File file = fc.getSelectedFile(); // MusiteInit.defaultPath = file.getParent(); // // String filePath = MusiteInit.defaultPath + File.separator + file.getName(); // // String ext = FilePathParser.getExt(filePath); // if (ext==null||!ext.equalsIgnoreCase("xml")) { // filePath += ".xml"; // } // // if (IOUtil.fileExist(filePath)) { // int ret = JOptionPane.showConfirmDialog(this, "Are you sure to replace the existing file?", "Relace the existing file?", JOptionPane.YES_NO_OPTION); // if (ret==JOptionPane.NO_OPTION) // break; // } // // ProteinsXMLWriter writer = ProteinsXMLWriter.createWriter(); // WriteTask xmlWriteTask = new WriteTask(resultDisplay, writer, filePath); // TaskUtil.execute(xmlWriteTask); // if (!xmlWriteTask.success()) { // JOptionPane.showMessageDialog(this, "Failed to export."); // break; // } // // JOptionPane.showMessageDialog(this, "Successfully exported."); // } // // break; // } } exportComboBox.setSelectedIndex(0); }
From source file:edu.ku.brc.specify.config.init.secwiz.UserPanel.java
/** * @param doGainAccess/*from ww w . j a va 2s. com*/ */ private void changeMasterAccess(final boolean doGainAccess) { String msg = UIRegistry.getResourceString(doGainAccess ? "DO_GAIN_ACCESS" : "DO_LOOSE_ACCESS"); if (UIRegistry.askYesNoLocalized("YES", "NO", msg, "WARNING") == JOptionPane.NO_OPTION) { return; } DBMSUserMgr mgr = DBMSUserMgr.getInstance(); String dbUserName = properties.getProperty("dbUserName"); String dbPassword = properties.getProperty("dbPassword"); String saUserName = properties.getProperty("saUserName"); String hostName = properties.getProperty("hostName"); String dbName = doGainAccess ? otherDBName : databaseName; if (mgr.getConnection() == null) { if (!mgr.connectToDBMS(dbUserName, dbPassword, hostName)) { UIRegistry.showError("Unable to login."); return; } } ArrayList<String> changedNames = new ArrayList<String>(); ArrayList<String> noChangeNames = new ArrayList<String>(); JList list = doGainAccess ? otherDBList : dbList; int[] inxs = list.getSelectedIndices(); for (int inx : inxs) { String dbNm = (String) list.getModel().getElementAt(inx); if (mgr.setPermissions(saUserName, dbNm, doGainAccess ? DBMSUserMgr.PERM_ALL_BASIC : DBMSUserMgr.PERM_NONE)) { changedNames.add(dbNm); } else { noChangeNames.add(dbNm); } } for (String nm : changedNames) { if (doGainAccess) { ((DefaultListModel) otherDBList.getModel()).removeElement(nm); ((DefaultListModel) dbList.getModel()).addElement(nm); } else { ((DefaultListModel) otherDBList.getModel()).addElement(nm); ((DefaultListModel) dbList.getModel()).removeElement(nm); } } if (inxs.length == 1) { UIRegistry.showLocalizedMsg(JOptionPane.INFORMATION_MESSAGE, "MSTR_PERM_CHGED_TITLE", doGainAccess ? "MSTR_PERM_ADDED" : "MSTR_PERM_DEL", saUserName, dbName); final int selInx = inxs[0]; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { dbList.setSelectedIndex(selInx); } }); } else { UIRegistry.showLocalizedMsg(JOptionPane.INFORMATION_MESSAGE, "MSTR_PERM_CHGED_TITLE", doGainAccess ? "MSTR_NUM_PERM_ADDED" : "MSTR_NUM_PERM_DEL", saUserName, changedNames.size()); } mgr.close(); }
From source file:de.tor.tribes.ui.views.DSWorkbenchSelectionFrame.java
private void removeSelection(boolean pAsk) { if (pAsk && JOptionPaneHelper.showQuestionConfirmBox(this, "Alle markierten Eintrge und ihre untergeordneten Eintrge lschen?", "Lschen", "Nein", "Ja") == JOptionPane.NO_OPTION) { return;/*from www .java 2s . c om*/ } int cnt = 0; for (Village v : getSelectedElements()) { treeData.remove(v); cnt++; } buildTree(); showSuccess(((cnt == 1) ? "Dorf" : cnt + " Drfer") + " gelscht"); }
From source file:com.mirth.connect.client.ui.ChannelPanel.java
private boolean promptSave(boolean force) { int option;//from w w w. ja v a 2 s . c o m if (force) { option = JOptionPane.showConfirmDialog(parent, "You must save the channel group changes before continuing. Would you like to save now?"); } else { option = JOptionPane.showConfirmDialog(parent, "Would you like to save the channel groups?"); } if (option == JOptionPane.YES_OPTION) { return doSaveGroups(false); } else if (option == JOptionPane.CANCEL_OPTION || option == JOptionPane.CLOSED_OPTION || (option == JOptionPane.NO_OPTION && force)) { return false; } return true; }
From source file:com.sshtools.sshterm.SshTermSessionPanel.java
/** * * * @return/*from w w w.j a va 2s . co m*/ */ public boolean canClose() { if ((session != null) && session.isOpen()) { setFullScreenMode(false); if (JOptionPane.showConfirmDialog(this, "Close the current session?", "Close Session", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.NO_OPTION) { return false; } } return true; }
From source file:fll.subjective.SubjectiveFrame.java
/** * Prompt the user with yes/no/cancel. Yes exits and saves, no exits * without/*from w w w. ja va 2s. c o m*/ * saving and cancel doesn't quit. */ /* package */void quit() { if (validateData()) { final int state = JOptionPane.showConfirmDialog(SubjectiveFrame.this, "Save data? Data will be saved in same file as it was read from.", "Exit", JOptionPane.YES_NO_CANCEL_OPTION); if (JOptionPane.YES_OPTION == state) { try { save(); setVisible(false); } catch (final IOException ioe) { JOptionPane.showMessageDialog(null, "Error writing to data file: " + ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } else if (JOptionPane.NO_OPTION == state) { setVisible(false); } } }
From source file:Main.Interface_Main.java
/** * Creates new form Interface_Main// w w w . j a v a2 s . co m * Populates the com port combo box * Init the graphs for Current, Voltage, and Wattage */ public Interface_Main() { initComponents(); btnStop.setEnabled(false); btnStart.setEnabled(false); btnThreshold.setEnabled(false); sldScreen.setEnabled(false); btnReset.setEnabled(false); spnRefSpd.setEnabled(false); Image im = null; try { im = ImageIO.read(getClass().getResource("/faviconbot2edit.png")); setIconImage(im); } catch (IOException ex) { } //Version check to notify user and update title bar. Double newVer = checkVersion('A'); if (newVer > appVersion) { JOptionPane.showMessageDialog(this, "Update available! Visit: http://github.com/friedcircuits", "Update", JOptionPane.INFORMATION_MESSAGE); jlblVer.setVisible(false); appTitle = appTitle + " - New Version: " + newVer.toString(); jlblVer.setText(appTitle); } else { jlblVer.setText(appTitle); } cmbPort.removeAllItems(); ArrayList portNames = listPorts(); for (int i = 0; i < portNames.size(); i++) { cmbPort.addItem(portNames.get(i)); } cmbBaud.setSelectedIndex(7); this.seriesCurrent = new TimeSeries("Time1", Millisecond.class); this.seriesCurrentMax = new TimeSeries("Time", Millisecond.class); this.seriesCurrentMin = new TimeSeries("Time", Millisecond.class); final TimeSeriesCollection dataset = new TimeSeriesCollection(this.seriesCurrent); dataset.addSeries(seriesCurrentMax); dataset.addSeries(seriesCurrentMin); JFreeChart chart = createChartCurrent(dataset); ChartPanel chartPanel = new ChartPanel(chart); //chartPanel.setPreferredSize(new Dimension(100, 260)); //size according to my window chartPanel.setMouseWheelEnabled(true); plCurrent.add(chartPanel, BorderLayout.CENTER); plCurrent.validate(); this.seriesVolt = new TimeSeries("Time", Millisecond.class); this.seriesVoltMax = new TimeSeries("Time", Millisecond.class); this.seriesVoltMin = new TimeSeries("Time", Millisecond.class); final TimeSeriesCollection datasetVolt = new TimeSeriesCollection(this.seriesVolt); datasetVolt.addSeries(seriesVoltMax); datasetVolt.addSeries(seriesVoltMin); JFreeChart chartVolt = createChartVolt(datasetVolt); ChartPanel chartPanelVolt = new ChartPanel(chartVolt); //chartPanelVolt.setPreferredSize(new Dimension(400, 260)); //size according to my window chartPanelVolt.setMouseWheelEnabled(true); plVoltage.add(chartPanelVolt, BorderLayout.CENTER); plVoltage.validate(); this.seriesWatt = new TimeSeries("Time", Millisecond.class); final TimeSeriesCollection datasetWatt = new TimeSeriesCollection(this.seriesWatt); JFreeChart chartWatt = createChartWatt(datasetWatt); ChartPanel chartPanelWatt = new ChartPanel(chartWatt); //chartPanelWatt.setPreferredSize(new Dimension(400, 260)); //size according to my window chartPanelWatt.setMouseWheelEnabled(true); plWattage.add(chartPanelWatt, BorderLayout.CENTER); plWattage.validate(); this.seriesDm = new TimeSeries("Time", Millisecond.class); final TimeSeriesCollection datasetDm = new TimeSeriesCollection(this.seriesDm); JFreeChart chartDm = createChartDm(datasetDm); ChartPanel chartPanelDm = new ChartPanel(chartDm); //chartPanelWatt.setPreferredSize(new Dimension(400, 260)); //size according to my window chartPanelDm.setMouseWheelEnabled(true); plmWh.add(chartPanelDm, BorderLayout.CENTER); plmWh.validate(); this.seriesDp = new TimeSeries("Time", Millisecond.class); final TimeSeriesCollection datasetDp = new TimeSeriesCollection(this.seriesDp); JFreeChart chartDp = createChartDp(datasetDp); ChartPanel chartPanelDp = new ChartPanel(chartDp); //chartPanelWatt.setPreferredSize(new Dimension(400, 260)); //size according to my window chartPanelDp.setMouseWheelEnabled(true); plmAh.add(chartPanelDp, BorderLayout.CENTER); plmAh.validate(); if (cmbPort.getItemCount() > 0) { btnStart.setEnabled(true); lblStatus.setText("Select COM Port and Baud Rate."); } else lblStatus.setText("No serial port found."); System.out.println(cmbPort.getItemCount()); File f = new File(logTmpFile); if (f.exists()) { int reply = JOptionPane.showConfirmDialog(this, "Data temp file exists, resume? (No deletes file)", "Resume?", JOptionPane.YES_NO_OPTION); if (reply == JOptionPane.NO_OPTION) { try { f.delete(); } catch (Exception e) { JOptionPane.showMessageDialog(this, "Unable to delete"); JOptionPane.showMessageDialog(this, e); } } } else { JOptionPane.showMessageDialog(this, "New session", "Session", JOptionPane.INFORMATION_MESSAGE); } System.out.println(f.getAbsolutePath()); }
From source file:condorclient.MainFXMLController.java
@FXML void reScheduleFired(ActionEvent event) { //cluster?/*from ww w .j a va 2 s . c om*/ int oldId = 0;//?? int delNo = 0; int reScheduleId = 0; URL url = null; // String scheddURLStr="http://localhost:9628"; XMLHandler handler = new XMLHandler(); String scheddStr = handler.getURL("schedd"); try { url = new URL(scheddStr); } catch (MalformedURLException e3) { // TODO Auto-generated catch block e3.printStackTrace(); } Schedd schedd = null; int n = JOptionPane.showConfirmDialog(null, "?????", "", JOptionPane.YES_NO_OPTION); if (n == JOptionPane.YES_OPTION) { //checkboxclusterId System.out.print(Thread.currentThread().getName() + "\n"); try { schedd = new Schedd(url); } catch (ServiceException ex) { Logger.getLogger(CondorClient.class.getName()).log(Level.SEVERE, null, ex); } //ClassAdStructAttr[] ClassAd ad = null;//birdbath.ClassAd; ClassAdStructAttr[][] classAdArray = null; ClassAdStructAttr[][] classAdArray2 = null; String taskStatus = ""; final List<?> selectedNodeList = new ArrayList<>(table.getSelectionModel().getSelectedItems()); for (Object o : selectedNodeList) { if (o instanceof ObservableDisplayedClassAd) { oldId = Integer.parseInt(((ObservableDisplayedClassAd) o).getClusterId()); taskStatus = ((ObservableDisplayedClassAd) o).getJobStatus(); if (taskStatus.equals("") || taskStatus.equals("?") || taskStatus.equals("")) { JOptionPane.showMessageDialog(null, "??????"); return; } } } //e int job = 0; Transaction xact = schedd.createTransaction(); try { xact.begin(30); } catch (RemoteException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } System.out.println("oldId:" + oldId); String findreq = "owner==\"" + condoruser + "\"&&ClusterId==" + oldId; try { classAdArray = schedd.getJobAds(findreq); classAdArray2 = schedd.getJobAds(findreq); } catch (RemoteException ex) { Logger.getLogger(MainFXMLController.class.getName()).log(Level.SEVERE, null, ex); } //?jobclassAd? int newClusterId = 0; try { newClusterId = xact.createCluster(); } catch (RemoteException e) { } int newJobId = 0; // XMLHandler handler = new XMLHandler(); String oldname = handler.getJobName("" + oldId); String transferInput = ""; String jobdir = null; //?job??job int jobcount = 0; String timestamp = (new SimpleDateFormat("yyyyMMddHHmmss")).format(new Date()); System.out.println("oldname" + oldname); jobdir = handler.getTaskDir("" + oldId); String expfilename = handler.getExpFile("" + oldId); String infofilename = handler.getInfoFile("" + oldId); for (ClassAdStructAttr[] x : classAdArray) { ad = new ClassAd(x); job = Integer.parseInt(ad.get("ProcId")); ClassAdStructAttr[] attributes = null;// {new ClassAdStructAttr()}; System.out.println("jobdir:===" + jobdir); //?? // File[] files = { new File(expfilename), new File(infofilename) };// new File[2]; System.out.println(expfilename + "===" + infofilename); // String oldiwd = jobdir.substring(0, jobdir.length() - 14);//D:\tmp\test\dirtest\20140902200811; String resultdirstr = oldiwd + timestamp + "\\" + job;//job // new String(handler.getTaskDir(oldname).getBytes(),"UTF-8"); // //attributes[0] = new ClassAdStructAttr("Iwd", ClassAdAttrType.value3, resultdirstr); File newjobdir = new File(resultdirstr); try { System.out.println("resultdirstr:" + resultdirstr); FileUtils.forceMkdir(newjobdir); } catch (IOException ex) { Logger.getLogger(CreateJobDialogController.class.getName()).log(Level.SEVERE, null, ex); } //? /* for (int j = 0; j < inputfilecount; j++) { System.out.println("j:" + j); try { FileUtils.copyFileToDirectory(files[j], newjobdir); } catch (IOException ex) { Logger.getLogger(MainFXMLController.class.getName()).log(Level.SEVERE, null, ex); } }*/ try { newJobId = xact.createJob(newClusterId); } catch (RemoteException ex) { Logger.getLogger(MainFXMLController.class.getName()).log(Level.SEVERE, null, ex); } try { xact.submit(newClusterId, newJobId, condoruser, UniverseType.VANILLA, ad.get("Cmd"), ad.get("Arguments"), ad.get("Requirements"), attributes, files); xact.closeSpool(oldId, job); } catch (RemoteException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } //s try { xact.removeCluster(oldId, ""); } catch (RemoteException ex) { Logger.getLogger(MainFXMLController.class.getName()).log(Level.SEVERE, null, ex); } try { xact.commit(); } catch (RemoteException e) { e.printStackTrace(); } try { schedd.requestReschedule(); } catch (RemoteException ex) { Logger.getLogger(MainFXMLController.class.getName()).log(Level.SEVERE, null, ex); } System.out.println("comit:" + oldname); String olddir = handler.getTaskDir("" + oldId); System.out.println("olddir:" + olddir); // olddir.substring(0, olddir.length() - 14);//??14? String newdir = olddir.substring(0, olddir.length() - 14) + timestamp; System.out.println("newdir:" + newdir); // System.out.println(olddir+"\nmm"+newdir); handler.removeJob("" + oldId); handler.addJob(oldname, "" + newClusterId, newdir, expfilename, infofilename); // reConfigureButtons(); } else if (n == JOptionPane.NO_OPTION) { System.out.println("qu xiao"); } System.out.print("recreateTransaction succeed\n"); }
From source file:de.tor.tribes.ui.views.DSWorkbenchSelectionFrame.java
private void exportAsHTML() { List<Village> selection = getSelectedElements(); if (selection.isEmpty()) { showInfo("Keine Drfer ausgewhlt"); return;/*from ww w. ja va2 s. co m*/ } //do HTML export String dir = GlobalOptions.getProperty("screen.dir"); JFileChooser chooser = null; try { //handle vista problem chooser = new JFileChooser(dir); } catch (Exception e) { JOptionPaneHelper.showErrorBox(this, "Konnte Dateiauswahldialog nicht ffnen.\nMglicherweise verwendest du Windows Vista. Ist dies der Fall, beende DS Workbench, klicke mit der rechten Maustaste auf DSWorkbench.exe,\n" + "whle 'Eigenschaften' und deaktiviere dort unter 'Kompatibilitt' den Windows XP Kompatibilittsmodus.", "Fehler"); return; } chooser.setDialogTitle("Datei auswhlen"); chooser.setFileFilter(new javax.swing.filechooser.FileFilter() { @Override public boolean accept(File f) { return (f != null) && (f.isDirectory() || f.getName().endsWith(".html")); } @Override public String getDescription() { return "*.html"; } }); //open dialog chooser.setSelectedFile(new File(dir + "/Dorfliste.html")); int ret = chooser.showSaveDialog(this); if (ret == JFileChooser.APPROVE_OPTION) { try { //check extension File f = chooser.getSelectedFile(); String file = f.getCanonicalPath(); if (!file.endsWith(".html")) { file += ".html"; } //check overwrite File target = new File(file); if (target.exists()) { if (JOptionPaneHelper.showQuestionConfirmBox(this, "Bestehende Datei berschreiben?", "berschreiben", "Nein", "Ja") == JOptionPane.NO_OPTION) { //do not overwrite return; } } //do export SelectionHTMLExporter.doExport(target, selection); GlobalOptions.addProperty("screen.dir", target.getParent()); showSuccess("Auswahl erfolgreich gespeichert"); if (JOptionPaneHelper.showQuestionConfirmBox(this, "Willst du die erstellte Datei jetzt im Browser betrachten?", "Information", "Nein", "Ja") == JOptionPane.YES_OPTION) { BrowserInterface.openPage(target.toURI().toURL().toString()); } } catch (Exception inner) { logger.error("Failed to write selection to HTML", inner); showError("Fehler beim Speichern"); } } }