auto-sync
This commit is contained in:
parent
17bcd7c50b
commit
a1fc730e2d
|
@ -66,7 +66,6 @@ import javax.swing.tree.TreePath;
|
|||
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
import com.romraider.Settings;
|
||||
|
@ -86,7 +85,7 @@ import com.romraider.xml.DOMRomUnmarshaller;
|
|||
import com.romraider.xml.RomNotFoundException;
|
||||
import com.sun.org.apache.xerces.internal.parsers.DOMParser;
|
||||
|
||||
public class ECUEditor extends AbstractFrame {
|
||||
public class ECUEditor {
|
||||
private static final long serialVersionUID = -7826850987392016292L;
|
||||
|
||||
private final String titleText = PRODUCT_NAME + " v" + VERSION + " | ECU Editor";
|
||||
|
@ -107,16 +106,56 @@ public class ECUEditor extends AbstractFrame {
|
|||
private LaunchLoggerWorker launchLoggerWorker;
|
||||
private final ImageIcon editorIcon = new ImageIcon(getClass().getResource("/graphics/romraider-ico.gif"), "RomRaider ECU Editor");
|
||||
|
||||
AbstractFrame frame = new AbstractFrame() {
|
||||
@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) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
imageList.updateUI();
|
||||
imageList.repaint();
|
||||
rightPanel.updateUI();
|
||||
rightPanel.repaint();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public ECUEditor() {
|
||||
Settings settings = SettingsManager.getSettings();
|
||||
if (!settings.getRecentVersion().equalsIgnoreCase(VERSION)) {
|
||||
showReleaseNotes();
|
||||
}
|
||||
|
||||
setSize(settings.getWindowSize());
|
||||
setLocation(settings.getWindowLocation());
|
||||
frame.setSize(settings.getWindowSize());
|
||||
frame.setLocation(settings.getWindowLocation());
|
||||
if (settings.isWindowMaximized()) {
|
||||
setExtendedState(MAXIMIZED_BOTH);
|
||||
frame.setExtendedState(AbstractFrame.MAXIMIZED_BOTH);
|
||||
}
|
||||
|
||||
JScrollPane rightScrollPane = new JScrollPane(rightPanel,
|
||||
|
@ -127,23 +166,23 @@ public class ECUEditor extends AbstractFrame {
|
|||
splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftScrollPane, rightScrollPane);
|
||||
splitPane.setDividerSize(3);
|
||||
splitPane.setDividerLocation(settings.getSplitPaneLocation());
|
||||
splitPane.addPropertyChangeListener(this);
|
||||
splitPane.addPropertyChangeListener(frame);
|
||||
splitPane.setContinuousLayout(true);
|
||||
getContentPane().add(splitPane);
|
||||
frame.getContentPane().add(splitPane);
|
||||
|
||||
rightPanel.setBackground(Color.BLACK);
|
||||
imageList.setScrollsOnExpand(true);
|
||||
|
||||
this.add(statusPanel, BorderLayout.SOUTH);
|
||||
frame.add(statusPanel, BorderLayout.SOUTH);
|
||||
|
||||
//set remaining window properties
|
||||
setIconImage(editorIcon.getImage());
|
||||
frame.setIconImage(editorIcon.getImage());
|
||||
|
||||
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||
addWindowListener(this);
|
||||
setTitle(titleText);
|
||||
setVisible(true);
|
||||
toFront();
|
||||
frame.setDefaultCloseOperation(AbstractFrame.EXIT_ON_CLOSE);
|
||||
frame.addWindowListener(frame);
|
||||
frame.setTitle(titleText);
|
||||
frame.setVisible(true);
|
||||
frame.toFront();
|
||||
}
|
||||
|
||||
public static void openImage(byte[] input, File definitionFile, String fileName) throws Exception {
|
||||
|
@ -185,7 +224,7 @@ public class ECUEditor extends AbstractFrame {
|
|||
public void initializeEditorUI() {
|
||||
//create menubar
|
||||
menuBar = new ECUEditorMenuBar();
|
||||
this.setJMenuBar(menuBar);
|
||||
frame.setJMenuBar(menuBar);
|
||||
|
||||
// create toolbars
|
||||
toolBar = new ECUEditorToolBar("Editor Tools");
|
||||
|
@ -200,8 +239,8 @@ public class ECUEditor extends AbstractFrame {
|
|||
toolBarPanel.add(tableToolBar);
|
||||
toolBarPanel.setVisible(true);
|
||||
|
||||
this.add(toolBarPanel, BorderLayout.NORTH);
|
||||
validate();
|
||||
frame.add(toolBarPanel, BorderLayout.NORTH);
|
||||
frame.validate();
|
||||
}
|
||||
|
||||
public void checkDefinitions() {
|
||||
|
@ -219,7 +258,7 @@ public class ECUEditor extends AbstractFrame {
|
|||
if (answer == 0) {
|
||||
// BrowserControl.displayURL(ECU_DEFS_URL);
|
||||
} else {
|
||||
showMessageDialog(this,
|
||||
showMessageDialog(frame,
|
||||
"ECU definition files need to be configured before ROM images can be opened.\nMenu: ECU Definitions > ECU Definition Manager...",
|
||||
"Editor Configuration",
|
||||
INFORMATION_MESSAGE);
|
||||
|
@ -248,7 +287,7 @@ public class ECUEditor extends AbstractFrame {
|
|||
JScrollPane scroller = new JScrollPane(releaseNotes, VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_NEVER);
|
||||
scroller.setPreferredSize(new Dimension(600, 500));
|
||||
|
||||
showMessageDialog(this, scroller,
|
||||
showMessageDialog(frame, scroller,
|
||||
PRODUCT_NAME + VERSION + " Release Notes", INFORMATION_MESSAGE);
|
||||
} finally {
|
||||
br.close();
|
||||
|
@ -261,43 +300,14 @@ public class ECUEditor extends AbstractFrame {
|
|||
public void handleExit() {
|
||||
Settings settings = SettingsManager.getSettings();
|
||||
settings.setSplitPaneLocation(splitPane.getDividerLocation());
|
||||
settings.setWindowMaximized(getExtendedState() == MAXIMIZED_BOTH);
|
||||
settings.setWindowSize(getSize());
|
||||
settings.setWindowLocation(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);
|
||||
repaint();
|
||||
}
|
||||
|
||||
@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) {
|
||||
frame.repaint();
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
|
@ -346,7 +356,7 @@ public class ECUEditor extends AbstractFrame {
|
|||
});
|
||||
|
||||
infoPanel.add(check);
|
||||
showMessageDialog(this, infoPanel, "ECU Revision is Obsolete", INFORMATION_MESSAGE);
|
||||
showMessageDialog(frame, infoPanel, "ECU Revision is Obsolete", INFORMATION_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,7 +415,7 @@ public class ECUEditor extends AbstractFrame {
|
|||
}
|
||||
|
||||
public void closeImage() {
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
closeImageWorker = new CloseImageWorker(getLastSelectedRom());
|
||||
closeImageWorker.addPropertyChangeListener(getStatusPanel());
|
||||
closeImageWorker.execute();
|
||||
|
@ -429,9 +439,9 @@ public class ECUEditor extends AbstractFrame {
|
|||
public void setLastSelectedRom(Rom lastSelectedRom) {
|
||||
this.lastSelectedRom = lastSelectedRom;
|
||||
if (lastSelectedRom == null) {
|
||||
setTitle(titleText);
|
||||
frame.setTitle(titleText);
|
||||
} else {
|
||||
setTitle(titleText + " - " + lastSelectedRom.getFileName());
|
||||
frame.setTitle(titleText + " - " + lastSelectedRom.getFileName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -456,7 +466,7 @@ public class ECUEditor extends AbstractFrame {
|
|||
}
|
||||
|
||||
public void setUserLevel(int userLevel) {
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
SettingsManager.getSettings().setUserLevel(userLevel);
|
||||
setUserLevelWorker = new SetUserLevelWorker();
|
||||
setUserLevelWorker.addPropertyChangeListener(getStatusPanel());
|
||||
|
@ -476,14 +486,6 @@ public class ECUEditor extends AbstractFrame {
|
|||
return images;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
imageList.updateUI();
|
||||
imageList.repaint();
|
||||
rightPanel.updateUI();
|
||||
rightPanel.repaint();
|
||||
}
|
||||
|
||||
public void refreshUI()
|
||||
{
|
||||
getToolBar().updateButtons();
|
||||
|
@ -507,7 +509,7 @@ public class ECUEditor extends AbstractFrame {
|
|||
}
|
||||
|
||||
public void openImage(File inputFile) throws Exception {
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
openImageWorker = new OpenImageWorker(inputFile);
|
||||
openImageWorker.addPropertyChangeListener(getStatusPanel());
|
||||
openImageWorker.execute();
|
||||
|
@ -526,7 +528,7 @@ public class ECUEditor extends AbstractFrame {
|
|||
}
|
||||
|
||||
public void launchLogger() {
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
// launchLoggerWorker = new LaunchLoggerWorker();
|
||||
// launchLoggerWorker.addPropertyChangeListener(getStatusPanel());
|
||||
// launchLoggerWorker.execute();
|
||||
|
@ -547,6 +549,10 @@ public class ECUEditor extends AbstractFrame {
|
|||
public MDIDesktopPane getRightPanel() {
|
||||
return this.rightPanel;
|
||||
}
|
||||
|
||||
public AbstractFrame getFrame() {
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
||||
class LaunchLoggerWorker extends SwingWorker<Void, Void> {
|
||||
|
@ -577,7 +583,7 @@ class LaunchLoggerWorker extends SwingWorker<Void, Void> {
|
|||
ECUEditor editor = ECUEditorManager.getECUEditor();
|
||||
editor.getStatusPanel().setStatus("Ready...");
|
||||
setProgress(0);
|
||||
editor.setCursor(null);
|
||||
editor.frame.setCursor(null);
|
||||
editor.refreshUI();
|
||||
}
|
||||
}
|
||||
|
@ -609,7 +615,7 @@ class SetUserLevelWorker extends SwingWorker<Void, Void> {
|
|||
ECUEditor editor = ECUEditorManager.getECUEditor();
|
||||
editor.getStatusPanel().setStatus("Ready...");
|
||||
setProgress(0);
|
||||
editor.setCursor(null);
|
||||
editor.frame.setCursor(null);
|
||||
editor.refreshUI();
|
||||
}
|
||||
}
|
||||
|
@ -647,7 +653,7 @@ class CloseImageWorker extends SwingWorker<Void, Void> {
|
|||
ECUEditor editor = ECUEditorManager.getECUEditor();
|
||||
editor.getStatusPanel().setStatus("Ready...");
|
||||
setProgress(0);
|
||||
editor.setCursor(null);
|
||||
editor.frame.setCursor(null);
|
||||
editor.refreshUI();
|
||||
System.gc();
|
||||
}
|
||||
|
@ -690,23 +696,23 @@ class OpenImageWorker extends SwingWorker<Void, Void> {
|
|||
}
|
||||
|
||||
// if code executes to this point, no ROM was found, report to user
|
||||
showMessageDialog(editor, "ECU Definition Not Found", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
||||
showMessageDialog(editor.frame, "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, "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(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);
|
||||
|
||||
} catch (StackOverflowError ex) {
|
||||
// handles looped inheritance, which will use up all available memory
|
||||
showMessageDialog(editor, "Looped \"base\" attribute in XML definitions.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
||||
showMessageDialog(editor.frame, "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, "Error loading Image. Out of memeory.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
||||
showMessageDialog(editor.frame, "Error loading Image. Out of memeory.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
||||
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
showMessageDialog(editor, "Error Loading. Unknown Exception.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
||||
showMessageDialog(editor.frame, "Error Loading. Unknown Exception.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -726,7 +732,7 @@ class OpenImageWorker extends SwingWorker<Void, Void> {
|
|||
ECUEditor editor = ECUEditorManager.getECUEditor();
|
||||
editor.getStatusPanel().setStatus("Ready...");
|
||||
setProgress(0);
|
||||
editor.setCursor(null);
|
||||
editor.frame.setCursor(null);
|
||||
editor.refreshUI();
|
||||
System.gc();
|
||||
}
|
||||
|
|
|
@ -1030,7 +1030,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
ancestorWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
}
|
||||
|
||||
ECUEditorManager.getECUEditor().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
copySelectionWorker = new CopySelectionWorker(this);
|
||||
copySelectionWorker.execute();
|
||||
|
@ -1052,7 +1052,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
if(null != ancestorWindow) {
|
||||
ancestorWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
}
|
||||
ECUEditorManager.getECUEditor().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
copyTableWorker = new CopyTableWorker(this);
|
||||
copyTableWorker.execute();
|
||||
|
@ -1446,7 +1446,7 @@ class CopySelectionWorker extends SwingWorker<Void, Void> {
|
|||
ancestorWindow.setCursor(null);
|
||||
}
|
||||
table.setCursor(null);
|
||||
ECUEditorManager.getECUEditor().setCursor(null);
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1473,6 +1473,6 @@ class CopyTableWorker extends SwingWorker<Void, Void> {
|
|||
ancestorWindow.setCursor(null);
|
||||
}
|
||||
table.setCursor(null);
|
||||
ECUEditorManager.getECUEditor().setCursor(null);
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(null);
|
||||
}
|
||||
}
|
|
@ -249,7 +249,7 @@ public class Table2D extends Table {
|
|||
if(null != ancestorWindow) {
|
||||
ancestorWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
}
|
||||
ECUEditorManager.getECUEditor().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
super.copySelection();
|
||||
copySelection2DWorker = new CopySelection2DWorker(this);
|
||||
|
@ -262,7 +262,7 @@ public class Table2D extends Table {
|
|||
if(null != ancestorWindow) {
|
||||
ancestorWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
}
|
||||
ECUEditorManager.getECUEditor().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
copyTable2DWorker = new CopyTable2DWorker(this);
|
||||
copyTable2DWorker.execute();
|
||||
|
@ -473,7 +473,7 @@ class CopySelection2DWorker extends SwingWorker<Void, Void> {
|
|||
ancestorWindow.setCursor(null);
|
||||
}
|
||||
table.setCursor(null);
|
||||
ECUEditorManager.getECUEditor().setCursor(null);
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -504,6 +504,6 @@ class CopyTable2DWorker extends SwingWorker<Void, Void> {
|
|||
ancestorWindow.setCursor(null);
|
||||
}
|
||||
table.setCursor(null);
|
||||
ECUEditorManager.getECUEditor().setCursor(null);
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(null);
|
||||
}
|
||||
}
|
|
@ -676,7 +676,7 @@ public class Table3D extends Table {
|
|||
if(null != ancestorWindow) {
|
||||
ancestorWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
}
|
||||
ECUEditorManager.getECUEditor().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
copySelection3DWorker = new CopySelection3DWorker(this);
|
||||
copySelection3DWorker.execute();
|
||||
|
@ -689,7 +689,7 @@ public class Table3D extends Table {
|
|||
if(null != ancestorWindow) {
|
||||
ancestorWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
}
|
||||
ECUEditorManager.getECUEditor().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
ECUEditorManager.getECUEditor().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().setCursor(null);
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1137,6 +1137,6 @@ class CopyTable3DWorker extends SwingWorker<Void, Void> {
|
|||
ancestorWindow.setCursor(null);
|
||||
}
|
||||
table.setCursor(null);
|
||||
ECUEditorManager.getECUEditor().setCursor(null);
|
||||
ECUEditorManager.getECUEditor().getFrame().setCursor(null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class DefinitionManager extends javax.swing.JFrame implements ActionListe
|
|||
Vector<String> fileNames;
|
||||
|
||||
public DefinitionManager() {
|
||||
this.setIconImage(ECUEditorManager.getECUEditor().getIconImage());
|
||||
this.setIconImage(ECUEditorManager.getECUEditor().getFrame().getIconImage());
|
||||
initComponents();
|
||||
initSettings();
|
||||
|
||||
|
@ -61,10 +61,10 @@ public class DefinitionManager extends javax.swing.JFrame implements ActionListe
|
|||
private void initSettings() {
|
||||
// add definitions to list
|
||||
Vector<File> definitionFiles = SettingsManager.getSettings().getEcuDefinitionFiles();
|
||||
fileNames = new Vector<String>();
|
||||
fileNames = new Vector<>();
|
||||
|
||||
for (int i = 0; i < definitionFiles.size(); i++) {
|
||||
fileNames.add(definitionFiles.get(i).getAbsolutePath());
|
||||
for (File definitionFile : definitionFiles) {
|
||||
fileNames.add(definitionFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
updateListModel();
|
||||
|
|
|
@ -339,17 +339,17 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
|||
|
||||
//} else
|
||||
if (e.getSource() == romProperties) {
|
||||
showMessageDialog(parent, new RomPropertyPanel(parent.getLastSelectedRom()),
|
||||
showMessageDialog(parent.getFrame(), new RomPropertyPanel(parent.getLastSelectedRom()),
|
||||
parent.getLastSelectedRom().getRomIDString() + " Properties", INFORMATION_MESSAGE);
|
||||
|
||||
} else if (e.getSource() == settings) {
|
||||
SettingsForm form = new SettingsForm();
|
||||
form.setLocationRelativeTo(parent);
|
||||
form.setLocationRelativeTo(parent.getFrame());
|
||||
form.setVisible(true);
|
||||
|
||||
} else if (e.getSource() == compareImages){
|
||||
CompareImagesForm form = new CompareImagesForm(parent.getImages(), parent.getIconImage());
|
||||
form.setLocationRelativeTo(parent);
|
||||
CompareImagesForm form = new CompareImagesForm(parent.getImages(), parent.getFrame().getIconImage());
|
||||
form.setLocationRelativeTo(parent.getFrame());
|
||||
form.setVisible(true);
|
||||
|
||||
} else if (e.getSource() == level1) {
|
||||
|
@ -382,7 +382,7 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
|||
+ "Build #: " + BUILDNUMBER + "\n"
|
||||
+ SUPPORT_URL;
|
||||
String title = "About " + PRODUCT_NAME;
|
||||
showMessageDialog(parent, message, title, INFORMATION_MESSAGE, ABOUT_ICON);
|
||||
showMessageDialog(parent.getFrame(), message, title, INFORMATION_MESSAGE, ABOUT_ICON);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -401,10 +401,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) == JFileChooser.APPROVE_OPTION) {
|
||||
if (fc.showSaveDialog(parent.getFrame()) == JFileChooser.APPROVE_OPTION) {
|
||||
File selectedFile = fc.getSelectedFile();
|
||||
if (selectedFile.exists()) {
|
||||
int option = showConfirmDialog(parent, selectedFile.getName() + " already exists! Overwrite?");
|
||||
int option = showConfirmDialog(parent.getFrame(), selectedFile.getName() + " already exists! Overwrite?");
|
||||
|
||||
// option: 0 = Cancel, 1 = No
|
||||
if (option == CANCEL_OPTION || option == 1) {
|
||||
|
@ -438,10 +438,10 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
|||
// disable the "All files" option
|
||||
fc.setAcceptAllFileFilterUsed(false);
|
||||
|
||||
if (fc.showSaveDialog(ECUEditorManager.getECUEditor()) == JFileChooser.APPROVE_OPTION) {
|
||||
if (fc.showSaveDialog(ECUEditorManager.getECUEditor().getFrame()) == JFileChooser.APPROVE_OPTION) {
|
||||
File selectedDir = fc.getSelectedFile();
|
||||
if (selectedDir.exists()) {
|
||||
int option = showConfirmDialog(ECUEditorManager.getECUEditor(), selectedDir.getName() + " already exists! Overwrite?");
|
||||
int option = showConfirmDialog(ECUEditorManager.getECUEditor().getFrame(), selectedDir.getName() + " already exists! Overwrite?");
|
||||
|
||||
// option: 0 = Cancel, 1 = No
|
||||
if (option == CANCEL_OPTION || option == 1) {
|
||||
|
@ -498,7 +498,7 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
|||
if(null != selectedFile){
|
||||
if(lastSelectedRom.getRealFileSize() != Settings.SIXTEENBIT_SMALL_SIZE)
|
||||
{
|
||||
showMessageDialog(ECUEditorManager.getECUEditor(), "Error converting image. Image size is invalid.");
|
||||
showMessageDialog(ECUEditorManager.getECUEditor().getFrame(), "Error converting image. Image size is invalid.");
|
||||
} else {
|
||||
byte[] output = lastSelectedRom.saveFile();
|
||||
byte[] incOutput = new byte[Settings.SIXTEENBIT_LARGE_SIZE];
|
||||
|
@ -521,7 +521,7 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
|||
if(null != selectedFile){
|
||||
if(lastSelectedRom.getRealFileSize() != Settings.SIXTEENBIT_LARGE_SIZE)
|
||||
{
|
||||
showMessageDialog(ECUEditorManager.getECUEditor(), "Error converting image. Image size is invalid.");
|
||||
showMessageDialog(ECUEditorManager.getECUEditor().getFrame(), "Error converting image. Image size is invalid.");
|
||||
} else {
|
||||
byte[] output =lastSelectedRom.saveFile();
|
||||
byte[] decOutput = new byte[Settings.SIXTEENBIT_SMALL_SIZE];
|
||||
|
|
|
@ -59,7 +59,7 @@ public class SettingsForm extends JFrame implements MouseListener {
|
|||
private static final long serialVersionUID = 3910602424260147767L;
|
||||
|
||||
public SettingsForm() {
|
||||
this.setIconImage(getEditor().getIconImage());
|
||||
this.setIconImage(getEditor().getFrame().getIconImage());
|
||||
initComponents();
|
||||
initSettings();
|
||||
|
||||
|
|
|
@ -369,7 +369,7 @@ public final class DOMRomUnmarshaller {
|
|||
} catch (InvalidTableNameException ex) { // Table name is invalid, do nothing.
|
||||
|
||||
} catch (NullPointerException ex) {
|
||||
JOptionPane.showMessageDialog(ECUEditorManager.getECUEditor(),
|
||||
JOptionPane.showMessageDialog(ECUEditorManager.getECUEditor().getFrame(),
|
||||
new DebugPanel(ex, SettingsManager.getSettings().getSupportURL()), "Exception",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
|
||||
|
@ -581,7 +581,7 @@ public final class DOMRomUnmarshaller {
|
|||
|
||||
} catch (Exception ex) {
|
||||
JOptionPane.showMessageDialog(
|
||||
ECUEditorManager.getECUEditor(),
|
||||
ECUEditorManager.getECUEditor().getFrame(),
|
||||
new DebugPanel(ex, SettingsManager.getSettings()
|
||||
.getSupportURL()), "Exception",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
|
|
Loading…
Reference in New Issue