adding a menu spearator to the contextual menu via JS
Oxygen general issues.
-
- Posts: 87
- Joined: Fri Dec 19, 2003 6:02 pm
adding a menu spearator to the contextual menu via JS
Hi,
I have used https://github.com/oxygenxml/wsaccess-j ... sAccess.js from wsaccess-javascript-sample-plugins as a model for adding actions to the contextual menu in Author View.
Everything works as expected. I would like to implement two improvements:
1. add an icon to each menu item that I'm creating; and
2. add a menu separator above
Does anybody have a handy example to share?
Many thanks in advance.
All best,
Toma
I have used https://github.com/oxygenxml/wsaccess-j ... sAccess.js from wsaccess-javascript-sample-plugins as a model for adding actions to the contextual menu in Author View.
Everything works as expected. I would like to implement two improvements:
1. add an icon to each menu item that I'm creating; and
2. add a menu separator above
Does anybody have a handy example to share?
Many thanks in advance.
All best,
Toma
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: adding a menu spearator to the contextual menu via JS
Hi Toma,
The Javascript code just calls Java Swing API methods, for example the "popUp" parameter in the sample plugin is an instance of the Swing "JPopupMenu" class and has the method:
https://docs.oracle.com/javase/7/docs/a ... eparator()
The menu item which gets created:
https://docs.oracle.com/javase/7/docs/a ... uItem.html
has a "setIcon" method. Something like:
That "location" would need to be an URL, something like:
The jsDirURL is a predefined variable which expands to an URL pointing to the plugin base folder, so the "icon.png" would need to be placed in the plugin base folder for the example above to work.
Regards,
Radu
The Javascript code just calls Java Swing API methods, for example the "popUp" parameter in the sample plugin is an instance of the Swing "JPopupMenu" class and has the method:
https://docs.oracle.com/javase/7/docs/a ... eparator()
The menu item which gets created:
Code: Select all
mi = new Packages.javax.swing.JMenuItem("Wrap In Bold");
has a "setIcon" method. Something like:
Code: Select all
mi.setIcon(new javax.swing.ImageIcon.ImageIcon(location));
Code: Select all
new Packages.java.net.URL(jsDirURL + "/icon.png");
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service