mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-16 00:15:01 -04:00
added constant to store the last data file key.
This commit is contained in:
parent
3c7b16b1b1
commit
aadee11760
@ -17,6 +17,10 @@ import java.io.File;
|
|||||||
* @author hneemann
|
* @author hneemann
|
||||||
*/
|
*/
|
||||||
public class ROM extends Node implements Element {
|
public class ROM extends Node implements Element {
|
||||||
|
/**
|
||||||
|
* Key used to store the source file in the attribute set
|
||||||
|
*/
|
||||||
|
public final static String LAST_DATA_FILE_KEY = "lastDataFile";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ROMs {@link ElementTypeDescription}
|
* The ROMs {@link ElementTypeDescription}
|
||||||
@ -51,9 +55,9 @@ public class ROM extends Node implements Element {
|
|||||||
data = attr.get(AttributeKey.Data);
|
data = attr.get(AttributeKey.Data);
|
||||||
addrBits = attr.get(AttributeKey.AddrBits);
|
addrBits = attr.get(AttributeKey.AddrBits);
|
||||||
showList = attr.get(AttributeKey.ShowListing);
|
showList = attr.get(AttributeKey.ShowListing);
|
||||||
if (showList)
|
if (showList) {
|
||||||
listFile = attr.getFile("lastDataFile");
|
listFile = attr.getFile(LAST_DATA_FILE_KEY);
|
||||||
else
|
} else
|
||||||
listFile = null;
|
listFile = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import de.neemann.digital.core.element.AttributeKey;
|
|||||||
import de.neemann.digital.core.element.ElementAttributes;
|
import de.neemann.digital.core.element.ElementAttributes;
|
||||||
import de.neemann.digital.core.element.Rotation;
|
import de.neemann.digital.core.element.Rotation;
|
||||||
import de.neemann.digital.core.memory.DataField;
|
import de.neemann.digital.core.memory.DataField;
|
||||||
|
import de.neemann.digital.core.memory.ROM;
|
||||||
import de.neemann.digital.lang.Lang;
|
import de.neemann.digital.lang.Lang;
|
||||||
import de.neemann.gui.ErrorMessage;
|
import de.neemann.gui.ErrorMessage;
|
||||||
import de.neemann.gui.ToolTipAction;
|
import de.neemann.gui.ToolTipAction;
|
||||||
@ -194,9 +195,9 @@ public final class EditorFactory {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
JFileChooser fc = new JFileChooser();
|
JFileChooser fc = new JFileChooser();
|
||||||
fc.setSelectedFile(attr.getFile("lastDataFile"));
|
fc.setSelectedFile(attr.getFile(ROM.LAST_DATA_FILE_KEY));
|
||||||
if (fc.showOpenDialog(panel) == JFileChooser.APPROVE_OPTION) {
|
if (fc.showOpenDialog(panel) == JFileChooser.APPROVE_OPTION) {
|
||||||
attr.setFile("lastDataFile", fc.getSelectedFile());
|
attr.setFile(ROM.LAST_DATA_FILE_KEY, fc.getSelectedFile());
|
||||||
try {
|
try {
|
||||||
data = new DataField(fc.getSelectedFile());
|
data = new DataField(fc.getSelectedFile());
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
@ -209,13 +210,13 @@ public final class EditorFactory {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
try {
|
try {
|
||||||
data = new DataField(attr.getFile("lastDataFile"));
|
data = new DataField(attr.getFile(ROM.LAST_DATA_FILE_KEY));
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
new ErrorMessage(Lang.get("msg_errorReadingFile")).addCause(e1).show(panel);
|
new ErrorMessage(Lang.get("msg_errorReadingFile")).addCause(e1).show(panel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.setActive(attr.getFile("lastDataFile") != null)
|
.setActive(attr.getFile(ROM.LAST_DATA_FILE_KEY) != null)
|
||||||
.setToolTip(Lang.get("btn_reload_tt"))
|
.setToolTip(Lang.get("btn_reload_tt"))
|
||||||
.createJButton()
|
.createJButton()
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user