Fix logger loading from editor, minor loading improvements

This commit is contained in:
Robin K 2022-04-08 22:26:59 +02:00
parent bc720a6009
commit b4fb62c2b8
4 changed files with 18 additions and 13 deletions

View File

@ -31,6 +31,7 @@ import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER;
import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;
import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
import static com.romraider.util.ThreadUtil.runAsDaemon;
import java.awt.BorderLayout;
import java.awt.Color;
@ -71,6 +72,8 @@ import javax.swing.tree.TreePath;
import com.romraider.ECUExec;
import com.romraider.Settings;
import com.romraider.logger.ecu.EcuLogger;
import com.romraider.logger.ecu.ui.handler.table.TableUpdateHandler;
import com.romraider.logger.ecu.ui.playback.PlaybackManagerImpl;
import com.romraider.maps.Rom;
import com.romraider.maps.Table;
import com.romraider.maps.Table1D;
@ -100,6 +103,7 @@ import com.romraider.swing.TableToolBar;
import com.romraider.swing.TableTreeNode;
import com.romraider.util.ResourceUtil;
import com.romraider.util.SettingsManager;
import com.romraider.util.ThreadUtil;
import com.romraider.xml.ConversionLayer.ConversionLayer;
public class ECUEditor extends AbstractFrame {
@ -613,9 +617,12 @@ public class ECUEditor extends AbstractFrame {
return;
}
else {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
ECUExec.openLogger(DISPOSE_ON_CLOSE, new String[] {"-logger"});
setCursor(null);
ThreadUtil.runAsDaemon(new Runnable() {
@Override
public void run() {
ECUExec.openLogger(DISPOSE_ON_CLOSE, new String[] {"-logger"});
}
});
}
}

View File

@ -373,7 +373,6 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
progressBar.setValue(100);
initDataUpdateHandlers();
startPortRefresherThread();
if (!isLogging()) startLogging();
startStatus.dispose();
}
else {
@ -390,7 +389,6 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
ecuEditor.getStatusPanel().update(rb.getString("COMPLETE"), 100);
initDataUpdateHandlers();
startPortRefresherThread();
if (!isLogging()) startLogging();
ecuEditor.getStatusPanel().update(rb.getString("READY"),0);
}
this.toFront();
@ -517,7 +515,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
long start = currentTimeMillis();
while (!refresher.isStarted()) {
checkSerialPortRefresherTimeout(start);
sleep(100);
sleep(5);
}
}
@ -2110,6 +2108,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
boolean fullscreen = containsFullScreenArg(args);
EcuLogger ecuLogger = getEcuLogger(ecuEditor);
createAndShowGui(defaultCloseOperation, ecuLogger, fullscreen);
if (!ecuLogger.isLogging()) ecuLogger.startLogging();
}
private static boolean containsFullScreenArg(String... args) {

View File

@ -24,11 +24,9 @@ import static com.romraider.io.connection.ConnectionManagerFactory.getManager;
import com.romraider.io.connection.ConnectionProperties;
import com.romraider.io.elm327.ElmConnectionManager;
import com.romraider.logger.ecu.exception.UnsupportedProtocolException;
import com.romraider.logger.ecu.comms.io.connection.ELMOBDLoggerConnection;
public final class LoggerConnectionFactory {
private LoggerConnectionFactory() {
}
private LoggerConnectionFactory() {}
public static LoggerConnection getConnection(
final String protocolName,

View File

@ -1107,13 +1107,13 @@ public final class DynoControlPanel extends JPanel {
}
private JButton buildOpenReferenceButton() {
final JFileChooser openFile = new JFileChooser();
if (path != null) openFile.setCurrentDirectory(new File(path));
final JButton openButton = new JButton(rb.getString("OPEN"));
openButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
final JFileChooser openFile = new JFileChooser();
if (path != null) openFile.setCurrentDirectory(new File(path));
int returnVal = openFile.showOpenDialog(openButton);
if (returnVal == JFileChooser.APPROVE_OPTION) {
@ -1168,13 +1168,14 @@ public final class DynoControlPanel extends JPanel {
}
private JButton buildSaveReferenceButton() {
final JFileChooser openFile = new JFileChooser();
if (path != null) openFile.setCurrentDirectory(new File(path));
final JButton saveButton = new JButton(rb.getString("SAVE"));
saveButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
final JFileChooser openFile = new JFileChooser();
if (path != null) openFile.setCurrentDirectory(new File(path));
int returnVal = openFile.showSaveDialog(saveButton);
if (returnVal == JFileChooser.APPROVE_OPTION) {