Using importGlobalOptions in a menu option is not updating UI dialog/views
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 11
- Joined: Mon Sep 14, 2020 6:43 pm
Using importGlobalOptions in a menu option is not updating UI dialog/views
Hello,
I am using method PluginWorkspace importGlobalOptions to include some global options such transformation associations and dita transformation scenarios.
If I do this as part of a WorkspaceAccessPluginExtension.applicationStarted everything imports fine.
However, I have been changing this code to be executed in a Menu option. I want to let the user choose between some alternatives they can use dynamically. I would not like having the users clicking the standard menu "Options > Import Global Options..." so they do not have to look for the right file and choose the right import options every time.
But the problem is that when I use importGlobalOptions in this context then the options are not being updated in the UI views.
For example, if I click a Menu option to change some scenario association, the importGlobalOptions commands executes correctly, but changes are not being reflected in the "Configure Transformation Scenario(s)" dialog or view.
Should I be doing something else to trigger the update of the UI views, etc? Or Is there something else I can do??
As a reference I am using Oxygen XML Author and SDK version 22.0.
Thank you!
I am using method PluginWorkspace importGlobalOptions to include some global options such transformation associations and dita transformation scenarios.
If I do this as part of a WorkspaceAccessPluginExtension.applicationStarted everything imports fine.
However, I have been changing this code to be executed in a Menu option. I want to let the user choose between some alternatives they can use dynamically. I would not like having the users clicking the standard menu "Options > Import Global Options..." so they do not have to look for the right file and choose the right import options every time.
But the problem is that when I use importGlobalOptions in this context then the options are not being updated in the UI views.
For example, if I click a Menu option to change some scenario association, the importGlobalOptions commands executes correctly, but changes are not being reflected in the "Configure Transformation Scenario(s)" dialog or view.
Should I be doing something else to trigger the update of the UI views, etc? Or Is there something else I can do??
As a reference I am using Oxygen XML Author and SDK version 22.0.
Thank you!
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Using importGlobalOptions in a menu option is not updating UI dialog/views
Hi,
Such a problem may occur if Oxygen does not have explicit listeners in its code to update various components when options are changed.
Each global option in Oxygen has an option key. For example a set of transformation scenarios may be serialized to XML something like:
I looked in our code and we seem to have listeners which update our Transformation Scenarios view when the "scenario.associations" is updated to contain a new list of scenarios. We also seem to have listeners on the "scenario.associations" options key.
Can you maybe send us (support@oxygenxml.com) an options XML file along with Java sample code showing how you import it on your side? Also give some details about what you expect Oxygen's behavior to be after the options are imported? What Oxygen side view or dialog should be updated?
Regards,
Radu
Such a problem may occur if Oxygen does not have explicit listeners in its code to update various components when options are changed.
Each global option in Oxygen has an option key. For example a set of transformation scenarios may be serialized to XML something like:
Code: Select all
<entry>
<String>scenario.associations</String>
<scenarioAssociation-array>
<scenarioAssociation>
Can you maybe send us (support@oxygenxml.com) an options XML file along with Java sample code showing how you import it on your side? Also give some details about what you expect Oxygen's behavior to be after the options are imported? What Oxygen side view or dialog should be updated?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 11
- Joined: Mon Sep 14, 2020 6:43 pm
Re: Using importGlobalOptions in a menu option is not updating UI dialog/views
Thanks Radu,
I have sent some sample code and files as you requested. I am new to Oxygen development so I hope to be doing things right. At the end, all I need is to be able to change some transformation scenario data (such output directories) and transformation associations from a Menu option. I am trying to use the "importGlobalOptions" as I did not find any other way to do this. Please take a look at the info I sent and if you need something else just let me know.
Thanks!
I have sent some sample code and files as you requested. I am new to Oxygen development so I hope to be doing things right. At the end, all I need is to be able to change some transformation scenario data (such output directories) and transformation associations from a Menu option. I am trying to use the "importGlobalOptions" as I did not find any other way to do this. Please take a look at the info I sent and if you need something else just let me know.
Thanks!
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Using importGlobalOptions in a menu option is not updating UI dialog/views
Hi,
Thanks for the samples. I can reproduce the problem on my side. Oxygen has a repository of transformation scenarios and it seems we are not reloading that repository automatically when the value of the global key "scenarios" changes in the global options. I added an internal issue to look more into this.
As a possible workaround, we have API to access the project view "ro.sync.exml.workspace.api.standalone.StandalonePluginWorkspace.getProjectManager()". A project ".xpr" file can also contain scenarios and various other settings. And we have API (version 22.0 and newer) to force load an XPR in the Project view:
ro.sync.exml.workspace.api.standalone.project.ProjectController.loadProject(File)
From what I looked in our code, if a loaded project XPR file comes with scenarios, Oxygen's inner scenarios repository should refresh and the scenarios should appear in the Transformation side view for example.
Regards,
Radu
Thanks for the samples. I can reproduce the problem on my side. Oxygen has a repository of transformation scenarios and it seems we are not reloading that repository automatically when the value of the global key "scenarios" changes in the global options. I added an internal issue to look more into this.
As a possible workaround, we have API to access the project view "ro.sync.exml.workspace.api.standalone.StandalonePluginWorkspace.getProjectManager()". A project ".xpr" file can also contain scenarios and various other settings. And we have API (version 22.0 and newer) to force load an XPR in the Project view:
ro.sync.exml.workspace.api.standalone.project.ProjectController.loadProject(File)
From what I looked in our code, if a loaded project XPR file comes with scenarios, Oxygen's inner scenarios repository should refresh and the scenarios should appear in the Transformation side view for example.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 11
- Joined: Mon Sep 14, 2020 6:43 pm
Re: Using importGlobalOptions in a menu option is not updating UI dialog/views
Hi Radu,
Thanks for the workaround. I have tried this and when I call the "ProjectController.loadProject(File)" method I get a dialog notifying that project has changed. I can reload or dismiss the change. If I reload then I get all the updates properly.
Currently, what I am doing is, I am updating directly the scenario info in the project file.xpr. As soon as I save the file I call the loadProject method.
I am not sure if this should be done in a different way but if you have any suggestion please let me know.
Regards,
Thanks for the workaround. I have tried this and when I call the "ProjectController.loadProject(File)" method I get a dialog notifying that project has changed. I can reload or dismiss the change. If I reload then I get all the updates properly.
OxygenLoadProject.JPG
Currently, what I am doing is, I am updating directly the scenario info in the project file.xpr. As soon as I save the file I call the loadProject method.
I am not sure if this should be done in a different way but if you have any suggestion please let me know.
Regards,
You do not have the required permissions to view the files attached to this post.
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Using importGlobalOptions in a menu option is not updating UI dialog/views
Hi,
Oxygen looks at the timestamp on disk to check if a file was modified or not and then show that reload dialog. Maybe you could preserve the file.lastModified() before modifying the file and then set back the same timestamp on it. I think that will prevent Oxygen from automatically detecting a change in the XPR contents.
Regards,
Radu
Oxygen looks at the timestamp on disk to check if a file was modified or not and then show that reload dialog. Maybe you could preserve the file.lastModified() before modifying the file and then set back the same timestamp on it. I think that will prevent Oxygen from automatically detecting a change in the XPR contents.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 11
- Joined: Mon Sep 14, 2020 6:43 pm
Re: Using importGlobalOptions in a menu option is not updating UI dialog/views
Hi, just to confirm that this is a useful trick to prevent the "project file changed" dialog. However, in this case, if I have only one project open, when method "loadProject" is called to force reload this one project then nothing happens. Not sure is there is a validation to stop the project being actually reloaded if no change detected?
So right now, it seems that the only useful workaround is to allow the reload dialog to show up and hit the reload button to make sure everything gets actually reloaded and updated.
I guess the ideal solution is that the importGlobalOptions could be fixed so it updates the repositories in a future release. In the meantime, if you get to find any other suggestion please let me know.
Thanks,
So right now, it seems that the only useful workaround is to allow the reload dialog to show up and hit the reload button to make sure everything gets actually reloaded and updated.
I guess the ideal solution is that the importGlobalOptions could be fixed so it updates the repositories in a future release. In the meantime, if you get to find any other suggestion please let me know.
Thanks,
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Using importGlobalOptions in a menu option is not updating UI dialog/views
Hi,
About this remark:
Anyway, we made some progress on the automatic reload when the scenarios and scenario associations keys are changed using the API, hopefully we'll be able to make this work in version 23 (November this year). I will update this forum thread if we do.
Regards,
Radu
About this remark:
Indeed if the same project is already loaded and there is no modification detected on disk we probably no longer force re-load it. Maybe you could load an empty project and then the project with the options to always force reloading it.Not sure is there is a validation to stop the project being actually reloaded if no change detected?
Anyway, we made some progress on the automatic reload when the scenarios and scenario associations keys are changed using the API, hopefully we'll be able to make this work in version 23 (November this year). I will update this forum thread if we do.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 11
- Joined: Mon Sep 14, 2020 6:43 pm
Re: Using importGlobalOptions in a menu option is not updating UI dialog/views
Hi Radu,
this is great news, glad you have made progress with the scenarios reloading when using the API.
Also, thanks for the suggestion about the empty project. I will try this and see how it works.
I think these two options, either the empty project or even keeping the reload dialog are good for me for now
while waiting for the improvement. Hopefully you will be able to make it for version 23.
I appreciate all the help. Thank you very much!
Regards,
Gerardo
this is great news, glad you have made progress with the scenarios reloading when using the API.
Also, thanks for the suggestion about the empty project. I will try this and see how it works.
I think these two options, either the empty project or even keeping the reload dialog are good for me for now
while waiting for the improvement. Hopefully you will be able to make it for version 23.
I appreciate all the help. Thank you very much!
Regards,
Gerardo
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Using importGlobalOptions in a menu option is not updating UI dialog/views
Hi Gerardo,
We released Oxygen 23 which should automatically reload its internal list of transformation scenarios when setting the scenarios list using our APIs.
Regards,
Radu
We released Oxygen 23 which should automatically reload its internal list of transformation scenarios when setting the scenarios list using our APIs.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 11
- Joined: Mon Sep 14, 2020 6:43 pm
Re: Using importGlobalOptions in a menu option is not updating UI dialog/views
Hi Radu/Oxygen team,
Thanks for helping this feature to be implemented in version 23. I am able to use importGlobalOptions to import global transformation scenarios and it has worked good for me so far.
Still, I recently noticed a situation where it seems there is a glitch when updating the scenario catalog lists.
However, the strange part is that the glitch does not happen with the "Global" scenario list but with the "Project" scenario list.
This is how the glitch happens:
- Have at least one Project Transformation Scenario defined for the current project in advanced.
- Use method importGlobalOptions to import some Global scenarios via a custom menu option
- Click on "Configure Transformation Scenario(s)" icon. Global scenario list has been updated correctly but Project scenario list has disappeared!
- At this point, if you switch to another project momentarily and then get back to the previous project, then the Project scenario list will reload again for some reason. This also happens if you close and restart the Oxygen application.
I believe this can be reproduced with the sample code I once sent. If you need something else just let me know.
As reference, I am using Oxygen / SDK v23.0
Regards,
Thanks for helping this feature to be implemented in version 23. I am able to use importGlobalOptions to import global transformation scenarios and it has worked good for me so far.
Still, I recently noticed a situation where it seems there is a glitch when updating the scenario catalog lists.
However, the strange part is that the glitch does not happen with the "Global" scenario list but with the "Project" scenario list.
This is how the glitch happens:
- Have at least one Project Transformation Scenario defined for the current project in advanced.
- Use method importGlobalOptions to import some Global scenarios via a custom menu option
- Click on "Configure Transformation Scenario(s)" icon. Global scenario list has been updated correctly but Project scenario list has disappeared!
- At this point, if you switch to another project momentarily and then get back to the previous project, then the Project scenario list will reload again for some reason. This also happens if you close and restart the Oxygen application.
I believe this can be reproduced with the sample code I once sent. If you need something else just let me know.
As reference, I am using Oxygen / SDK v23.0
Regards,
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Using importGlobalOptions in a menu option is not updating UI dialog/views
Hi Gerardo,
It would be great if you would create a small test project along with precise steps to reproduce the problem for this and send it to us (support@oxygenxml.com). I could try to find some time to look into this.
Regards,
Radu
It would be great if you would create a small test project along with precise steps to reproduce the problem for this and send it to us (support@oxygenxml.com). I could try to find some time to look into this.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
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