OK. Thanks!

Now I'm having trouble getting the tweaked GUI menu actions to become
active. Here's my code:

In custom.xxe_gui:

<!-- include default gui -->
  <include location="xxe-gui:app/default.xxe_gui" />

<!-- override the three insert comment actions -->
  <action name="insertCommentBeforeAction" label="Insert Comment
_Before">
    <context editingContextSensitive="true"> 
      <configuration name="Workday Topic">
        <command name="addComment" parameter="before[implicitElement]"/>
      </configuration>
      <default>
        <command name="insertNode"
parameter="commentBefore[implicitElement]" />
      </default>
    </context>
  </action>

  <action name="insertCommentAction" label="_Insert Comment">
    <context editingContextSensitive="true"> 
      <configuration name="Workday Topic">
        <command name="addComment" parameter="into"/>
      </configuration>
      <default>
        <command name="insertNode" parameter="commentInto" />
      </default>
    </context>
  </action>

  <action name="insertCommentAfterAction" label="Insert Comment _After">
    <context editingContextSensitive="true"> 
      <configuration name="Workday Topic">
        <command name="addComment" parameter="after[implicitElement]"/>
      </configuration>
      <default>
        <command name="insertNode"
parameter="commentAfter[implicitElement]" />
      </default>
    </context>
  </action> 

<!-- reinstantiate layout -->
  <layout label="Document Editor" icon="docedit.png">
    <insert />
  </layout>


In my "Workday Topic" config file:

  <command name="addComment">
    <macro>
      <sequence>
          <command name="insert" parameter="%0 draft-comment"/>
            <command name="run" parameter="date /t"/>
            <set variable="theDate" expression="%_" plainString="true"/>
          <command name="run" parameter="time /t"/>
          <set variable="theTime" expression="%_" plainString="true"/>
          <get expression="normalize-space(concat($theDate,$theTime))"/>
          <command name="addAttribute" parameter="time '%_'"/>
          <command name="addAttribute" parameter="author %U"/>  
      </sequence>
    </macro>
  </command>


The command works from a toolbar button that I've added. And it works
from the Execute Command window. But the three actions are always grayed
out when I view them in the Edit > Comment menu. What have I forgotten
to do?



-----Original Message-----
From: Hussein Shafie [mailto:[email protected]] 
Sent: Tuesday, May 02, 2006 2:07 AM
To: Mark Fletcher
Cc: xmleditor-support at xmlmind.com
Subject: Re: [XXE] custom commands referenced in GUI file?

Mark Fletcher wrote:
> I've been reading over the doc, but I find this a little unclear. Is 
> there any way to add a custom XXE command to a default GUI menu? Or 
> can you only do that with Java-based commands?

That's right. If you want to a add a command to a default GUI menu, it
must be a command written in Java[tm]. It cannot be a macro command or a
process command.

Here's an example:
http://www.xmlmind.com/xmleditor/_distrib/doc/gui/characters_menu.html

The above example uses standard command "insertString" but it is also
possible to use a custom command declared in custom.xxe_gui as explained
here: http://www.xmlmind.com/xmleditor/_distrib/doc/gui/command.html

The only way to use a macro command or a process command in a default
GUI menu is to use a macro command or a process command which is
specific to a type of document in *substitution* to a standard menu
item.

Example: File|Print works normally except when a DocBook document is
opened, in such case File|Print converts the DocBook document to
PostScript using FOP and sends the result to the Printer. This is
explained here:
http://www.xmlmind.com/xmleditor/_distrib/doc/gui/contextual_print.html




Reply via email to