use of com.xored.javafx.packeteditor.events.InitPacketEditorEvent in project trex-stateless-gui by cisco-system-traffic-generator.
the class MainViewController method handleScapyClientNeedConnectEvent.
@Subscribe
public void handleScapyClientNeedConnectEvent(ScapyClientNeedConnectEvent event) {
LogsController.getInstance().getView().setDisable(false);
if (!ConnectionManager.getInstance().isScapyConnected()) {
ConnectionsWrapper connection = (ConnectionsWrapper) XMLFileManager.loadXML("connections.xml", ConnectionsWrapper.class);
Connection lastUsed = null;
for (Connection con : connection.getConnectionList()) {
if (con.isLastUsed()) {
lastUsed = con;
}
}
if (lastUsed == null) {
ConnectionManager.getInstance().connectScapy();
} else {
ConnectionManager.getInstance().connectScapy(lastUsed.getIp(), lastUsed.getScapyPort());
}
if (!ConnectionManager.getInstance().isScapyConnected()) {
openConnectDialog();
}
if (ConnectionManager.getInstance().isScapyConnected()) {
eventBus.post(new InitPacketEditorEvent());
return;
}
}
}
Aggregations