// Path: src/main/java/de/konnekting/suite/events/EventDeviceRemoved.java
// public class EventDeviceRemoved {
// 
//     private final DeviceConfigContainer device;
// 
//     public EventDeviceRemoved(DeviceConfigContainer device) {
//         this.device = device;
//     }
// 
//     public DeviceConfigContainer getDevice() {
//         return device;
//     }
//     
// }
// 
// Path: src/main/java/de/konnekting/suite/events/EventAddDevice.java
// public class EventAddDevice {
//     
//     private final DeviceConfigContainer device;
// 
//     public EventAddDevice(DeviceConfigContainer device) {
//         this.device = device;
//     }
// 
//     public DeviceConfigContainer getDeviceConfig() {
//         return device;
//     }
//     
// }
// 
// Path: src/main/java/de/konnekting/suite/events/EventConsoleMessage.java
// public class EventConsoleMessage {
//     private final String message;
// 
//     public EventConsoleMessage(String message) {
//         this.message = message;
//     }
// 
//     public EventConsoleMessage(String message, Throwable ex) {
//         StringWriter sw = new StringWriter();
//         PrintWriter pw = new PrintWriter(sw);
//         ex.printStackTrace(pw);
//         this.message = message +"\n"+sw.toString();
//     }
// 
//     public String getMessage() {
//         return message;
//     }
//     
// }
// 
// Path: src/main/java/de/konnekting/suite/events/EventDeviceAdded.java
// public class EventDeviceAdded {
//     private final DeviceConfigContainer device;
// 
//     public EventDeviceAdded(DeviceConfigContainer device) {
//         this.device = device;
//     }
// 
//     public DeviceConfigContainer getDeviceConfig() {
//         return device;
//     }
//     
// }
// 
// Path: src/main/java/de/konnekting/suite/events/EventDeviceListRefresh.java
// public class EventDeviceListRefresh {
//     
// }
// 
// Path: src/main/java/de/konnekting/suite/events/EventProjectOpened.java
// public class EventProjectOpened {
//     private final File projectFolder;
// 
//     public EventProjectOpened(File projectFolder) {
//         this.projectFolder = projectFolder;
//     }
// 
//     public File getProjectFolder() {
//         return projectFolder;
//     }
//     
// }
// 
// Path: src/main/java/de/konnekting/suite/events/StickyDeviceSelected.java
// public class StickyDeviceSelected {
//     private final DeviceConfigContainer device;
// 
//     public StickyDeviceSelected(DeviceConfigContainer device) {
//         this.device = device;
//     }
// 
//     public StickyDeviceSelected() {
//         device=null;
//     }
// 
//     /**
//      * Returns the selected device, null if no device is selected
//      * @return 
//      */
//     public DeviceConfigContainer getDeviceConfig() {
//         return device;
//     }
//     
// }


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
import de.konnekting.suite.events.EventDeviceRemoved;
import de.konnekting.deviceconfig.DeviceConfigContainer;
import de.konnekting.suite.events.EventAddDevice;
import de.konnekting.suite.events.EventConsoleMessage;
import de.root1.rooteventbus.RootEventBus;
import de.konnekting.suite.events.EventDeviceAdded;
import de.konnekting.suite.events.EventDeviceListRefresh;
import de.konnekting.suite.events.EventProjectOpened;
import de.konnekting.suite.events.StickyDeviceSelected;
import java.io.File;
import javax.swing.JOptionPane;
import javax.xml.bind.JAXBException;
        deviceList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                selectionChanged(evt);
            }
        });
        jScrollPane.setViewportView(deviceList);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 185, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 305, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents

    private void selectionChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_selectionChanged

      int selectedIndex = deviceList.getSelectedIndex();

      log.trace("Device selection changed: " + selectedIndex);

      if (oldSelectedIndex != selectedIndex) {
        if (selectedIndex == -1) {
          eventBus.postSticky(new StickyDeviceSelected(null));
        } else {
          DeviceConfigContainer selectedDevice = deviceListModel.getElementAt(selectedIndex);
// Path: src/main/java/de/konnekting/suite/events/EventDeviceRemoved.java
// public class EventDeviceRemoved {
// 
//     private final DeviceConfigContainer device;
// 
//     public EventDeviceRemoved(DeviceConfigContainer device) {
//         this.device = device;
//     }
// 
//     public DeviceConfigContainer getDevice() {
//         return device;
//     }
//     
// }
// 
// Path: src/main/java/de/konnekting/suite/events/EventAddDevice.java
// public class EventAddDevice {
//     
//     private final DeviceConfigContainer device;
// 
//     public EventAddDevice(DeviceConfigContainer device) {
//         this.device = device;
//     }
// 
//     public DeviceConfigContainer getDeviceConfig() {
//         return device;
//     }
//     
// }
// 
// Path: src/main/java/de/konnekting/suite/events/EventConsoleMessage.java
// public class EventConsoleMessage {
//     private final String message;
// 
//     public EventConsoleMessage(String message) {
//         this.message = message;
//     }
// 
//     public EventConsoleMessage(String message, Throwable ex) {
//         StringWriter sw = new StringWriter();
//         PrintWriter pw = new PrintWriter(sw);
//         ex.printStackTrace(pw);
//         this.message = message +"\n"+sw.toString();
//     }
// 
//     public String getMessage() {
//         return message;
//     }
//     
// }
// 
// Path: src/main/java/de/konnekting/suite/events/EventDeviceAdded.java
// public class EventDeviceAdded {
//     private final DeviceConfigContainer device;
// 
//     public EventDeviceAdded(DeviceConfigContainer device) {
//         this.device = device;
//     }
// 
//     public DeviceConfigContainer getDeviceConfig() {
//         return device;
//     }
//     
// }
// 
// Path: src/main/java/de/konnekting/suite/events/EventDeviceListRefresh.java
// public class EventDeviceListRefresh {
//     
// }
// 
// Path: src/main/java/de/konnekting/suite/events/EventProjectOpened.java
// public class EventProjectOpened {
//     private final File projectFolder;
// 
//     public EventProjectOpened(File projectFolder) {
//         this.projectFolder = projectFolder;
//     }
// 
//     public File getProjectFolder() {
//         return projectFolder;
//     }
//     
// }
// 
// Path: src/main/java/de/konnekting/suite/events/StickyDeviceSelected.java
// public class StickyDeviceSelected {
//     private final DeviceConfigContainer device;
// 
//     public StickyDeviceSelected(DeviceConfigContainer device) {
//         this.device = device;
//     }
// 
//     public StickyDeviceSelected() {
//         device=null;
//     }
// 
//     /**
//      * Returns the selected device, null if no device is selected
//      * @return 
//      */
//     public DeviceConfigContainer getDeviceConfig() {
//         return device;
//     }
//     
// }


// Path: src/main/java/de/konnekting/suite/DeviceList.java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
import de.konnekting.suite.events.EventDeviceRemoved;
import de.konnekting.deviceconfig.DeviceConfigContainer;
import de.konnekting.suite.events.EventAddDevice;
import de.konnekting.suite.events.EventConsoleMessage;
import de.root1.rooteventbus.RootEventBus;
import de.konnekting.suite.events.EventDeviceAdded;
import de.konnekting.suite.events.EventDeviceListRefresh;
import de.konnekting.suite.events.EventProjectOpened;
import de.konnekting.suite.events.StickyDeviceSelected;
import java.io.File;
import javax.swing.JOptionPane;
import javax.xml.bind.JAXBException;

        deviceList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                selectionChanged(evt);
            }
        });
        jScrollPane.setViewportView(deviceList);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 185, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 305, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents

    private void selectionChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_selectionChanged

      int selectedIndex = deviceList.getSelectedIndex();

      log.trace("Device selection changed: " + selectedIndex);

      if (oldSelectedIndex != selectedIndex) {
        if (selectedIndex == -1) {
          eventBus.postSticky(new StickyDeviceSelected(null));
        } else {
          DeviceConfigContainer selectedDevice = deviceListModel.getElementAt(selectedIndex);
          eventBus.postSticky(new StickyDeviceSelected(selectedDevice));