MCPcopy
hub / github.com/arduino/Arduino / serialPrompt

Method serialPrompt

app/src/processing/app/Editor.java:1986–2009  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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 &rarr; Export.

Callers 1

runMethod · 0.80

Calls 6

getMethod · 0.95
formatMethod · 0.95
trMethod · 0.80
addMethod · 0.45
isEmptyMethod · 0.45
onBoardOrPortChangeMethod · 0.45

Tested by

no test coverage detected