Too much of "Looks like another instance is already running." #5584

This commit is contained in:
rusefillc 2023-10-07 18:46:19 -04:00
parent 736db73c31
commit 51a7acdbb2
3 changed files with 13 additions and 2 deletions

View File

@ -6,7 +6,7 @@ import java.net.URL;
import java.util.concurrent.atomic.AtomicReference;
public interface rusEFIVersion {
int CONSOLE_VERSION = 20230930;
int CONSOLE_VERSION = 20231007;
AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
static long classBuildTimeMillis() {

View File

@ -74,6 +74,16 @@ public class UiUtils {
pauseButton.setText((isPaused ? RESUME.getMessage() : PAUSE.getMessage()) + suffix);
}
/**
* problem: say we are downloading auto-update and remove progress bar window from front.
* Special considerations are required for a popup dialog to get to front of display
*/
public static JDialog createOnTopParent() {
JDialog dialog = new JDialog();
dialog.setAlwaysOnTop(true);
return dialog;
}
public static void centerWindow(Window w) {
w.pack();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

View File

@ -33,6 +33,7 @@ import static com.devexperts.logging.Logging.getLogging;
import static com.rusefi.StartupFrame.setFrameIcon;
import static com.rusefi.core.preferences.storage.PersistentConfiguration.getConfig;
import static com.rusefi.core.rusEFIVersion.CONSOLE_VERSION;
import static com.rusefi.ui.util.UiUtils.createOnTopParent;
/**
* @see StartupFrame
@ -205,7 +206,7 @@ public class ConsoleUI {
private static void awtCode(String[] args) {
if (JustOneInstance.isAlreadyRunning()) {
int result = JOptionPane.showConfirmDialog(null, "Looks like another instance is already running. Do you really want to start another instance?",
int result = JOptionPane.showConfirmDialog(createOnTopParent(), "Looks like another instance is already running. Do you really want to start another instance?",
"rusEfi", JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.NO_OPTION)
System.exit(-1);