mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
auto-save added
This commit is contained in:
+6
-5
@@ -242,10 +242,10 @@ public class Presenter implements IPlugInPort {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveProjectToFile(String fileName) {
|
||||
public void saveProjectToFile(String fileName, boolean isBackup) {
|
||||
LOG.info(String.format("saveProjectToFile(%s)", fileName));
|
||||
try {
|
||||
projectFileManager.serializeProjectToFile(currentProject, fileName);
|
||||
projectFileManager.serializeProjectToFile(currentProject, fileName, isBackup);
|
||||
} catch (Exception ex) {
|
||||
LOG.error("Could not save file", ex);
|
||||
view.showMessage("Could not save file " + fileName + ". Check the log for details.",
|
||||
@@ -385,7 +385,7 @@ public class Presenter implements IPlugInPort {
|
||||
LOG.error("Error instatiating component of type: "
|
||||
+ componentTypeSlot.getInstanceClass().getName(), e);
|
||||
}
|
||||
|
||||
|
||||
if (ConfigurationManager.getInstance().readBoolean(IPlugInPort.AUTO_EDIT_KEY,
|
||||
false)) {
|
||||
editSelection();
|
||||
@@ -429,8 +429,9 @@ public class Presenter implements IPlugInPort {
|
||||
}
|
||||
updateSelection(newSelection);
|
||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||
|
||||
if (ConfigurationManager.getInstance().readBoolean(IPlugInPort.AUTO_EDIT_KEY, false)) {
|
||||
|
||||
if (ConfigurationManager.getInstance().readBoolean(
|
||||
IPlugInPort.AUTO_EDIT_KEY, false)) {
|
||||
editSelection();
|
||||
}
|
||||
if (ConfigurationManager.getInstance().readBoolean(
|
||||
|
||||
+10
-5
@@ -87,15 +87,20 @@ public class ProjectFileManager {
|
||||
fireFileStatusChanged();
|
||||
}
|
||||
|
||||
public void serializeProjectToFile(Project project, String fileName) throws IOException {
|
||||
LOG.info(String.format("saveProjectToFile(%s)", fileName));
|
||||
public void serializeProjectToFile(Project project, String fileName, boolean isBackup)
|
||||
throws IOException {
|
||||
if (!isBackup) {
|
||||
LOG.info(String.format("saveProjectToFile(%s)", fileName));
|
||||
}
|
||||
FileOutputStream fos;
|
||||
fos = new FileOutputStream(fileName);
|
||||
xStream.toXML(project, fos);
|
||||
fos.close();
|
||||
this.currentFileName = fileName;
|
||||
this.modified = false;
|
||||
fireFileStatusChanged();
|
||||
if (!isBackup) {
|
||||
this.currentFileName = fileName;
|
||||
this.modified = false;
|
||||
fireFileStatusChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public Project deserializeProjectFromFile(String fileName, List<String> warnings)
|
||||
|
||||
Reference in New Issue
Block a user