| 1984 | |
| 1985 | |
| 1986 | private boolean serialPrompt() { |
| 1987 | List<BoardPortJCheckBoxMenuItem> items = new ArrayList<>(); |
| 1988 | for (int i = 0; i < portMenu.getItemCount(); i++) { |
| 1989 | if (portMenu.getItem(i) instanceof BoardPortJCheckBoxMenuItem) |
| 1990 | items.add((BoardPortJCheckBoxMenuItem) portMenu.getItem(i)); |
| 1991 | } |
| 1992 | |
| 1993 | String port = PreferencesData.get("serial.port"); |
| 1994 | String title; |
| 1995 | if (port == null || port.isEmpty()) { |
| 1996 | title = tr("Serial port not selected."); |
| 1997 | } else { |
| 1998 | title = I18n.format(tr("Serial port {0} not found."), port); |
| 1999 | } |
| 2000 | String question = tr("Retry the upload with another serial port?"); |
| 2001 | BoardPortJCheckBoxMenuItem result = (BoardPortJCheckBoxMenuItem) JOptionPane |
| 2002 | .showInputDialog(this, title + "\n" + question, title, |
| 2003 | JOptionPane.PLAIN_MESSAGE, null, items.toArray(), 0); |
| 2004 | if (result == null) |
| 2005 | return false; |
| 2006 | result.doClick(); |
| 2007 | base.onBoardOrPortChange(); |
| 2008 | return true; |
| 2009 | } |
| 2010 | |
| 2011 | /** |
| 2012 | * Called by Sketch → Export. |