mirror of https://github.com/rusefi/rusefi-1.git
getting SOOOOOOOOOO close
This commit is contained in:
parent
accf9c9341
commit
469ba453c1
|
@ -5,12 +5,15 @@ import com.rusefi.ts_plugin.util.ManifestHelper;
|
||||||
import com.rusefi.tune.xml.Constant;
|
import com.rusefi.tune.xml.Constant;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TsPlugin launcher creates an instance of this class via reflection.
|
* TsPlugin launcher creates an instance of this class via reflection.
|
||||||
*/
|
*/
|
||||||
public class PluginEntry implements TsPluginBody {
|
public class PluginEntry implements TsPluginBody {
|
||||||
|
private final JPanel content = new JPanel(new BorderLayout());
|
||||||
private final JTabbedPane tabbedPane = new JTabbedPane();
|
private final JTabbedPane tabbedPane = new JTabbedPane();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,6 +26,11 @@ public class PluginEntry implements TsPluginBody {
|
||||||
public PluginEntry(Supplier<ControllerAccess> controllerAccessSupplier) {
|
public PluginEntry(Supplier<ControllerAccess> controllerAccessSupplier) {
|
||||||
System.out.println("PluginEntry init " + this);
|
System.out.println("PluginEntry init " + this);
|
||||||
|
|
||||||
|
if (isLauncherTooOld()) {
|
||||||
|
content.add(new JLabel("Please manually install latest plugin version"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UploadTab uploadTab = new UploadTab(controllerAccessSupplier);
|
UploadTab uploadTab = new UploadTab(controllerAccessSupplier);
|
||||||
BroadcastTab broadcastTab = new BroadcastTab();
|
BroadcastTab broadcastTab = new BroadcastTab();
|
||||||
RemoteTab remoteTab = new RemoteTab();
|
RemoteTab remoteTab = new RemoteTab();
|
||||||
|
@ -30,6 +38,19 @@ public class PluginEntry implements TsPluginBody {
|
||||||
tabbedPane.addTab("Upload", uploadTab.getContent());
|
tabbedPane.addTab("Upload", uploadTab.getContent());
|
||||||
tabbedPane.addTab("Broadcast", broadcastTab.getContent());
|
tabbedPane.addTab("Broadcast", broadcastTab.getContent());
|
||||||
tabbedPane.addTab("Remote ECU", remoteTab.getContent());
|
tabbedPane.addTab("Remote ECU", remoteTab.getContent());
|
||||||
|
content.add(tabbedPane);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isLauncherTooOld() {
|
||||||
|
try {
|
||||||
|
// at some point we did not have this field so using reflection for the next couple of months
|
||||||
|
Field field = TsPluginLauncher.class.getField("BUILD_VERSION");
|
||||||
|
int launcherVersion = (int) field.get(null);
|
||||||
|
System.out.println("Launcher version " + launcherVersion + " detected");
|
||||||
|
return false;
|
||||||
|
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEmpty(Constant constant) {
|
public static boolean isEmpty(Constant constant) {
|
||||||
|
@ -44,7 +65,7 @@ public class PluginEntry implements TsPluginBody {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JComponent getContent() {
|
public JComponent getContent() {
|
||||||
return tabbedPane;
|
return content;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
public void close() {
|
public void close() {
|
||||||
|
|
|
@ -10,7 +10,8 @@ import javax.swing.*;
|
||||||
* by the way TS installs stuff into %user%\.efianalytics\TunerStudio\plugins folder
|
* by the way TS installs stuff into %user%\.efianalytics\TunerStudio\plugins folder
|
||||||
*/
|
*/
|
||||||
public class TsPluginLauncher implements ApplicationPlugin {
|
public class TsPluginLauncher implements ApplicationPlugin {
|
||||||
static final String VERSION = "alpha4_2020";
|
public static final int BUILD_VERSION = 3;
|
||||||
|
static final String VERSION = "2020.alpha." + BUILD_VERSION;
|
||||||
private static final String HELP_URL = "https://github.com/rusefi/rusefi/wiki/TS-Plugin";
|
private static final String HELP_URL = "https://github.com/rusefi/rusefi/wiki/TS-Plugin";
|
||||||
|
|
||||||
private final JPanel content = new JPanel(new VerticalFlowLayout());
|
private final JPanel content = new JPanel(new VerticalFlowLayout());
|
||||||
|
|
Loading…
Reference in New Issue