Removing certain menu options from framework menu
Oxygen general issues.
-
- Posts: 5
- Joined: Tue Mar 29, 2011 8:16 pm
Removing certain menu options from framework menu
Hi,
It looks like the Refresh, Tags Display Mode, and Profiling/Conditional Text menu options are added to the end of every Associated Document Type Framework menu - both my custom document types and the ones that come with Oxygen. How can I suppress or hide these menu options? I'm not seeing anything in the Document Type author menu customization options. Can I use a plugin that extends the ComponentsValidatorPlugin to remove these on startup? Is there a better method?
Thanks!
-Cole
It looks like the Refresh, Tags Display Mode, and Profiling/Conditional Text menu options are added to the end of every Associated Document Type Framework menu - both my custom document types and the ones that come with Oxygen. How can I suppress or hide these menu options? I'm not seeing anything in the Document Type author menu customization options. Can I use a plugin that extends the ComponentsValidatorPlugin to remove these on startup? Is there a better method?
Thanks!
-Cole
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Removing certain menu options from framework menu
Hi Cole,
You have basically two ways to approach this:
1) Using a components validator plugin implementation you can remove the actions (but the main menu entries in the framework menu will remain). So you can remove the Refresh references and Refresh actions but the menu Refresh will remain with no child menu items to display.
Example:
2) You can use a WorkspaceAccess plugin implementation which has methods to add a MenuBarCustomizer like:
The problem is that the framework specific menu is created automatically only when an editor gets selected.
So you must keep a reference to the main JMenuBar received from the customizer.
Then you can add a WSEditorChangeListener like:
You have basically two ways to approach this:
1) Using a components validator plugin implementation you can remove the actions (but the main menu entries in the framework menu will remain). So you can remove the Refresh references and Refresh actions but the menu Refresh will remain with no child menu items to display.
Example:
Code: Select all
public boolean validateAccelAction(String category, String tag) {
if("Author".equals(category) && "Refresh_references".equals(tag)) {
return false;
}
if("Author".equals(category) && "Reload".equals(tag)) {
return false;
}
System.err.println("cate " + category + " tag:" + tag) ;
return true;
}
Code: Select all
pluginWorkspaceAccess.addMenuBarCustomizer(new MenuBarCustomizer() {
/**
* @see ro.sync.exml.workspace.api.standalone.MenuBarCustomizer#customizeMainMenu(javax.swing.JMenuBar)
*/
public void customizeMainMenu(JMenuBar mainMenuBar) {
..................
So you must keep a reference to the main JMenuBar received from the customizer.
Then you can add a WSEditorChangeListener like:
Code: Select all
pluginWorkspaceAccess.addEditorChangeListener(
new WSEditorChangeListener() {
@Override
public void editorSelected(URL editorLocation) {
//Here you can recurse the main JMenuBar and remove the items if they exist in the framework menu
};
......................
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 22
- Joined: Fri Aug 09, 2013 11:03 am
Re: Removing certain menu options from framework menu
Hi guys,
following to this question - how can I implement hiding or showing menu options when the user takes an arbitrary action? In my case, when my user logs in to a remote repository (via my plugin), I want to show extra menus.
But of course the listeners has methods for editor opened, editor closed, etc, not for my own plugin actions. What's the best way to implement something like that?
Thanks
Yann
following to this question - how can I implement hiding or showing menu options when the user takes an arbitrary action? In my case, when my user logs in to a remote repository (via my plugin), I want to show extra menus.
But of course the listeners has methods for editor opened, editor closed, etc, not for my own plugin actions. What's the best way to implement something like that?
Thanks
Yann
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Removing certain menu options from framework menu
Hi Yann,
If you add a MenuBarCustomizer as in my example above, you will be able to store in a field the main JMenuBar (or your own menu added to the main JMenuBar).
When your action gets called you could update the menu which you have contributed.
Regards,
Radu
If you add a MenuBarCustomizer as in my example above, you will be able to store in a field the main JMenuBar (or your own menu added to the main JMenuBar).
When your action gets called you could update the menu which you have contributed.
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)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ 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