Commit 0bba1fef authored by Jeffrey I. Schiller's avatar Jeffrey I. Schiller Committed by Evan W. Patton

Do not attempt to save a project in read only mode

When upgrading a project, do not attempt to save the upgraded version if
we are in read only mode.

Change-Id: I7e2f089293ae864dbe1a18c2504ac71d1b51fc9d
parent cbb7ed03
...@@ -474,7 +474,12 @@ public final class YaFormEditor extends SimpleEditor implements FormChangeListen ...@@ -474,7 +474,12 @@ public final class YaFormEditor extends SimpleEditor implements FormChangeListen
if (YoungAndroidFormUpgrader.upgradeSourceProperties(propertiesObject.getProperties())) { if (YoungAndroidFormUpgrader.upgradeSourceProperties(propertiesObject.getProperties())) {
String upgradedContent = YoungAndroidSourceAnalyzer.generateSourceFile(propertiesObject); String upgradedContent = YoungAndroidSourceAnalyzer.generateSourceFile(propertiesObject);
fileContentHolder.setFileContent(upgradedContent); fileContentHolder.setFileContent(upgradedContent);
Ode ode = Ode.getInstance();
if (ode.isReadOnly()) { // Do not attempt to save out the project if we are in readonly mode
if (afterUpgradeComplete != null) {
afterUpgradeComplete.execute(); // But do call the afterUpgradeComplete call
}
} else {
Ode.getInstance().getProjectService().save(Ode.getInstance().getSessionId(), Ode.getInstance().getProjectService().save(Ode.getInstance().getSessionId(),
getProjectId(), getFileId(), upgradedContent, getProjectId(), getFileId(), upgradedContent,
new OdeAsyncCallback<Long>(MESSAGES.saveError()) { new OdeAsyncCallback<Long>(MESSAGES.saveError()) {
...@@ -486,6 +491,7 @@ public final class YaFormEditor extends SimpleEditor implements FormChangeListen ...@@ -486,6 +491,7 @@ public final class YaFormEditor extends SimpleEditor implements FormChangeListen
} }
} }
}); });
}
} else { } else {
// No upgrade was necessary. // No upgrade was necessary.
// Execute the afterUpgradeComplete command if one was given. // Execute the afterUpgradeComplete command if one was given.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment