auto-sync
This commit is contained in:
parent
a1fc730e2d
commit
9b5b6198fd
|
@ -20,6 +20,7 @@
|
|||
package com.romraider.editor.ecu;
|
||||
|
||||
//import static com.romraider.Version.ECU_DEFS_URL;
|
||||
|
||||
import static com.romraider.Version.PRODUCT_NAME;
|
||||
import static com.romraider.Version.VERSION;
|
||||
import static javax.swing.JOptionPane.DEFAULT_OPTION;
|
||||
|
@ -40,9 +41,7 @@ import java.awt.Dimension;
|
|||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.*;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.io.BufferedReader;
|
||||
|
@ -64,6 +63,7 @@ import javax.swing.JTextArea;
|
|||
import javax.swing.SwingWorker;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import com.rusefi.Launcher;
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
@ -86,8 +86,6 @@ import com.romraider.xml.RomNotFoundException;
|
|||
import com.sun.org.apache.xerces.internal.parsers.DOMParser;
|
||||
|
||||
public class ECUEditor {
|
||||
private static final long serialVersionUID = -7826850987392016292L;
|
||||
|
||||
private final String titleText = PRODUCT_NAME + " v" + VERSION + " | ECU Editor";
|
||||
|
||||
private final RomTreeRootNode imageRoot = new RomTreeRootNode("Open Images");
|
||||
|
@ -106,36 +104,18 @@ public class ECUEditor {
|
|||
private LaunchLoggerWorker launchLoggerWorker;
|
||||
private final ImageIcon editorIcon = new ImageIcon(getClass().getResource("/graphics/romraider-ico.gif"), "RomRaider ECU Editor");
|
||||
|
||||
AbstractFrame frame = new AbstractFrame() {
|
||||
WindowListener wListenr = new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
handleExit();
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void windowOpened(WindowEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowClosed(WindowEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowIconified(WindowEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowDeiconified(WindowEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowActivated(WindowEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowDeactivated(WindowEvent e) {
|
||||
}
|
||||
JPanel content = new JPanel(new BorderLayout());
|
||||
|
||||
/*
|
||||
AbstractFrame frame = new AbstractFrame() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
imageList.updateUI();
|
||||
|
@ -144,7 +124,7 @@ public class ECUEditor {
|
|||
rightPanel.repaint();
|
||||
}
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
public ECUEditor() {
|
||||
Settings settings = SettingsManager.getSettings();
|
||||
|
@ -152,11 +132,11 @@ public class ECUEditor {
|
|||
showReleaseNotes();
|
||||
}
|
||||
|
||||
frame.setSize(settings.getWindowSize());
|
||||
frame.setLocation(settings.getWindowLocation());
|
||||
if (settings.isWindowMaximized()) {
|
||||
frame.setExtendedState(AbstractFrame.MAXIMIZED_BOTH);
|
||||
}
|
||||
// frame.setSize(settings.getWindowSize());
|
||||
// frame.setLocation(settings.getWindowLocation());
|
||||
// if (settings.isWindowMaximized()) {
|
||||
// frame.setExtendedState(AbstractFrame.MAXIMIZED_BOTH);
|
||||
// }
|
||||
|
||||
JScrollPane rightScrollPane = new JScrollPane(rightPanel,
|
||||
VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
|
@ -166,23 +146,29 @@ public class ECUEditor {
|
|||
splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftScrollPane, rightScrollPane);
|
||||
splitPane.setDividerSize(3);
|
||||
splitPane.setDividerLocation(settings.getSplitPaneLocation());
|
||||
splitPane.addPropertyChangeListener(frame);
|
||||
// splitPane.addPropertyChangeListener(frame);
|
||||
splitPane.setContinuousLayout(true);
|
||||
frame.getContentPane().add(splitPane);
|
||||
|
||||
|
||||
content.add(splitPane, BorderLayout.CENTER);
|
||||
|
||||
rightPanel.setBackground(Color.BLACK);
|
||||
imageList.setScrollsOnExpand(true);
|
||||
|
||||
frame.add(statusPanel, BorderLayout.SOUTH);
|
||||
//frame.add(statusPanel, BorderLayout.SOUTH);
|
||||
|
||||
//set remaining window properties
|
||||
frame.setIconImage(editorIcon.getImage());
|
||||
// frame.setIconImage(editorIcon.getImage());
|
||||
|
||||
frame.setDefaultCloseOperation(AbstractFrame.EXIT_ON_CLOSE);
|
||||
frame.addWindowListener(frame);
|
||||
frame.setTitle(titleText);
|
||||
frame.setVisible(true);
|
||||
frame.toFront();
|
||||
// frame.setDefaultCloseOperation(AbstractFrame.EXIT_ON_CLOSE);
|
||||
Launcher.getFrame().addWindowListener(wListenr);
|
||||
// frame.setTitle(titleText);
|
||||
// frame.setVisible(true);
|
||||
// frame.toFront();
|
||||
}
|
||||
|
||||
public JPanel getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public static void openImage(byte[] input, File definitionFile, String fileName) throws Exception {
|
||||
|
@ -203,7 +189,6 @@ public class ECUEditor {
|
|||
// Release mem after unmarshall.
|
||||
parser.reset();
|
||||
doc.removeChild(doc.getDocumentElement());
|
||||
doc = null;
|
||||
fileStream.close();
|
||||
System.gc();
|
||||
}
|
||||
|
@ -224,7 +209,7 @@ public class ECUEditor {
|
|||
public void initializeEditorUI() {
|
||||
//create menubar
|
||||
menuBar = new ECUEditorMenuBar();
|
||||
frame.setJMenuBar(menuBar);
|
||||
// frame.setJMenuBar(menuBar);
|
||||
|
||||
// create toolbars
|
||||
toolBar = new ECUEditorToolBar("Editor Tools");
|
||||
|
@ -239,8 +224,8 @@ public class ECUEditor {
|
|||
toolBarPanel.add(tableToolBar);
|
||||
toolBarPanel.setVisible(true);
|
||||
|
||||
frame.add(toolBarPanel, BorderLayout.NORTH);
|
||||
frame.validate();
|
||||
content.add(toolBarPanel, BorderLayout.NORTH);
|
||||
content.validate();
|
||||
}
|
||||
|
||||
public void checkDefinitions() {
|
||||
|
@ -258,7 +243,7 @@ public class ECUEditor {
|
|||
if (answer == 0) {
|
||||
// BrowserControl.displayURL(ECU_DEFS_URL);
|
||||
} else {
|
||||
showMessageDialog(frame,
|
||||
showMessageDialog(Launcher.getFrame(),
|
||||
"ECU definition files need to be configured before ROM images can be opened.\nMenu: ECU Definitions > ECU Definition Manager...",
|
||||
"Editor Configuration",
|
||||
INFORMATION_MESSAGE);
|
||||
|
@ -287,7 +272,7 @@ public class ECUEditor {
|
|||
JScrollPane scroller = new JScrollPane(releaseNotes, VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_NEVER);
|
||||
scroller.setPreferredSize(new Dimension(600, 500));
|
||||
|
||||
showMessageDialog(frame, scroller,
|
||||
showMessageDialog(Launcher.getFrame(), scroller,
|
||||
PRODUCT_NAME + VERSION + " Release Notes", INFORMATION_MESSAGE);
|
||||
} finally {
|
||||
br.close();
|
||||
|
@ -300,14 +285,14 @@ public class ECUEditor {
|
|||
public void handleExit() {
|
||||
Settings settings = SettingsManager.getSettings();
|
||||
settings.setSplitPaneLocation(splitPane.getDividerLocation());
|
||||
settings.setWindowMaximized(frame.getExtendedState() == frame.MAXIMIZED_BOTH);
|
||||
settings.setWindowSize(frame.getSize());
|
||||
settings.setWindowLocation(frame.getLocation());
|
||||
// settings.setWindowMaximized(frame.getExtendedState() == frame.MAXIMIZED_BOTH);
|
||||
// settings.setWindowSize(frame.getSize());
|
||||
// settings.setWindowLocation(frame.getLocation());
|
||||
|
||||
// Save when exit to save file settings.
|
||||
SettingsManager.save(settings, statusPanel);
|
||||
statusPanel.update("Ready...", 0);
|
||||
frame.repaint();
|
||||
content.repaint();
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
|
@ -326,7 +311,7 @@ public class ECUEditor {
|
|||
|
||||
getImageList().expandPath(new TreePath(input.getPath()));
|
||||
|
||||
if(!settings.isOpenExpanded()) {
|
||||
if (!settings.isOpenExpanded()) {
|
||||
imageList.collapsePath(new TreePath(input.getPath()));
|
||||
}
|
||||
|
||||
|
@ -334,7 +319,7 @@ public class ECUEditor {
|
|||
getImageList().repaint();
|
||||
|
||||
// Only set if no other rom has been selected.
|
||||
if(null == getLastSelectedRom()) {
|
||||
if (null == getLastSelectedRom()) {
|
||||
setLastSelectedRom(input);
|
||||
}
|
||||
|
||||
|
@ -356,17 +341,17 @@ public class ECUEditor {
|
|||
});
|
||||
|
||||
infoPanel.add(check);
|
||||
showMessageDialog(frame, infoPanel, "ECU Revision is Obsolete", INFORMATION_MESSAGE);
|
||||
showMessageDialog(Launcher.getFrame(), infoPanel, "ECU Revision is Obsolete", INFORMATION_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
public void displayTable(TableFrame frame) {
|
||||
try {
|
||||
// check if frame has been added.
|
||||
for(JInternalFrame curFrame : getRightPanel().getAllFrames()) {
|
||||
if(curFrame.equals(frame)) {
|
||||
for (JInternalFrame curFrame : getRightPanel().getAllFrames()) {
|
||||
if (curFrame.equals(frame)) {
|
||||
// table is already open.
|
||||
if(1 == SettingsManager.getSettings().getTableClickBehavior()) { // open/focus frame
|
||||
if (1 == SettingsManager.getSettings().getTableClickBehavior()) { // open/focus frame
|
||||
// table is already open, so set focus on the frame.
|
||||
boolean selected = true;
|
||||
frame.toFront();
|
||||
|
@ -376,7 +361,7 @@ public class ECUEditor {
|
|||
frame.toBack();
|
||||
selected = false;
|
||||
}
|
||||
if(selected) {
|
||||
if (selected) {
|
||||
frame.requestFocusInWindow();
|
||||
}
|
||||
} else { // default to open/close frame
|
||||
|
@ -415,7 +400,7 @@ public class ECUEditor {
|
|||
}
|
||||
|
||||
public void closeImage() {
|
||||
frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
Launcher.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
closeImageWorker = new CloseImageWorker(getLastSelectedRom());
|
||||
closeImageWorker.addPropertyChangeListener(getStatusPanel());
|
||||
closeImageWorker.execute();
|
||||
|
@ -438,11 +423,11 @@ public class ECUEditor {
|
|||
|
||||
public void setLastSelectedRom(Rom lastSelectedRom) {
|
||||
this.lastSelectedRom = lastSelectedRom;
|
||||
if (lastSelectedRom == null) {
|
||||
frame.setTitle(titleText);
|
||||
} else {
|
||||
frame.setTitle(titleText + " - " + lastSelectedRom.getFileName());
|
||||
}
|
||||
// if (lastSelectedRom == null) {
|
||||
// frame.setTitle(titleText);
|
||||
// } else {
|
||||
// frame.setTitle(titleText + " - " + lastSelectedRom.getFileName());
|
||||
// }
|
||||
}
|
||||
|
||||
public ECUEditorToolBar getToolBar() {
|
||||
|
@ -466,7 +451,7 @@ public class ECUEditor {
|
|||
}
|
||||
|
||||
public void setUserLevel(int userLevel) {
|
||||
frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
content.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
SettingsManager.getSettings().setUserLevel(userLevel);
|
||||
setUserLevelWorker = new SetUserLevelWorker();
|
||||
setUserLevelWorker.addPropertyChangeListener(getStatusPanel());
|
||||
|
@ -476,9 +461,9 @@ public class ECUEditor {
|
|||
public Vector<Rom> getImages() {
|
||||
Vector<Rom> images = new Vector<>();
|
||||
for (int i = 0; i < imageRoot.getChildCount(); i++) {
|
||||
if(imageRoot.getChildAt(i) instanceof Rom) {
|
||||
if (imageRoot.getChildAt(i) instanceof Rom) {
|
||||
Rom rom = (Rom) imageRoot.getChildAt(i);
|
||||
if(null != rom) {
|
||||
if (null != rom) {
|
||||
images.add(rom);
|
||||
}
|
||||
}
|
||||
|
@ -486,8 +471,7 @@ public class ECUEditor {
|
|||
return images;
|
||||
}
|
||||
|
||||
public void refreshUI()
|
||||
{
|
||||
public void refreshUI() {
|
||||
getToolBar().updateButtons();
|
||||
getEditorMenuBar().updateMenu();
|
||||
getTableToolBar().updateTableToolBar();
|
||||
|
@ -499,9 +483,9 @@ public class ECUEditor {
|
|||
|
||||
public void refreshTableCompareMenus() {
|
||||
for (int i = 0; i < imageRoot.getChildCount(); i++) {
|
||||
if(imageRoot.getChildAt(i) instanceof Rom) {
|
||||
if (imageRoot.getChildAt(i) instanceof Rom) {
|
||||
Rom rom = (Rom) imageRoot.getChildAt(i);
|
||||
if(null != rom) {
|
||||
if (null != rom) {
|
||||
rom.refreshTableCompareMenus();
|
||||
}
|
||||
}
|
||||
|
@ -509,7 +493,7 @@ public class ECUEditor {
|
|||
}
|
||||
|
||||
public void openImage(File inputFile) throws Exception {
|
||||
frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
Launcher.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
openImageWorker = new OpenImageWorker(inputFile);
|
||||
openImageWorker.addPropertyChangeListener(getStatusPanel());
|
||||
openImageWorker.execute();
|
||||
|
@ -528,7 +512,7 @@ public class ECUEditor {
|
|||
}
|
||||
|
||||
public void launchLogger() {
|
||||
frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
Launcher.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
// launchLoggerWorker = new LaunchLoggerWorker();
|
||||
// launchLoggerWorker.addPropertyChangeListener(getStatusPanel());
|
||||
// launchLoggerWorker.execute();
|
||||
|
@ -549,10 +533,6 @@ public class ECUEditor {
|
|||
public MDIDesktopPane getRightPanel() {
|
||||
return this.rightPanel;
|
||||
}
|
||||
|
||||
public AbstractFrame getFrame() {
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
||||
class LaunchLoggerWorker extends SwingWorker<Void, Void> {
|
||||
|
@ -568,12 +548,10 @@ class LaunchLoggerWorker extends SwingWorker<Void, Void> {
|
|||
return null;
|
||||
}
|
||||
|
||||
public void propertyChange(PropertyChangeEvent evnt)
|
||||
{
|
||||
public void propertyChange(PropertyChangeEvent evnt) {
|
||||
SwingWorker source = (SwingWorker) evnt.getSource();
|
||||
if (null != source && "state".equals( evnt.getPropertyName() )
|
||||
&& (source.isDone() || source.isCancelled() ) )
|
||||
{
|
||||
if (null != source && "state".equals(evnt.getPropertyName())
|
||||
&& (source.isDone() || source.isCancelled())) {
|
||||
source.removePropertyChangeListener(ECUEditorManager.getECUEditor().getStatusPanel());
|
||||
}
|
||||
}
|
||||
|
@ -583,7 +561,7 @@ class LaunchLoggerWorker extends SwingWorker<Void, Void> {
|
|||
ECUEditor editor = ECUEditorManager.getECUEditor();
|
||||
editor.getStatusPanel().setStatus("Ready...");
|
||||
setProgress(0);
|
||||
editor.frame.setCursor(null);
|
||||
Launcher.getFrame().setCursor(null);
|
||||
editor.refreshUI();
|
||||
}
|
||||
}
|
||||
|
@ -594,18 +572,16 @@ class SetUserLevelWorker extends SwingWorker<Void, Void> {
|
|||
|
||||
@Override
|
||||
protected Void doInBackground() throws Exception {
|
||||
for(Rom rom : ECUEditorManager.getECUEditor().getImages()) {
|
||||
for (Rom rom : ECUEditorManager.getECUEditor().getImages()) {
|
||||
rom.refreshDisplayedTables();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void propertyChange(PropertyChangeEvent evnt)
|
||||
{
|
||||
public void propertyChange(PropertyChangeEvent evnt) {
|
||||
SwingWorker source = (SwingWorker) evnt.getSource();
|
||||
if (null != source && "state".equals( evnt.getPropertyName() )
|
||||
&& (source.isDone() || source.isCancelled() ) )
|
||||
{
|
||||
if (null != source && "state".equals(evnt.getPropertyName())
|
||||
&& (source.isDone() || source.isCancelled())) {
|
||||
source.removePropertyChangeListener(ECUEditorManager.getECUEditor().getStatusPanel());
|
||||
}
|
||||
}
|
||||
|
@ -615,7 +591,7 @@ class SetUserLevelWorker extends SwingWorker<Void, Void> {
|
|||
ECUEditor editor = ECUEditorManager.getECUEditor();
|
||||
editor.getStatusPanel().setStatus("Ready...");
|
||||
setProgress(0);
|
||||
editor.frame.setCursor(null);
|
||||
Launcher.getFrame().setCursor(null);
|
||||
editor.refreshUI();
|
||||
}
|
||||
}
|
||||
|
@ -653,7 +629,7 @@ class CloseImageWorker extends SwingWorker<Void, Void> {
|
|||
ECUEditor editor = ECUEditorManager.getECUEditor();
|
||||
editor.getStatusPanel().setStatus("Ready...");
|
||||
setProgress(0);
|
||||
editor.frame.setCursor(null);
|
||||
Launcher.getFrame().setCursor(null);
|
||||
editor.refreshUI();
|
||||
System.gc();
|
||||
}
|
||||
|
@ -688,7 +664,7 @@ class OpenImageWorker extends SwingWorker<Void, Void> {
|
|||
|
||||
ECUEditor.openImage(input, definitionFile, inputFile.getName());
|
||||
setProgress(100);
|
||||
return null;
|
||||
return null;
|
||||
|
||||
} catch (RomNotFoundException rex) {
|
||||
// rom was not found in current file, skip to next
|
||||
|
@ -696,33 +672,31 @@ class OpenImageWorker extends SwingWorker<Void, Void> {
|
|||
}
|
||||
|
||||
// if code executes to this point, no ROM was found, report to user
|
||||
showMessageDialog(editor.frame, "ECU Definition Not Found", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
||||
showMessageDialog(Launcher.getFrame(), "ECU Definition Not Found", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
||||
|
||||
} catch (SAXParseException spe) {
|
||||
// catch general parsing exception - enough people don't unzip the defs that a better error message is in order
|
||||
showMessageDialog(editor.frame, "Unable to read XML definitions. Please make sure the definition file is correct. If it is in a ZIP archive, unzip the file and try again.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
||||
showMessageDialog(Launcher.getFrame(), "Unable to read XML definitions. Please make sure the definition file is correct. If it is in a ZIP archive, unzip the file and try again.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
||||
|
||||
} catch (StackOverflowError ex) {
|
||||
// handles looped inheritance, which will use up all available memory
|
||||
showMessageDialog(editor.frame, "Looped \"base\" attribute in XML definitions.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
||||
showMessageDialog(Launcher.getFrame(), "Looped \"base\" attribute in XML definitions.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
||||
|
||||
} catch (OutOfMemoryError ome) {
|
||||
// handles Java heap space issues when loading multiple Roms.
|
||||
showMessageDialog(editor.frame, "Error loading Image. Out of memeory.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
||||
showMessageDialog(Launcher.getFrame(), "Error loading Image. Out of memeory.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
||||
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
showMessageDialog(editor.frame, "Error Loading. Unknown Exception.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
||||
showMessageDialog(Launcher.getFrame(), "Error Loading. Unknown Exception.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void propertyChange(PropertyChangeEvent evnt)
|
||||
{
|
||||
public void propertyChange(PropertyChangeEvent evnt) {
|
||||
SwingWorker source = (SwingWorker) evnt.getSource();
|
||||
if (null != source && "state".equals( evnt.getPropertyName() )
|
||||
&& (source.isDone() || source.isCancelled() ) )
|
||||
{
|
||||
if (null != source && "state".equals(evnt.getPropertyName())
|
||||
&& (source.isDone() || source.isCancelled())) {
|
||||
source.removePropertyChangeListener(ECUEditorManager.getECUEditor().getStatusPanel());
|
||||
}
|
||||
}
|
||||
|
@ -732,7 +706,7 @@ class OpenImageWorker extends SwingWorker<Void, Void> {
|
|||
ECUEditor editor = ECUEditorManager.getECUEditor();
|
||||
editor.getStatusPanel().setStatus("Ready...");
|
||||
setProgress(0);
|
||||
editor.frame.setCursor(null);
|
||||
Launcher.getFrame().setCursor(null);
|
||||
editor.refreshUI();
|
||||
System.gc();
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ import com.romraider.swing.TableToolBar;
|
|||
import com.romraider.util.JEPUtil;
|
||||
import com.romraider.util.SettingsManager;
|
||||
import com.romraider.xml.RomAttributeParser;
|
||||
import com.rusefi.Launcher;
|
||||
|
||||
public abstract class Table extends JPanel implements Serializable {
|
||||
private static final long serialVersionUID = 6559256489995552645L;
|
||||
|
@ -1030,7 +1031,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
ancestorWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
}
|
||||
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
Launcher.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
copySelectionWorker = new CopySelectionWorker(this);
|
||||
copySelectionWorker.execute();
|
||||
|
@ -1052,7 +1053,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
if(null != ancestorWindow) {
|
||||
ancestorWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
}
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
Launcher.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
copyTableWorker = new CopyTableWorker(this);
|
||||
copyTableWorker.execute();
|
||||
|
@ -1446,7 +1447,7 @@ class CopySelectionWorker extends SwingWorker<Void, Void> {
|
|||
ancestorWindow.setCursor(null);
|
||||
}
|
||||
table.setCursor(null);
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(null);
|
||||
Launcher.getFrame().setCursor(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1473,6 +1474,6 @@ class CopyTableWorker extends SwingWorker<Void, Void> {
|
|||
ancestorWindow.setCursor(null);
|
||||
}
|
||||
table.setCursor(null);
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(null);
|
||||
Launcher.getFrame().setCursor(null);
|
||||
}
|
||||
}
|
|
@ -41,6 +41,7 @@ import javax.swing.SwingWorker;
|
|||
import com.romraider.Settings;
|
||||
import com.romraider.editor.ecu.ECUEditorManager;
|
||||
import com.romraider.util.SettingsManager;
|
||||
import com.rusefi.Launcher;
|
||||
|
||||
public class Table2D extends Table {
|
||||
private static final long serialVersionUID = -7684570967109324784L;
|
||||
|
@ -249,7 +250,7 @@ public class Table2D extends Table {
|
|||
if(null != ancestorWindow) {
|
||||
ancestorWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
}
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
Launcher.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
super.copySelection();
|
||||
copySelection2DWorker = new CopySelection2DWorker(this);
|
||||
|
@ -262,7 +263,7 @@ public class Table2D extends Table {
|
|||
if(null != ancestorWindow) {
|
||||
ancestorWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
}
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
Launcher.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
copyTable2DWorker = new CopyTable2DWorker(this);
|
||||
copyTable2DWorker.execute();
|
||||
|
@ -473,7 +474,7 @@ class CopySelection2DWorker extends SwingWorker<Void, Void> {
|
|||
ancestorWindow.setCursor(null);
|
||||
}
|
||||
table.setCursor(null);
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(null);
|
||||
Launcher.getFrame().setCursor(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -504,6 +505,6 @@ class CopyTable2DWorker extends SwingWorker<Void, Void> {
|
|||
ancestorWindow.setCursor(null);
|
||||
}
|
||||
table.setCursor(null);
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(null);
|
||||
Launcher.getFrame().setCursor(null);
|
||||
}
|
||||
}
|
|
@ -47,6 +47,7 @@ import com.romraider.editor.ecu.ECUEditorManager;
|
|||
import com.romraider.logger.ecu.ui.swing.vertical.VerticalLabelUI;
|
||||
import com.romraider.util.SettingsManager;
|
||||
import com.romraider.xml.RomAttributeParser;
|
||||
import com.rusefi.Launcher;
|
||||
|
||||
public class Table3D extends Table {
|
||||
|
||||
|
@ -676,11 +677,10 @@ public class Table3D extends Table {
|
|||
if(null != ancestorWindow) {
|
||||
ancestorWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
}
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
Launcher.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
copySelection3DWorker = new CopySelection3DWorker(this);
|
||||
copySelection3DWorker.execute();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -689,7 +689,7 @@ public class Table3D extends Table {
|
|||
if(null != ancestorWindow) {
|
||||
ancestorWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
}
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
Launcher.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
copyTable3DWorker = new CopyTable3DWorker(this);
|
||||
copyTable3DWorker.execute();
|
||||
|
@ -1109,7 +1109,7 @@ class CopySelection3DWorker extends SwingWorker<Void, Void> {
|
|||
ancestorWindow.setCursor(null);
|
||||
}
|
||||
table.setCursor(null);
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(null);
|
||||
Launcher.getFrame().setCursor(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1137,6 +1137,6 @@ class CopyTable3DWorker extends SwingWorker<Void, Void> {
|
|||
ancestorWindow.setCursor(null);
|
||||
}
|
||||
table.setCursor(null);
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(null);
|
||||
Launcher.getFrame().setCursor(null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.beans.PropertyChangeEvent;
|
|||
import java.beans.PropertyChangeListener;
|
||||
|
||||
|
||||
public abstract class AbstractFrame extends JFrame implements WindowListener, PropertyChangeListener {
|
||||
public abstract class AbstractFrame extends JFrame implements PropertyChangeListener {
|
||||
public AbstractFrame() throws HeadlessException {
|
||||
super();
|
||||
}
|
||||
|
@ -37,29 +37,4 @@ public abstract class AbstractFrame extends JFrame implements WindowListener, Pr
|
|||
}
|
||||
|
||||
private static final long serialVersionUID = 7948304087075622157L;
|
||||
|
||||
public void windowActivated(WindowEvent arg0) {
|
||||
}
|
||||
|
||||
public void windowClosed(WindowEvent e) {
|
||||
}
|
||||
|
||||
public void windowClosing(WindowEvent e) {
|
||||
}
|
||||
|
||||
public void windowDeactivated(WindowEvent e) {
|
||||
}
|
||||
|
||||
public void windowDeiconified(WindowEvent e) {
|
||||
}
|
||||
|
||||
public void windowIconified(WindowEvent e) {
|
||||
}
|
||||
|
||||
public void windowOpened(WindowEvent e) {
|
||||
}
|
||||
|
||||
public void propertyChange(PropertyChangeEvent arg0) {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import javax.swing.ListSelectionModel;
|
|||
|
||||
import com.romraider.editor.ecu.ECUEditorManager;
|
||||
import com.romraider.util.SettingsManager;
|
||||
import com.rusefi.Launcher;
|
||||
|
||||
public class DefinitionManager extends javax.swing.JFrame implements ActionListener {
|
||||
|
||||
|
@ -40,7 +41,7 @@ public class DefinitionManager extends javax.swing.JFrame implements ActionListe
|
|||
Vector<String> fileNames;
|
||||
|
||||
public DefinitionManager() {
|
||||
this.setIconImage(ECUEditorManager.getECUEditor().getFrame().getIconImage());
|
||||
this.setIconImage(Launcher.getFrame().getIconImage());
|
||||
initComponents();
|
||||
initSettings();
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import com.romraider.editor.ecu.ECUEditorManager;
|
|||
import com.romraider.maps.Rom;
|
||||
import com.romraider.maps.Table;
|
||||
import com.romraider.util.SettingsManager;
|
||||
import com.rusefi.Launcher;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
@ -339,17 +340,17 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
|||
|
||||
//} else
|
||||
if (e.getSource() == romProperties) {
|
||||
showMessageDialog(parent.getFrame(), new RomPropertyPanel(parent.getLastSelectedRom()),
|
||||
showMessageDialog(Launcher.getFrame(), new RomPropertyPanel(parent.getLastSelectedRom()),
|
||||
parent.getLastSelectedRom().getRomIDString() + " Properties", INFORMATION_MESSAGE);
|
||||
|
||||
} else if (e.getSource() == settings) {
|
||||
SettingsForm form = new SettingsForm();
|
||||
form.setLocationRelativeTo(parent.getFrame());
|
||||
form.setLocationRelativeTo(Launcher.getFrame());
|
||||
form.setVisible(true);
|
||||
|
||||
} else if (e.getSource() == compareImages){
|
||||
CompareImagesForm form = new CompareImagesForm(parent.getImages(), parent.getFrame().getIconImage());
|
||||
form.setLocationRelativeTo(parent.getFrame());
|
||||
CompareImagesForm form = new CompareImagesForm(parent.getImages(), Launcher.getFrame().getIconImage());
|
||||
form.setLocationRelativeTo(Launcher.getFrame());
|
||||
form.setVisible(true);
|
||||
|
||||
} else if (e.getSource() == level1) {
|
||||
|
@ -382,7 +383,7 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
|||
+ "Build #: " + BUILDNUMBER + "\n"
|
||||
+ SUPPORT_URL;
|
||||
String title = "About " + PRODUCT_NAME;
|
||||
showMessageDialog(parent.getFrame(), message, title, INFORMATION_MESSAGE, ABOUT_ICON);
|
||||
showMessageDialog(Launcher.getFrame(), message, title, INFORMATION_MESSAGE, ABOUT_ICON);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -401,10 +402,10 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
|||
ECUEditor parent = ECUEditorManager.getECUEditor();
|
||||
JFileChooser fc = new JFileChooser(SettingsManager.getSettings().getLastImageDir());
|
||||
fc.setFileFilter(new ECUImageFilter());
|
||||
if (fc.showSaveDialog(parent.getFrame()) == JFileChooser.APPROVE_OPTION) {
|
||||
if (fc.showSaveDialog(Launcher.getFrame()) == JFileChooser.APPROVE_OPTION) {
|
||||
File selectedFile = fc.getSelectedFile();
|
||||
if (selectedFile.exists()) {
|
||||
int option = showConfirmDialog(parent.getFrame(), selectedFile.getName() + " already exists! Overwrite?");
|
||||
int option = showConfirmDialog(Launcher.getFrame(), selectedFile.getName() + " already exists! Overwrite?");
|
||||
|
||||
// option: 0 = Cancel, 1 = No
|
||||
if (option == CANCEL_OPTION || option == 1) {
|
||||
|
@ -438,10 +439,10 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
|||
// disable the "All files" option
|
||||
fc.setAcceptAllFileFilterUsed(false);
|
||||
|
||||
if (fc.showSaveDialog(ECUEditorManager.getECUEditor().getFrame()) == JFileChooser.APPROVE_OPTION) {
|
||||
if (fc.showSaveDialog(Launcher.getFrame()) == JFileChooser.APPROVE_OPTION) {
|
||||
File selectedDir = fc.getSelectedFile();
|
||||
if (selectedDir.exists()) {
|
||||
int option = showConfirmDialog(ECUEditorManager.getECUEditor().getFrame(), selectedDir.getName() + " already exists! Overwrite?");
|
||||
int option = showConfirmDialog(Launcher.getFrame(), selectedDir.getName() + " already exists! Overwrite?");
|
||||
|
||||
// option: 0 = Cancel, 1 = No
|
||||
if (option == CANCEL_OPTION || option == 1) {
|
||||
|
@ -498,7 +499,7 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
|||
if(null != selectedFile){
|
||||
if(lastSelectedRom.getRealFileSize() != Settings.SIXTEENBIT_SMALL_SIZE)
|
||||
{
|
||||
showMessageDialog(ECUEditorManager.getECUEditor().getFrame(), "Error converting image. Image size is invalid.");
|
||||
showMessageDialog(Launcher.getFrame(), "Error converting image. Image size is invalid.");
|
||||
} else {
|
||||
byte[] output = lastSelectedRom.saveFile();
|
||||
byte[] incOutput = new byte[Settings.SIXTEENBIT_LARGE_SIZE];
|
||||
|
@ -521,7 +522,7 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
|||
if(null != selectedFile){
|
||||
if(lastSelectedRom.getRealFileSize() != Settings.SIXTEENBIT_LARGE_SIZE)
|
||||
{
|
||||
showMessageDialog(ECUEditorManager.getECUEditor().getFrame(), "Error converting image. Image size is invalid.");
|
||||
showMessageDialog(Launcher.getFrame(), "Error converting image. Image size is invalid.");
|
||||
} else {
|
||||
byte[] output =lastSelectedRom.saveFile();
|
||||
byte[] decOutput = new byte[Settings.SIXTEENBIT_SMALL_SIZE];
|
||||
|
|
|
@ -53,13 +53,14 @@ import com.romraider.editor.ecu.ECUEditor;
|
|||
import com.romraider.editor.ecu.ECUEditorManager;
|
||||
//import com.romraider.util.FileAssociator;
|
||||
import com.romraider.util.SettingsManager;
|
||||
import com.rusefi.Launcher;
|
||||
|
||||
public class SettingsForm extends JFrame implements MouseListener {
|
||||
|
||||
private static final long serialVersionUID = 3910602424260147767L;
|
||||
|
||||
public SettingsForm() {
|
||||
this.setIconImage(getEditor().getFrame().getIconImage());
|
||||
this.setIconImage(Launcher.getFrame().getIconImage());
|
||||
initComponents();
|
||||
initSettings();
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.List;
|
|||
import javax.management.modelmbean.XMLParseException;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import com.rusefi.Launcher;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
@ -369,7 +370,7 @@ public final class DOMRomUnmarshaller {
|
|||
} catch (InvalidTableNameException ex) { // Table name is invalid, do nothing.
|
||||
|
||||
} catch (NullPointerException ex) {
|
||||
JOptionPane.showMessageDialog(ECUEditorManager.getECUEditor().getFrame(),
|
||||
JOptionPane.showMessageDialog(Launcher.getFrame(),
|
||||
new DebugPanel(ex, SettingsManager.getSettings().getSupportURL()), "Exception",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
|
||||
|
@ -581,7 +582,7 @@ public final class DOMRomUnmarshaller {
|
|||
|
||||
} catch (Exception ex) {
|
||||
JOptionPane.showMessageDialog(
|
||||
ECUEditorManager.getECUEditor().getFrame(),
|
||||
Launcher.getFrame(),
|
||||
new DebugPanel(ex, SettingsManager.getSettings()
|
||||
.getSupportURL()), "Exception",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
|
|
|
@ -16,6 +16,9 @@ import com.rusefi.ui.util.FrameHelper;
|
|||
import jssc.SerialPortList;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.TableCellEditor;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
||||
|
||||
|
@ -30,7 +33,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see com.rusefi.ui.engine.EngineSnifferPanel
|
||||
* @see com.rusefi.StartupFrame
|
||||
*/
|
||||
public class Launcher extends FrameHelper {
|
||||
public class Launcher {
|
||||
public static final int CONSOLE_VERSION = 20150310;
|
||||
public static final boolean SHOW_STIMULATOR = false;
|
||||
public static final String TAB_INDEX = "main_tab";
|
||||
|
@ -39,8 +42,26 @@ public class Launcher extends FrameHelper {
|
|||
|
||||
public static int defaultFontSize;
|
||||
|
||||
private static Frame staticFrame;
|
||||
TableEditor tableEditor = new TableEditor();
|
||||
|
||||
FrameHelper frame = new FrameHelper() {
|
||||
@Override
|
||||
protected void onWindowOpened() {
|
||||
super.onWindowOpened();
|
||||
windowOpenedHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onWindowClosed() {
|
||||
super.onWindowClosed();
|
||||
windowClosedHandler();
|
||||
}
|
||||
};
|
||||
|
||||
public Launcher(String port) {
|
||||
this.port = port;
|
||||
staticFrame = frame.getFrame();
|
||||
FileLog.MAIN.start();
|
||||
|
||||
LinkManager.start(port);
|
||||
|
@ -58,6 +79,9 @@ public class Launcher extends FrameHelper {
|
|||
tabbedPane.addTab("Engine Sniffer", engineSnifferPanel.getPanel());
|
||||
tabbedPane.addTab("Sensor Sniffer", new AnalogChartPanel().getPanel());
|
||||
|
||||
|
||||
tabbedPane.addTab("Table Editor", tableEditor);
|
||||
|
||||
tabbedPane.addTab("LE controls", new FlexibleControls().getPanel());
|
||||
|
||||
// tabbedPane.addTab("ADC", new AdcPanel(new BooleanInputsModel()).createAdcPanel());
|
||||
|
@ -77,13 +101,11 @@ public class Launcher extends FrameHelper {
|
|||
tabbedPane.setSelectedIndex(selectedIndex);
|
||||
}
|
||||
|
||||
StartupFrame.setAppIcon(frame);
|
||||
showFrame(tabbedPane);
|
||||
StartupFrame.setAppIcon(frame.getFrame());
|
||||
frame.showFrame(tabbedPane);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onWindowOpened() {
|
||||
super.onWindowOpened();
|
||||
private void windowOpenedHandler() {
|
||||
setTitle("N/A");
|
||||
|
||||
LinkManager.open(new LinkManager.LinkStateListener() {
|
||||
|
@ -93,11 +115,7 @@ public class Launcher extends FrameHelper {
|
|||
|
||||
@Override
|
||||
public void onConnectionEstablished() {
|
||||
try {
|
||||
BinaryProtocolCmd.doShowImage(BinaryProtocol.instance.getController());
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
tableEditor.showContent();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -111,14 +129,12 @@ public class Launcher extends FrameHelper {
|
|||
}
|
||||
|
||||
private void setTitle(String value) {
|
||||
frame.setTitle("Console " + CONSOLE_VERSION + "; firmware=" + value + "@" + port);
|
||||
frame.getFrame().setTitle("Console " + CONSOLE_VERSION + "; firmware=" + value + "@" + port);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onWindowClosed() {
|
||||
super.onWindowClosed();
|
||||
private void windowClosedHandler() {
|
||||
/**
|
||||
* looks like reconnectTimer in {@link RpmPanel} keeps AWT alive. Simplest solution would be to 'exit'
|
||||
* looks like reconnectTimer in {@link com.rusefi.ui.RpmPanel} keeps AWT alive. Simplest solution would be to 'exit'
|
||||
*/
|
||||
SimulatorHelper.onWindowClosed();
|
||||
Node root = getConfig().getRoot();
|
||||
|
@ -155,4 +171,8 @@ public class Launcher extends FrameHelper {
|
|||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static Frame getFrame() {
|
||||
return staticFrame;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,17 +27,19 @@ public class RomRaiderWrapper {
|
|||
}
|
||||
|
||||
public static ECUEditor startRomRaider() {
|
||||
Settings settings = SettingsManager.getSettings();
|
||||
settings.getEcuDefinitionFiles().clear();
|
||||
init();
|
||||
|
||||
settings.addEcuDefinitionFile(new File(DEFINITION_FILE));
|
||||
|
||||
LogManager.initDebugLogging();
|
||||
|
||||
LookAndFeelManager.initLookAndFeel();
|
||||
// LookAndFeelManager.initLookAndFeel();
|
||||
|
||||
ECUEditor editor = getECUEditor();
|
||||
editor.initializeEditorUI();
|
||||
return editor;
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
Settings settings = SettingsManager.getSettings();
|
||||
settings.getEcuDefinitionFiles().clear();
|
||||
settings.addEcuDefinitionFile(new File(DEFINITION_FILE));
|
||||
LogManager.initDebugLogging();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package com.rusefi;
|
||||
|
||||
import com.romraider.editor.ecu.ECUEditor;
|
||||
import com.romraider.util.SettingsManager;
|
||||
import com.rusefi.binaryprotocol.BinaryProtocol;
|
||||
import com.rusefi.binaryprotocol.BinaryProtocolCmd;
|
||||
import com.rusefi.ui.util.UiUtils;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
import static com.romraider.editor.ecu.ECUEditorManager.getECUEditor;
|
||||
|
||||
public class TableEditor extends JPanel {
|
||||
|
||||
public TableEditor() {
|
||||
super(new BorderLayout());
|
||||
add(new JLabel("Loading tables"), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
public void showContent() {
|
||||
removeAll();
|
||||
if (!BinaryProtocolCmd.checkForDefinitionFile())
|
||||
return;
|
||||
try {
|
||||
RomRaiderWrapper.init();
|
||||
|
||||
ECUEditor editor = getECUEditor();
|
||||
editor.initializeEditorUI();
|
||||
|
||||
add(editor.getContent());
|
||||
|
||||
|
||||
ConfigurationImage image = BinaryProtocol.instance.getController();
|
||||
ECUEditor.openImage(image.getFileContent(), SettingsManager.getSettings().getEcuDefinitionFiles().elementAt(0),
|
||||
"rusEfi");
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
UiUtils.trueLayout(this);
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -49,15 +49,21 @@ public class BinaryProtocolCmd {
|
|||
}
|
||||
|
||||
public static void doShowImage(ConfigurationImage image) throws Exception {
|
||||
if (!new File(RomRaiderWrapper.DEFINITION_FILE).exists()) {
|
||||
JOptionPane.showMessageDialog(null, RomRaiderWrapper.DEFINITION_FILE + " not found, turning off table editor");
|
||||
if (!checkForDefinitionFile())
|
||||
return;
|
||||
}
|
||||
RomRaiderWrapper.startRomRaider();
|
||||
ECUEditor.openImage(image.getFileContent(), SettingsManager.getSettings().getEcuDefinitionFiles().elementAt(0),
|
||||
"rusEfi");
|
||||
}
|
||||
|
||||
public static boolean checkForDefinitionFile() {
|
||||
if (!new File(RomRaiderWrapper.DEFINITION_FILE).exists()) {
|
||||
JOptionPane.showMessageDialog(null, RomRaiderWrapper.DEFINITION_FILE + " not found, turning off table editor");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void scheduleBurn(ConfigurationImage newVersion) {
|
||||
UploadChanges.scheduleBurn(newVersion, bp);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue