REO progress
This commit is contained in:
parent
933c1cbf61
commit
8aa5126a59
|
@ -35,12 +35,14 @@
|
|||
</copy>
|
||||
|
||||
<tstamp>
|
||||
<format property="TODAY" pattern="yyyy-MM-dd HH:mm:ss"/>
|
||||
<format property="TODAY_DATE" pattern="yyyy-MM-dd"/>
|
||||
</tstamp>
|
||||
|
||||
<jar destfile="${jar_file}" basedir="build/classes">
|
||||
<manifest>
|
||||
<attribute name="Built-Date" value="${TODAY_DATE}"/>
|
||||
<attribute name="Built-Timestamp" value="${TODAY}"/>
|
||||
<attribute name="Signature-Vendor" value="rusEFI LLC"/>
|
||||
</manifest>
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.rusefi.tune.xml.Msq;
|
|||
import com.rusefi.ui.AuthTokenPanel;
|
||||
import com.rusefi.ui.storage.PersistentConfiguration;
|
||||
import com.rusefi.ui.util.URLLabel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.putgemin.VerticalFlowLayout;
|
||||
|
||||
import javax.swing.*;
|
||||
|
@ -28,15 +29,40 @@ import java.util.jar.Manifest;
|
|||
* TsPlugin launcher creates an instance of this class via reflection.
|
||||
*/
|
||||
public class PluginEntry implements TsPluginBody {
|
||||
public static final String BUILT_DATE = "Built-Date";
|
||||
private static final String BUILT_DATE = "Built-Date";
|
||||
private static final String BUILT_TIMESTAMP = "Built-Timestamp";
|
||||
public static final String REO = "https://rusefi.com/online/";
|
||||
private final AuthTokenPanel tokenPanel = new AuthTokenPanel();
|
||||
private final JComponent content = new JPanel(new VerticalFlowLayout());
|
||||
private static final ImageIcon LOGO = AutoupdateUtil.loadIcon("/rusefi_online_color_300.png");
|
||||
|
||||
private final JButton upload = new JButton("Upload Current Tune");
|
||||
private static final JLabel warning = new JLabel("Please open project");
|
||||
|
||||
public PluginEntry() {
|
||||
|
||||
JButton upload = new JButton("Upload Current Tune");
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
while (true) {
|
||||
boolean isProjectActive = getConfigurationName() != null;
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
warning.setVisible(!isProjectActive);
|
||||
upload.setEnabled(isProjectActive);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
upload.addActionListener(new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
@ -55,6 +81,10 @@ public class PluginEntry implements TsPluginBody {
|
|||
}
|
||||
});
|
||||
|
||||
content.add(new JLabel(getAttribute(BUILT_TIMESTAMP)));
|
||||
// content.add(new JLabel("Active project: " + getConfigurationName()));
|
||||
|
||||
content.add(warning);
|
||||
content.add(upload);
|
||||
content.add(new JLabel(LOGO));
|
||||
content.add(tokenPanel.getContent());
|
||||
|
@ -97,7 +127,10 @@ public class PluginEntry implements TsPluginBody {
|
|||
System.out.println("No ControllerAccess");
|
||||
return null;
|
||||
}
|
||||
return controllerAccess.getEcuConfigurationNames()[0];
|
||||
String[] configurationNames = controllerAccess.getEcuConfigurationNames();
|
||||
if (configurationNames.length == 0)
|
||||
return null;
|
||||
return configurationNames[0];
|
||||
}
|
||||
|
||||
private static String toString(double scalarValue, int decimalPlaces) {
|
||||
|
@ -166,6 +199,11 @@ public class PluginEntry implements TsPluginBody {
|
|||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public static String getVersion() {
|
||||
return getAttribute(BUILT_DATE);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String getAttribute(String attributeName) {
|
||||
// all this magic below to make sure we are reading manifest of the *our* jar file not TS main jar file
|
||||
Class clazz = PluginEntry.class;
|
||||
String className = clazz.getSimpleName() + ".class";
|
||||
|
@ -179,12 +217,8 @@ public class PluginEntry implements TsPluginBody {
|
|||
try {
|
||||
Manifest manifest = new Manifest(new URL(manifestPath).openStream());
|
||||
Attributes attributes = manifest.getMainAttributes();
|
||||
System.out.println("Attributed " + attributes);
|
||||
System.out.println("Attributed " + attributes.keySet());
|
||||
System.out.println("Attributed " + attributes.getValue("Class-Path"));
|
||||
System.out.println("Attributed " + attributes.getValue("Main-Class"));
|
||||
|
||||
String result = attributes.getValue(BUILT_DATE);
|
||||
String result = attributes.getValue(attributeName);
|
||||
System.out.println(BUILT_DATE + " " + result);
|
||||
return result == null ? "Unknown version" : result;
|
||||
} catch (IOException e) {
|
||||
|
|
Loading…
Reference in New Issue