@@ -67,10 +67,10 @@ public class SerialMonitor extends ViewPart implements ISerialUser {
67
67
*/
68
68
// public static final String ID =
69
69
// "it.baeyens.arduino.monitor.views.SerialMonitor";
70
-
70
+
71
71
// If you increase this number you must also assign colors in plugin.xml
72
72
static private final int myMaxSerialPorts = 6 ;
73
-
73
+
74
74
static private final URL IMG_CLEAR ;
75
75
static private final URL IMG_LOCK ;
76
76
static private final URL IMG_FILTER ;
@@ -81,7 +81,8 @@ public class SerialMonitor extends ViewPart implements ISerialUser {
81
81
}
82
82
// Connect to a serial port
83
83
private Action connect ;
84
- // this action will disconnect the serial port selected by the serialPorts combo
84
+ // this action will disconnect the serial port selected by the serialPorts
85
+ // combo
85
86
private Action disconnect ;
86
87
// lock serial monitor scrolling
87
88
private Action scrollLock ;
@@ -91,37 +92,39 @@ public class SerialMonitor extends ViewPart implements ISerialUser {
91
92
private Action clear ;
92
93
93
94
// The string to send to the serial port
94
- private Text sendString ;
95
+ private Text sendString ;
95
96
// This control contains the output of the serial port
96
- private StyledText monitorOutput ;
97
+ private StyledText monitorOutput ;
97
98
// Port used when doing actions
98
- protected ComboViewer serialPorts ;
99
+ protected ComboViewer serialPorts ;
99
100
// Add CR? LF? CR+LF? Nothing?
100
- private ComboViewer lineTerminator ;
101
- private Button send ; // When click will send the content of
102
- // SendString to the port selected SerialPorts
103
- // adding the postfix selected in
104
- // SendPostFix
105
- private Button reset ; // The button to reset the arduino
106
-
107
- private String serialColorID [] = null ; // Contains the colors that are
108
- // used
109
- private ColorRegistry colorRegistry = null ;// link to color registry;
101
+ private ComboViewer lineTerminator ;
102
+ // When click will send the content of SendString to the port selected SerialPorts
103
+ // adding the postfix selected in SendPostFix
104
+ private Button send ;
105
+ // The button to reset the arduino
106
+ private Button reset ;
107
+ // Contains the colors that are used
108
+ private String serialColorID [] = null ;
109
+ // link to color registry
110
+ private ColorRegistry colorRegistry = null ;
110
111
111
112
private Composite parent ;
112
113
113
114
/* **************
114
115
* Below are variables needed for good housekeeping
115
116
************** */
116
-
117
- // The serial connections that are open with the listeners listening to this port
117
+
118
+
119
+ // The serial connections that are open with the listeners listening to this
120
+ // port
118
121
protected Map <Serial , SerialListener > serialConnections ;
119
122
// the last used index of the lineTerminator combo
120
123
protected int lastUsedIndex ;
121
-
124
+
122
125
private static final String myFlagMonitor = "FmStatus" ; //$NON-NLS-1$
123
126
String uri = "h tt p://ba eye ns. i t/ec li pse/d ow nlo ad/mo nito rSta rt.ht m l?m=" ; //$NON-NLS-1$
124
-
127
+
125
128
private static SerialMonitor instance = null ;
126
129
127
130
public static SerialMonitor getSerialMonitor () {
@@ -354,38 +357,6 @@ private void fillLocalPullDown(IMenuManager manager) {
354
357
manager .add (new Separator ());
355
358
manager .add (this .disconnect );
356
359
}
357
- <<<<<<< HEAD
358
- return null ;
359
- }
360
-
361
- private void contributeToActionBars () {
362
- IActionBars bars = getViewSite ().getActionBars ();
363
- fillLocalPullDown (bars .getMenuManager ());
364
- fillLocalToolBar (bars .getToolBarManager ());
365
- }
366
-
367
- private void fillLocalToolBar (IToolBarManager manager ) {
368
- manager .add (this .myConnectToSerialPort );
369
- manager .add (this .myDisconnectSerialPort );
370
- }
371
-
372
- private void fillLocalPullDown (IMenuManager manager ) {
373
- manager .add (this .myConnectToSerialPort );
374
- manager .add (new Separator ());
375
- manager .add (this .myDisconnectSerialPort );
376
- }
377
-
378
- private void makeActions () {
379
- this .myConnectToSerialPort = new Action () {
380
- @ SuppressWarnings ("synthetic-access" )
381
- @ Override
382
- public void run () {
383
- OpenSerialDialogBox comportSelector = new OpenSerialDialogBox (SerialMonitor .this .myparent .getShell ());
384
- comportSelector .create ();
385
- if (comportSelector .open () == Window .OK ) {
386
- connectSerial (comportSelector .GetComPort (), comportSelector .GetBaudRate (), comportSelector .GetDtr ());
387
- =======
388
- >>>>>>> moved serial monitor commands and toggles to view action bar
389
360
390
361
private void makeActions () {
391
362
this .connect = new Action () {
@@ -502,51 +473,6 @@ void SerialPortsUpdated() {
502
473
}
503
474
}
504
475
}
505
- <<<<<<< HEAD
506
- }
507
-
508
- /**
509
- * Connect to a serial port and sets the listener
510
- *
511
- * @param ComPort
512
- * the name of the comport to connect to
513
- * @param BaudRate
514
- * the bautrate to connect to the com port
515
- */
516
- public void connectSerial (String ComPort , int BaudRate ) {
517
- connectSerial (ComPort , BaudRate , true );
518
- }
519
-
520
- public void connectSerial (String ComPort , int BaudRate , boolean dtr ) {
521
- if (this .mySerialConnections .size () < myMaxSerialPorts ) {
522
- int colorindex = this .mySerialConnections .size ();
523
- Serial newSerial = new Serial (ComPort , BaudRate , dtr );
524
- if (newSerial .IsConnected ()) {
525
- newSerial .registerService ();
526
- SerialListener theListener = new SerialListener (this , colorindex );
527
- newSerial .addListener (theListener );
528
- theListener .event (System .getProperty ("line.separator" ) + Messages .SerialMonitor_connectedt_to + ComPort //$NON-NLS-1$
529
- + Messages .SerialMonitor_at + BaudRate + System .getProperty ("line.separator" )); //$NON-NLS-1$
530
- this .mySerialConnections .put (newSerial , theListener );
531
- SerialPortsUpdated ();
532
- return ;
533
- }
534
- } else {
535
- Common .log (new Status (IStatus .ERROR , Const .CORE_PLUGIN_ID , Messages .SerialMonitor_no_more_serial_ports_supported , null ));
536
- }
537
-
538
- }
539
-
540
- public void disConnectSerialPort (String comPort ) {
541
- Serial newSerial = GetSerial (comPort );
542
- if (newSerial != null ) {
543
- SerialListener theListener = SerialMonitor .this .mySerialConnections .get (newSerial );
544
- SerialMonitor .this .mySerialConnections .remove (newSerial );
545
- newSerial .removeListener (theListener );
546
- newSerial .dispose ();
547
- theListener .dispose ();
548
- SerialPortsUpdated ();
549
- =======
550
476
551
477
/**
552
478
* Connect to a serial port and sets the listener
@@ -587,7 +513,6 @@ public void disConnectSerialPort(String comPort) {
587
513
theListener .dispose ();
588
514
SerialPortsUpdated ();
589
515
}
590
- >>>>>>> moved serial monitor commands and toggles to view action bar
591
516
}
592
517
593
518
/**
0 commit comments