Togglable Custom Toolbar Button
Oxygen general issues.
-
- Posts: 5
- Joined: Wed May 14, 2014 1:43 am
Togglable Custom Toolbar Button
Is it possible to create a custom toolbar (with custom actions) and have buttons which toggle?
The scenario I have is this:
My customer, for whom I'm developing extensions, works with legal documents, and in some sections of the documents, change tracking must be turned on and not disabled by the user. I have hidden the toolbar, since all attempts to disable the common actions have failed, and I have created a custom action to toggle change tracking. I want the button on the toolbar to reflect the current state.
Ideally, I would not want to have to create a separate action, but would rather be able to exert some control over the out-of-the-box Author Review toolbar and menu items. If there is a way to do that, instead of the custom toolbars, I would like to know how.
Regards
Bill
The scenario I have is this:
My customer, for whom I'm developing extensions, works with legal documents, and in some sections of the documents, change tracking must be turned on and not disabled by the user. I have hidden the toolbar, since all attempts to disable the common actions have failed, and I have created a custom action to toggle change tracking. I want the button on the toolbar to reflect the current state.
Ideally, I would not want to have to create a separate action, but would rather be able to exert some control over the out-of-the-box Author Review toolbar and menu items. If there is a way to do that, instead of the custom toolbars, I would like to know how.
Regards
Bill
-
- Posts: 9472
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Togglable Custom Toolbar Button
Hi Bill,
One workaround for this approach would be for you to create a Workspace Access plugin using our Plugins SDK:
http://www.oxygenxml.com/oxygen_sdk.htm ... er_Plugins
A workspace access plugin can add any type of Swing button to the toolbar so instead of creating the action you would be creating the toolbar button itself.
AuthorAccess.getEditorAccess().WSAuthorEditorPageBase.getActionsProvider()
which would allow you to get access to the Swing action for tracking changes we mount on the toolbar.
Probably in your ExtensionsBundle customization on the createAuthorExtensionStateListener() callback when you receive the callback ro.sync.ecss.extensions.api.AuthorExtensionStateListener.activated(AuthorAccess) you could use the API above to get access to that specific action and then maybe add a caret listener in order to enable/disable it.
Regards,
Radu
Right now you cannot define an author action in a document type association with toggle behavior (only push button). But we'll try to provide this useful functionality in a future version and I will also update this forum thread when this happens.Is it possible to create a custom toolbar (with custom actions) and have buttons which toggle?
One workaround for this approach would be for you to create a Workspace Access plugin using our Plugins SDK:
http://www.oxygenxml.com/oxygen_sdk.htm ... er_Plugins
A workspace access plugin can add any type of Swing button to the toolbar so instead of creating the action you would be creating the toolbar button itself.
You have the API:Ideally, I would not want to have to create a separate action, but would rather be able to exert some control over the out-of-the-box Author Review toolbar and menu items. If there is a way to do that, instead of the custom toolbars, I would like to know how.
AuthorAccess.getEditorAccess().WSAuthorEditorPageBase.getActionsProvider()
which would allow you to get access to the Swing action for tracking changes we mount on the toolbar.
Probably in your ExtensionsBundle customization on the createAuthorExtensionStateListener() callback when you receive the callback ro.sync.ecss.extensions.api.AuthorExtensionStateListener.activated(AuthorAccess) you could use the API above to get access to that specific action and then maybe add a caret listener in order to enable/disable it.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 5
- Joined: Wed May 14, 2014 1:43 am
Re: Togglable Custom Toolbar Button
Thank you for the quick response, Radu.
I've tried gaining access through getActionProvider (though not via WSAuthorEditorPageBase) - rather through authorAccess.getEditorAccess().getActionsProvider().getAuthorCommonActions().get("Edit/Track_Changes").
What I observed is that I can "try" to toggle, but what happens is something else takes over and re-establishes the default behavior. I can actually see the button change state briefly. I will try WSAuthorEditorPageBase, as you suggest, and see if that behaves any differently.
I realize I failed to mention in the original post - this is standalone Author.
Thanks, again
Bill
I've tried gaining access through getActionProvider (though not via WSAuthorEditorPageBase) - rather through authorAccess.getEditorAccess().getActionsProvider().getAuthorCommonActions().get("Edit/Track_Changes").
What I observed is that I can "try" to toggle, but what happens is something else takes over and re-establishes the default behavior. I can actually see the button change state briefly. I will try WSAuthorEditorPageBase, as you suggest, and see if that behaves any differently.
I realize I failed to mention in the original post - this is standalone Author.
Thanks, again
Bill
-
- Posts: 9472
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Togglable Custom Toolbar Button
Hi Bill,
I think you are on the right track.
So you tried to add some kind of caret listener and disable the actions in certain places?
Our own code also goes through the actions and enables them when the XML is opened and it might also enable/disable them based on certain listeners (caret, mouse) so it probably interferes with what you are trying to do.
You could try to add a property changed listener on the action and if the enabled property has not been changed by you (you can look at a boolean field you create in the class which you can set to "true" before you disable the action and to "false" after the action is disabled) then change the action's enabled flag back to its original value.
Regards,
Radu
I think you are on the right track.
So you tried to add some kind of caret listener and disable the actions in certain places?
Our own code also goes through the actions and enables them when the XML is opened and it might also enable/disable them based on certain listeners (caret, mouse) so it probably interferes with what you are trying to do.
You could try to add a property changed listener on the action and if the enabled property has not been changed by you (you can look at a boolean field you create in the class which you can set to "true" before you disable the action and to "false" after the action is disabled) then change the action's enabled flag back to its original value.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 5
- Joined: Wed May 14, 2014 1:43 am
Re: Togglable Custom Toolbar Button
Hi, again, Radu
To answer your question, yes, I have a caret listener which attempts to change the actions:
Bill
To answer your question, yes, I have a caret listener which attempts to change the actions:
Code: Select all
AuthorEditorAccess editorAccess = authorAccess.getEditorAccess();
if (<my XPath based condition>) {
for (String key : new String[] { "Edit/Track_Changes", "Edit/Accept_Change" }) {
AbstractAction action =
(AbstractAction) editorAccess.getActionsProvider().getAuthorCommonActions().get(key);
action.setEnabled(false);
}
}
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