access to author actions from state listener

Oxygen general issues.
Chemo
Posts: 19
Joined: Mon Aug 15, 2011 10:57 am

access to author actions from state listener

Post by Chemo »

Hello again.

I am trying to modify the [ENTER] - content completion menu, so that automatically only tags are listed where there is an author action defined.

My problem now is to get access to an author action list, set or map from out of the state listener (which modifies the content completion - list).
If I am not mistaken natively there is only an access via

Code: Select all

authorAccess.getEditorAccess().getActionsProvider().getAuthorExtensionActions()
.
But the author action access is only accesible in various methods of classes, like the activated-method of the SchemaManagerFilter.

Is there an easier way to check the author actions from the point of view of a state listener implementation (or maybe from my ExtensionBundle - implementing class itself)?

thanks for every hint,
thomas.

PS: can anyone tell me how i can delete the element, comment and split - items in the content completion list?
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: access to author actions from state listener

Post by Radu »

Hi,
I am trying to modify the [ENTER] - content completion menu, so that automatically only tags are listed where there is an author action defined.
I do not quite understand what you are trying to accomplish.

If you edit the document type associated to the XML, in the Author tab there is a Content Completion tab. In this tab you can provide additional author actions to the content completion window. The actions will be added to the content completion window only if in the invocation context the XPath expressions you have defined for them are valid.

Are you trying to filter the list of elements shown in the CC window based on the fact that certain author actions also need to be enabled at that point?
This method in the SchemaManagerFilter:

Code: Select all

ro.sync.contentcompletion.xml.SchemaManagerFilter.filterElements(List<CIElement>, WhatElementsCanGoHereContext)
gives you access to a context which can be used to see in what element the content completion has been invoked.

If you want to have the AuthorAccess in an implementation of SchemaManagerFilter:

In the ExtensionsBundle there is a method which can be overwritten:

Code: Select all

ro.sync.ecss.extensions.dita.DITAExtensionsBundle.createAuthorExtensionStateListener()
The extension state listener receives activation events which give the AuthorAccess object.
When such an event is received, you could set the object also in the SchemaManager filter implementation which you can keep as a field in the ExtensionsBundle class.

The method:

Code: Select all

authorAccess.getEditorAccess().getActionsProvider().getAuthorExtensionActions()
gives you access to Java Swing AbstractAction's which wrap Author actions so I do not know if you can access a certain AuthorOperation implementation using this approach.
can anyone tell me how i can delete the element, comment and split - items in the content completion list?
If you edit the document type associated to the XML, in the Author tab there is a Content Completion tab.
In this tab there is a list called Filter - Remove content completion items. In this list you can add the render names for the elements to remove. For the split, there is a special macro <SPLIT> which you can add to specify that you do not want the split entries to appear.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Chemo
Posts: 19
Joined: Mon Aug 15, 2011 10:57 am

Re: access to author actions from state listener

Post by Chemo »

Hi Radu. Thanks for your help.
If you want to have the AuthorAccess in an implementation of SchemaManagerFilter:
Yes, thats what I need.
The extension state listener receives activation events which give the AuthorAccess object.
When such an event is received, you could set the object also in the SchemaManager filter implementation which you can keep as a field in the ExtensionsBundle class.
I already tried that before but made a mistake and all i got were null pointer exceptions. Thats the reason I asked here if there is a less complicated way to get access to author access.
I rechecked the code and fixed the error. Everything works fine now.
Thank you!

Also thanks for the hint to hide the split, element and comment - option in content completion.
Post Reply