Skip to content

Commit 44efa7f

Browse files
committed
Revert "introducing jSSC: an RXTX replacement"
This reverts commit d69ab6a. Conflicts: app/lib/RXTXcomm.jar
1 parent a657582 commit 44efa7f

File tree

5 files changed

+406
-64
lines changed

5 files changed

+406
-64
lines changed

app/lib/RXTXcomm.jar

3.67 KB
Binary file not shown.

app/lib/jssc.jar

-13.2 KB
Binary file not shown.

app/src/processing/app/Editor.java

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

2323
package processing.app;
2424

25-
import jssc.SerialPortList;
2625
import processing.app.debug.*;
2726
import processing.app.syntax.*;
2827
import processing.app.tools.*;
@@ -44,6 +43,8 @@
4443
import javax.swing.text.*;
4544
import javax.swing.undo.*;
4645

46+
import gnu.io.*;
47+
4748
/**
4849
* Main editor panel for the Processing Development Environment.
4950
*/
@@ -978,19 +979,36 @@ protected void populateSerialMenu() {
978979
serialMenu.removeAll();
979980
boolean empty = true;
980981

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;
988-
}
989-
if (!empty) {
990-
//System.out.println("enabling the serialMenu");
991-
serialMenu.setEnabled(true);
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+
9921004
}
9931005

1006+
catch (Exception exception)
1007+
{
1008+
System.out.println(_("error retrieving port list"));
1009+
exception.printStackTrace();
1010+
}
1011+
9941012
if (serialMenu.getItemCount() == 0) {
9951013
serialMenu.setEnabled(false);
9961014
}

0 commit comments

Comments
 (0)