LEDEAUT Stephane wrote:
> I would like to change the pathname before saving a file with XXE.
> For that, I use the method savingDocument(Document doc) from
> DocumentHookBase which is invoked before a document is saved.
> 
> But I have not managed yet to change the path in the saving dialog box.

In principle, questions related to the XXE API are *not* answered in
this mailing list. However in your case, the answer is simple and short.

*You* *cannot* *do* *that* *with* *a* *document* *hook*: the application
(that is, XXE) knows and invokes document hooks, but the document hooks
have no idea of the ``environment'' invoking them. Therefore document
hooks cannot have a side-effect on this environment. Therefore document
hooks cannot suggest a save filename in the file chooser dialog box.

--> If you use XXE pre-V3, the only solution is to create a special Save
command (i.e. a class which extends com.xmlmind.xmledit.gadget.Command)
and add it to the menu and/or toolbar which is specific to your
configuration.

--> If you use XXE V3+ (*strongly* recommended), you can replace the
stock File|Save action by a "File|Save As" action of your own (which
typically extends the stock "File|Save As" action).

In order to do this, please take the time to read:

* "XMLmind XML Editor - Customizing the User Interface". See
http://www.xmlmind.com/xmleditor/_distrib/doc/gui/index.html

* "Extending the GUI of XMLmind XML Editor". See
http://www.xmlmind.com/xmleditor/_distrib/doc/dev/gui.html

As a teaser, I've attached the code of the stock "File|Save As" action
to this email.

Suffice to redefine method init():
---
    protected boolean init() {
        OpenedDocument openedDoc = app.getActiveOpenedDocument();
        if (openedDoc == null)
            return false;

        outURL = ChooseURLSupport.getInstance(app).selectSaveURL(
            openedDoc.getLocation()); //<-- JUST CHANGE THIS
        return (outURL != null);
    }
---
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SaveAsAction.java
Type: text/x-java
Size: 5584 bytes
Desc: not available
Url : 
http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20060109/ae27db9f/attachment.java
 

Reply via email to