parent
256167f6b5
commit
3e61f197d9
|
@ -141,14 +141,6 @@ public class UiUtils {
|
|||
return imageButton;
|
||||
}
|
||||
|
||||
public static void invokeAndWait(Runnable runnable) throws InterruptedException, InvocationTargetException {
|
||||
if (SwingUtilities.isEventDispatchThread()) {
|
||||
runnable.run();
|
||||
} else {
|
||||
SwingUtilities.invokeAndWait(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
public static void showLoadingMessage(JPanel panel) {
|
||||
panel.add(new JLabel("Loading..."), BorderLayout.CENTER);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.rusefi.ts_plugin;
|
|||
import com.devexperts.logging.Logging;
|
||||
import com.efiAnalytics.plugin.ApplicationPlugin;
|
||||
import com.efiAnalytics.plugin.ecu.ControllerAccess;
|
||||
import com.rusefi.core.rusEFIVersion;
|
||||
import org.putgemin.VerticalFlowLayout;
|
||||
|
||||
import javax.swing.*;
|
||||
|
@ -77,7 +78,7 @@ public class TsPluginLauncher implements ApplicationPlugin {
|
|||
// lazy initialization since TunerStudio creates one instance only to get version information without any
|
||||
// intentions to display the UI
|
||||
if (content.getComponents().length == 0) {
|
||||
log.info("Create Updater " + this);
|
||||
log.info("Create Updater " + this + " " + rusEFIVersion.CONSOLE_VERSION);
|
||||
Updater updater = new Updater();
|
||||
content.add(updater.getContent());
|
||||
}
|
||||
|
|
|
@ -178,6 +178,14 @@ public class Updater {
|
|||
}
|
||||
}
|
||||
|
||||
private static void invokeAndWait(Runnable runnable) throws InterruptedException, InvocationTargetException {
|
||||
if (SwingUtilities.isEventDispatchThread()) {
|
||||
runnable.run();
|
||||
} else {
|
||||
SwingUtilities.invokeAndWait(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
private void startPlugin() throws MalformedURLException, ClassNotFoundException, InstantiationException, IllegalAccessException, InterruptedException, InvocationTargetException {
|
||||
log.info("Starting plugin " + this);
|
||||
Class clazz = getPluginClass();
|
||||
|
@ -186,7 +194,7 @@ public class Updater {
|
|||
log.info("Not starting second instance");
|
||||
return; // avoid having two instances running
|
||||
}
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
invokeAndWait(() -> {
|
||||
try {
|
||||
instance = (TsPluginBody) clazz.newInstance();
|
||||
replaceWith(instance);
|
||||
|
@ -200,6 +208,7 @@ public class Updater {
|
|||
}
|
||||
|
||||
private static Class getPluginClass() throws MalformedURLException, ClassNotFoundException {
|
||||
log.info("Using " + LOCAL_JAR_FILE_NAME);
|
||||
URLClassLoader jarClassLoader = AutoupdateUtil.getClassLoaderByJar(LOCAL_JAR_FILE_NAME);
|
||||
return Class.forName(PLUGIN_ENTRY_CLASS, true, jarClassLoader);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue