Skip to content

Commit d69ab6a

Browse files
author
Federico Fissore
committed
introducing jSSC: an RXTX replacement
1 parent d246ca0 commit d69ab6a

File tree

5 files changed

+64
-406
lines changed

5 files changed

+64
-406
lines changed

app/lib/RXTXcomm.jar

-61.6 KB
Binary file not shown.

app/lib/jssc.jar

13.2 KB
Binary file not shown.

app/src/processing/app/Editor.java

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
package processing.app;
2424

25+
import jssc.SerialPortList;
2526
import processing.app.debug.*;
2627
import processing.app.syntax.*;
2728
import processing.app.tools.*;
@@ -43,8 +44,6 @@
4344
import javax.swing.text.*;
4445
import javax.swing.undo.*;
4546

46-
import gnu.io.*;
47-
4847
/**
4948
* Main editor panel for the Processing Development Environment.
5049
*/
@@ -979,36 +978,19 @@ protected void populateSerialMenu() {
979978
serialMenu.removeAll();
980979
boolean empty = true;
981980

982-
try
983-
{
984-
for (Enumeration enumeration = CommPortIdentifier.getPortIdentifiers(); enumeration.hasMoreElements();)
985-
{
986-
CommPortIdentifier commportidentifier = (CommPortIdentifier)enumeration.nextElement();
987-
//System.out.println("Found communication port: " + commportidentifier);
988-
if (commportidentifier.getPortType() == CommPortIdentifier.PORT_SERIAL)
989-
{
990-
//System.out.println("Adding port to serial port menu: " + commportidentifier);
991-
String curr_port = commportidentifier.getName();
992-
rbMenuItem = new JCheckBoxMenuItem(curr_port, curr_port.equals(Preferences.get("serial.port")));
993-
rbMenuItem.addActionListener(serialMenuListener);
994-
//serialGroup.add(rbMenuItem);
995-
serialMenu.add(rbMenuItem);
996-
empty = false;
997-
}
998-
}
999-
if (!empty) {
1000-
//System.out.println("enabling the serialMenu");
1001-
serialMenu.setEnabled(true);
1002-
}
1003-
981+
String[] portNames = SerialPortList.getPortNames();
982+
for (String curr_port : portNames) {
983+
rbMenuItem = new JCheckBoxMenuItem(curr_port, curr_port.equals(Preferences.get("serial.port")));
984+
rbMenuItem.addActionListener(serialMenuListener);
985+
//serialGroup.add(rbMenuItem);
986+
serialMenu.add(rbMenuItem);
987+
empty = false;
1004988
}
1005-
1006-
catch (Exception exception)
1007-
{
1008-
System.out.println(_("error retrieving port list"));
1009-
exception.printStackTrace();
989+
if (!empty) {
990+
//System.out.println("enabling the serialMenu");
991+
serialMenu.setEnabled(true);
1010992
}
1011-
993+
1012994
if (serialMenu.getItemCount() == 0) {
1013995
serialMenu.setEnabled(false);
1014996
}

0 commit comments

Comments
 (0)