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,8 +474,13 @@ public final class YaFormEditor extends SimpleEditor implements FormChangeListen
if (YoungAndroidFormUpgrader.upgradeSourceProperties(propertiesObject.getProperties())) {
String upgradedContent = YoungAndroidSourceAnalyzer.generateSourceFile(propertiesObject);
fileContentHolder.setFileContent(upgradedContent);
Ode.getInstance().getProjectService().save(Ode.getInstance().getSessionId(),
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(),
getProjectId(), getFileId(), upgradedContent,
new OdeAsyncCallback<Long>(MESSAGES.saveError()) {
@Override
......@@ -486,6 +491,7 @@ public final class YaFormEditor extends SimpleEditor implements FormChangeListen
}
}
});
}
} else {
// No upgrade was necessary.
// 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