Thanks. I have it working like a charm.

Oh, and for the undo all changes piece, I wrote this neat little
recursive command:

        <command name="wkdy.undoAllChanges">
                <macro>
                        <choice>
                                <sequence>
                                        <command name="XXE.save"
parameter="[checkIsSaved]"/><!-- passes if doc doesn't need saving,
meaning nothing left to undo -->
                                        <!-- add any other final
"cleanp" commands here -->
                                        <command
name="cancelSelection"/>
                                </sequence>
                                <sequence><!-- else, execute undo once
and recall this command -->
                                        <command name="undo" />
                                        <command
name="wkdy.undoAllChanges"/>
                                </sequence>
                        </choice>
                </macro>
        </command>



-----Original Message-----
From: Hussein Shafie [mailto:[email protected]] 
Sent: Saturday, March 26, 2011 12:14 AM
To: Mark Fletcher
Cc: '[email protected]'
Subject: Re: [XXE] Need to "catch" a bad save attempt in a macro

On 03/25/2011 05:10 PM, Mark Fletcher wrote:
> 
> I have a case where a user may attempt to save their file after the
dav
> lock has expired and the file has been locked by another user. When
save
> fails, then entire macro chain is aborted with an EXECUTION CANCELED
OR
> FAILED error. The problem in my case is that I want to undo all the
> user's attempted changes and reset the document to read-only (ie, back
> to the state they started in), but after a save failure I lose control
> of the situation.
> 
> I'm thinking I could create a custom java command that does the save
> attempt in the "prepare" phase, traps any errors, and simply returns
> false if the save is not successful. Do you think this approach is
> feasible? Can I trap a save exception there? 

I would say that the answer is yes to both questions.



> If not, do you have any suggestions on how I might handle this?
 
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to