From: <no...@us...> - 2010-03-18 21:06:47
|
Revision: 3210 http://obo.svn.sourceforge.net/obo/?rev=3210&view=rev Author: nomi Date: 2010-03-18 21:06:38 +0000 (Thu, 18 Mar 2010) Log Message: ----------- Fixed bug 2972252: When saving, you get the warning dialog twice (if there's a problem with your commit). Modified Paths: -------------- phenote/trunk/src/java/phenote/dataadapter/LoadSaveManager.java Modified: phenote/trunk/src/java/phenote/dataadapter/LoadSaveManager.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/LoadSaveManager.java 2010-03-18 18:34:26 UTC (rev 3209) +++ phenote/trunk/src/java/phenote/dataadapter/LoadSaveManager.java 2010-03-18 21:06:38 UTC (rev 3210) @@ -126,7 +126,7 @@ DataAdapterI adapter = ((DataAdapterFileFilter)filter).getAdapter(); saveData(aFile, adapter); } else { - saveData(aFile); + saveData(aFile, false); } setTitleOnPhenoteWindowForFile(aFile); } @@ -138,7 +138,7 @@ try { checkConstraints(); } catch (ConstraintEx e) { return; } // failure ret if (useCurrentFile && (this.characterListManager.getCurrentDataFile() != null)) { - this.saveData(this.characterListManager.getCurrentDataFile()); + this.saveData(this.characterListManager.getCurrentDataFile(), false); } else { // there isn't a current file or we should choose a new one this.saveData(); @@ -148,8 +148,14 @@ /**Saves the document's characters to the given file, using the default data adapter for the file's extension.*/ public void saveData(File f) { + saveData(f, true); // check constraints + } + + public void saveData(File f, boolean checkConstraints) { // CONSTRAINT check - try { checkConstraints(); } catch (ConstraintEx e) { return; } // failure ret + if (checkConstraints) { + try { checkConstraints(); } catch (ConstraintEx e) { return; } // failure ret + } DataAdapterI adapter = getDataAdapterForFilename(f.getName()); saveData(f, adapter); @@ -174,16 +180,16 @@ if (Config.inst().hasQueryableDataAdapter()) { saveToDbDataadapter(); - } else { - saveData(); // saveFileData really - } + } else { + saveData(); // saveFileData really + } } /** Checks contraints and if pass/override then save to QueryableDataAdapter and clear transactions */ public void saveToDbDataadapter() { - if (!Config.inst().hasQueryableDataAdapter()) return; // err? ex? + if (!Config.inst().hasQueryableDataAdapter()) return; // err? ex? // CONSTRAINT check - puts up error dialog on warn/fail try { checkConstraints(); } @@ -209,6 +215,9 @@ private void checkConstraints() throws ConstraintEx { ConstraintStatus cs = ConstraintManager.inst().checkCommitConstraints(); +// log().debug("checkConstraints:"); // DEL +// new Throwable().printStackTrace(); // DEL + // FAILURE - no commit if (cs.isFailure()) { String m = "There is a problem with your commit:\n"+cs.getFailureMessage()+ @@ -224,8 +233,8 @@ // WARNING - ask user if still wants to commit if (cs.isWarning()) { - String m = "There is a problem with your commit:\n"+cs.getWarningMessage() - +"\nDo you want to commit anyway?"; + String m = "There is a problem with your commit--save anyway?\n" + + cs.getWarningMessage(); JTextArea area = new JTextArea(m); area.setRows(10); area.setColumns(50); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |