@@ -67,10 +67,10 @@ public class SerialMonitor extends ViewPart implements ISerialUser {
6767 */
6868 // public static final String ID =
6969 // "it.baeyens.arduino.monitor.views.SerialMonitor";
70-
70+
7171 // If you increase this number you must also assign colors in plugin.xml
7272 static private final int myMaxSerialPorts = 6 ;
73-
73+
7474 static private final URL IMG_CLEAR ;
7575 static private final URL IMG_LOCK ;
7676 static private final URL IMG_FILTER ;
@@ -81,7 +81,8 @@ public class SerialMonitor extends ViewPart implements ISerialUser {
8181 }
8282 // Connect to a serial port
8383 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
8586 private Action disconnect ;
8687 // lock serial monitor scrolling
8788 private Action scrollLock ;
@@ -91,37 +92,39 @@ public class SerialMonitor extends ViewPart implements ISerialUser {
9192 private Action clear ;
9293
9394 // The string to send to the serial port
94- private Text sendString ;
95+ private Text sendString ;
9596 // This control contains the output of the serial port
96- private StyledText monitorOutput ;
97+ private StyledText monitorOutput ;
9798 // Port used when doing actions
98- protected ComboViewer serialPorts ;
99+ protected ComboViewer serialPorts ;
99100 // 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 ;
110111
111112 private Composite parent ;
112113
113114 /* **************
114115 * Below are variables needed for good housekeeping
115116 ************** */
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
118121 protected Map <Serial , SerialListener > serialConnections ;
119122 // the last used index of the lineTerminator combo
120123 protected int lastUsedIndex ;
121-
124+
122125 private static final String myFlagMonitor = "FmStatus" ; //$NON-NLS-1$
123126 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+
125128 private static SerialMonitor instance = null ;
126129
127130 public static SerialMonitor getSerialMonitor () {
@@ -354,38 +357,6 @@ private void fillLocalPullDown(IMenuManager manager) {
354357 manager .add (new Separator ());
355358 manager .add (this .disconnect );
356359 }
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
389360
390361 private void makeActions () {
391362 this .connect = new Action () {
@@ -502,51 +473,6 @@ void SerialPortsUpdated() {
502473 }
503474 }
504475 }
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- =======
550476
551477 /**
552478 * Connect to a serial port and sets the listener
@@ -587,7 +513,6 @@ public void disConnectSerialPort(String comPort) {
587513 theListener .dispose ();
588514 SerialPortsUpdated ();
589515 }
590- >>>>>>> moved serial monitor commands and toggles to view action bar
591516 }
592517
593518 /**
0 commit comments