[oXygen-user] [OXYGEN-15680] Re: Custom action to generate simple dialog?

Scott Prentice sp14 at leximation.com
Thu Jun 13 11:48:18 CDT 2024


Thanks, Radu.

I have a couple questions.

It's not clear to me how the "script" parameter works with the 
JSOperation class. I assume it can be used to pass in values to the code 
in commons.js, but I'm not seeing how you'd do that. Can you point me to 
any examples?

Also. I see that commons.js has access to the AuthorAccess API. I'd like 
to access DocumentTypeInfo interface 
(ro.sync.ecss.extensions.api.webapp.doctype.DocumentTypeInfo) .. can I 
do that from commons.js? I've tried a few things, without much success.

Thanks!

Scott


On 6/12/24 8:27 PM, Oxygen XML Editor Support (Radu Coravu) wrote:
>
> Hi Scott,
>
> Right. We do not have a special Author operation to show a message to 
> the end user.
>
> This operation could be used to open a web page if for example you 
> want to present to the end user the information in a web browser:
>
> https://www.oxygenxml.com/doc/versions/26.1/ug-editor/topics/dg-default-author-operations.html#dg-default-author-operations__openinsystemappoperation
>
> Regards,
> Radu
>
> Radu Coravu
> Oxygen XML Editor
> On 6/13/24 03:06, Scott Prentice wrote:
>> If you're interested, here's one way to do this. I'm sure there's a 
>> more elegant way and this is probably a bit if a hack, but it does 
>> what I need right now.
>>
>> 1. In. your framework's Document Type dialog, on the Author:Actions 
>> subtab, add an action to the framework, give it an ID and a Name.
>> 2. In the Action dialog select this Operation: 
>> ro.sync.ecss.extensions.commons.operations.JSOperation
>> 3. A 'script' argument will be added, leave the value empty.
>> 4. Choose OK. (Leave the Document Type dialog up for now.)
>> 5. Create a commons.js file in the root of your framework directory, 
>> with the following content ..
>>
>>     function doOperation(){
>>         parentFrame = authorAccess.getParentFrame();
>>         javax.swing.JOptionPane.showMessageDialog(parentFrame, 
>> "MESSAGE HERE");
>>     }
>>
>> 6. In the Document Type dialog, on the Author:Menu subtab, add your 
>> new action to your menu (assuming one exists).
>> 7. Choose OK, then OK.
>>
>> Open a document in Author view that uses your framework. You should 
>> see the new menu item.
>>
>> Clearly, if you're already using the commons.js file for something 
>> else, you'll need to pass in some parameter and tweak the JS code .. 
>> but this is a start.  :-)
>>
>> Cheers,
>>
>> Scott
>>
>> On 6/12/24 1:32 PM, Scott Prentice wrote:
>>>
>>> Hi,
>>>
>>> Is there a built-in method for creating an action (to call from a 
>>> toolbar or menu) that displays a simple dialog that contains 
>>> informational text? I'd like to have an "About" dialog that's 
>>> associated with a framework. I assume I can do this by creating a 
>>> custom class, but wanted to see if there was an OOB option for this.
>>>
>>> Thanks!
>>>
>>> Scott
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> oXygen-user mailing list
>>> oXygen-user at oxygenxml.com
>>> https://www.oxygenxml.com/mailman/listinfo/oxygen-user
>>
>> _______________________________________________
>> oXygen-user mailing list
>> oXygen-user at oxygenxml.com
>> https://www.oxygenxml.com/mailman/listinfo/oxygen-user
>
> _______________________________________________
> oXygen-user mailing list
> oXygen-user at oxygenxml.com
> https://www.oxygenxml.com/mailman/listinfo/oxygen-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.oxygenxml.com/pipermail/oxygen-user/attachments/20240613/c931f4cd/attachment.htm>


More information about the oXygen-user mailing list